Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Not Solved [How To?] Set a UserID??
#1
Not Solved
Let me explain first, I am using this in a template to generate a unique user id based on the users ip address.

User ID: <?=hexdec(substr(md5($post['ipaddress']), 0, 10))?> 

Works well.....

Now i am also using the op image plugin to display an image next to a thread author, works good for members but all guests have the op image when posting in a thread made by a guest.

So im guessing its because the user id of guests is still actually 0, so i am guessing that i need a way to set the user id from the above code, so it changed the standard 0 of every guest to the actual code above.

Im really stuck on this, any idea's

And the opimage code incase its needed..

function opimage_activate() {
	require MYBB_ROOT.'/inc/adminfunctions_templates.php';
	find_replace_templatesets("postbit", '#'.preg_quote('{$post[\'onlinestatus\']}').'#', '{$post[\'onlinestatus\']}{\$post[\'opimage\']}');
	find_replace_templatesets("postbit_classic", '#'.preg_quote('{$post[\'onlinestatus\']}').'#', '{$post[\'onlinestatus\']}{\$post[\'opimage\']}');
}

function opimage_deactivate() {
	require  MYBB_ROOT.'/inc/adminfunctions_templates.php';
	find_replace_templatesets("postbit", '#'.preg_quote('{$post[\'opimage\']}').'#', '',0);
	find_replace_templatesets("postbit_classic", '#'.preg_quote('{$post[\'opimage\']}').'#', '',0);
}

function opimage_function(&$post) {	
	global $theme, $thread;
	if($thread['uid'] == $post['uid']) 
	{
		$post['opimage'] = "<img src=\"images/opimage.png\" alt=\"O.P.\" title=\"O.P.\" />";
	}
	else 
	{
		$post['opimage'] = "";
	}
}
?>


Forum Jump:


Users browsing this thread: 1 Guest(s)