MyBB Community Forums

Full Version: Ryan G's Mods And Plugins - Updated for 1.4!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
myhekim Wrote:
$ipquery = $db->simple_select("users", "regip", "uid = '{$fromuid}'", array('limit' => 1));
that should be:
$ipquery = $db->simple_select(TABLE_PREFIX."users", "regip", "uid = '{$fromuid}'", array('limit' => 1));
Will fix when I get time. thx
i think my table prefix is different from mybb_ so this problem will happen i tried it but now user will resgistrate but an error said that forums count don't update.. tikitiki please update your mod with different table prefix's sites
What do you mean? TABLE_PREFIX will return the prefix you have set in your config.php file.
Weird...

I use the "Post on Registration" plugin and {username} isn't being recognized.
IMPAQ Wrote:Weird...

I use the "Post on Registration" plugin and {username} isn't being recognized.

Hmm, I use it, and its not even posting.... :/
I don't see anything wrong with this:

function postonreg_run()
{
	global $mybb, $db, $username;
		
	$fromuid = intval($mybb->settings['postonreg_uid']);
	if($fromuid == "" || $fromuid === NULL) 
	{
		$fromuid = -2;
	}
	
	$fid = intval($mybb->settings['postonreg_fid']);
	
	if($fid == "" || $fid === NULL)
	{
		$continue = false;
	}
	
	if($continue !== false)
	{
		$message = str_replace('{username}', htmlspecialchars_uni($username), $mybb->settings['postonreg_message']);
        $subject = str_replace('{username}', htmlspecialchars_uni($username), $mybb->settings['postonreg_subject']); 
		$ipquery = $db->simple_select(TABLE_PREFIX."users", "regip", "uid = '{$fromuid}'", array('limit' => 1));
		$ip = $db->fetch_array($ipquery);
	
		$new_thread = array(
			"fid" => intval($mybb->settings['postonreg_fid']),
			"subject" => $db->escape_string($subject),
			"icon" => -1,
			"uid" => $fromuid,
			"username" =>  $db->escape_string($username),
			"dateline" => time(),
			"lastpost" => time(),
			"lastposter" =>  $db->escape_string($username),
			"views" => 0,
			"replies" => 0,
			"visible" => 1
		);

		$db->insert_query(TABLE_PREFIX."threads", $new_thread);
		$tid = $db->insert_id();
	
		$new_post = array(
		  	"tid" => $tid,
		  	"fid" => intval($mybb->settings['postonreg_fid']),
		  	"subject" => $db->escape_string($subject),
		  	"icon" => -1,
		  	"uid" => $fromuid,
		  	"username" => $db->escape_string($username),
		  	"dateline" => time(),
		  	"message" => $db->escape_string($message),
		  	"ipaddress" => $ip['regip'],
		  	"includesig" => $mybb->settings['postonreg_sig'],
		  	"smilieoff" => "no",
		  	"visible" => 1
		);
		$db->insert_query(TABLE_PREFIX."posts", $new_post);
		$pid = $db->insert_id();
	
		//
		// Update the firstpost column
		//
		$firstpostup['firstpost'] = $pid;
		$db->update_query(TABLE_PREFIX."threads", $firstpostup, "tid='$tid'");
		updatethreadcount($tid);
		updateforumcount(intval($mybb->settings['postonreg_fid']));
	}
}

Am I missing something?
can you tell me Private Messages Admin is used for?where can i see it works in my forum?
asmilewyt Wrote:can you tell me Private Messages Admin is used for?where can i see it works in my forum?
It enables you to read your members PMs, so, if a member complains of a problematic member PM'ing them, you can investigate.


Tikitiki, in addition to not recognizing {username}, it's not showing the author on the 'latest posts' shown on the portal.
Are you using exactly {username} or have any chars capsed?