MyBB Community Forums

Full Version: WordBB - Little Code Hacking
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have made many changes and now one more change is left for me according to my plans.I tried reading the wordbb code again and again but I couldn't comprehend the code.

Here is what I am trying,
WordBB posts blog comments in the forum as 'Guest'.I was trying to fix this issue by editing some part of the code.

WordBB Code for posting comments:
function wordbb_comment_on_post($comment_post_ID)
	global $wordbb;

		// post this reply to the corresponding thread

		$comment_content = ( isset($_POST['comment']) ) ? trim($_POST['comment']) : null;




		header('Location: '.$location);


And the do action code:
function wordbb_do_action($action,$params)
	global $wordbb;


	// uses parse_url to validate data
	// tnx to Tikitiki
	$url = parse_url($wordbb->action_url);
		return false;
		$url['port'] = 80;
		$url['path'] = "/";
		$url['path'] .= "?{$url['path']}";

	$reqbody = "";
	$reqbody.= "action=".urlencode($action);
	foreach($params as $key=>$val)
		if (!empty($reqbody)) $reqbody.= "&";
		$reqbody.= $key."=".urlencode($val);

	$contentlength = strlen("$reqbody\r\n"); // tnx to Rog
	// tnx to mike for letting me discover the Host \r\n bug
	$reqheader =  "POST {$url['path']} HTTP/1.0\r\n".
	"Host: {$url['host']}\r\n". "User-Agent: PostIt\r\n". "Connection: Close\r\n".
	"Content-Type: application/x-www-form-urlencoded\r\n".
	"Content-Length: $contentlength\r\n\r\n".
	$socket = @fsockopen($url['host'], $url['port'], $errno, $errstr);
	@stream_set_timeout($socket, 10);
		return false;

	fputs($socket, $reqheader);

		$result .= fgets($socket, 12800);

	//separate header and content
	$data = explode("\r\n\r\n", $result, 2);
	return $result;

I don't get which part of the plugin is responsible for creating the posts in the forum.I'd like to know which part does it and how can I provide a user who posted not 'Guest'.

If you wish to see the whole code then go here:

Try logging in as another user that has been created since the bridge was installed.

My guess is that the uid does not exist so it is posting as a guest


I wrote my own way of doing this. I created a REST client which checks for a randomized shared secret code from a pool of shared codes that can only be used once.

I generate them in batches of about 5000 randomized unique strings, once it is used it is logged in the DB as used and removed from the pool so that it can never be used again.

Wordpress posts the teaser (everything before the <!--more-->) into a forum post in mybb.

I then use the replies in the mybb thread as the comments in wordpress. So the user never has to login to wordpress. The way I generate the comments for wordpress to pick up is I generate an RSS feed of each posts through custom code and then I use the wordpress SimplePie class to interperet these and simple post them as comments.

You can see it all at

In the end it was better for me to write the code myself, I knew it would work how I had it and it was much more secure as well