Recent Topics

1 Feb 11, 2009 02:15    

From my blog post: https://orezpraw.com/blog/making-loudtwitter-and-b2evolution-play

I wrote a patch to help LoudTwitter and b2evolution 2.4.6 play along together. Once you apply the patch you must configure LoudTwitter to use XML-RPC with an endpoint URL like http://yoursite.com/blogs/xmlsrv/xmlrpc.php?blog=6. Instead of "6" you should put ID of blog you wish LoudTwitter to post on.

The problem was that LoudTwitter didn't specify a blog ID. This patch lets you override the blog ID with the standard b2evo GET/POST/COOKIE method, and if none of those are set falls back to the XML-RPC specified blog ID. The patch also fixes some brain-dead XML-RPC error reporting code in the same file that threw away the actual error message.

Patch:

diff -ru b2evolution/blogs/inc/xmlrpc/model/_xmlrpcs.funcs.php b2evolution-lt/blogs/inc/xmlrpc/model/_xmlrpcs.funcs.php
--- b2evolution/blogs/inc/xmlrpc/model/_xmlrpcs.funcs.php	2009-01-13 01:35:04.000000000 -0700
+++ b2evolution-lt/blogs/inc/xmlrpc/model/_xmlrpcs.funcs.php	2009-02-09 23:01:11.000000000 -0700
@@ -196,8 +196,7 @@
 {
 	global $xmlrpcs_errcode, $xmlrpcs_errmsg, $xmlrpcerruser;
 
-	$blog = $m->getParam( $blog_param );
-	$blog = $blog->scalarval();
+	$blog = param( 'blog', 'integer', 0, true );
 
   /**
 	 * @var BlogCache
@@ -209,6 +208,16 @@
 	$Blog = & $BlogCache->get_by_ID( $blog, false, false );
 
 	if( empty( $Blog ) )
+	{	/**
+		 * Blog not found -- no GET/POST/cookie/whatever 
+		 * Fall back to actual XML method
+		 */
+		$blog = $m->getParam( $blog_param );
+		$blog = $blog->scalarval();
+		$Blog = & $BlogCache->get_by_ID( $blog, false, false );
+	}
+
+	if( empty( $Blog ) )
 	{	// Blog not found
 		$xmlrpcs_errcode = $xmlrpcerruser+2;
 		$xmlrpcs_errmsg = 'Requested blog/Collection ('.$blog.') does not exist.';
@@ -279,7 +288,7 @@
 	{	// Custom message
 		$xmlrpcs_errmsg = $errmsg;
 	}
-	else
+	elseif ( empty($xmlrpcs_errmsg) )
 	{	// Use a standard messsage
 		switch( $errcode )
 		{
@@ -440,4 +449,4 @@
 
 
 
-?>
\ No newline at end of file
+?>

2 Feb 19, 2009 09:40

Hi orezpraw. Ya know what? I can't say your username. I can copy/paste it, but my brain keeps seeing "oz re-paw" like you replace animal paws in Australia or something. Weird. My brain I mean. My brain is weird.

Hey can I ask you a favor after thanking you for sharing what you've learned and done? Could you please make it easy for dumb folk like me by saying simple stuff to simple people? What I mean is if you say "in this file find this bit and replace it with a new piece" I can follow you. If on the other hand you say "here is the diff with pluses and minuses" people like me will run away and cry because we're ashamed of how dumb we are.

<RELATED> You smart people are all alike. You talk like us regular folk understand you! We don't, so when you do something smart PLEASE bring it back down to our level. An example is a device that can extract undesirable biological matter from your flooring treatment to you is actually a really good vacuum cleaner to us. </RELATED>


Form is loading...