PDA

View Full Version : Welcome post for new members


LewisTheobald
08-16-2012, 03:05 PM
Hello,

I'm looking for something to allow me to automatically welcome new members in their own intro threads.
I've found a couple of mods that allow my bot to create a new thread when a new member joins, but I want my bot to automatically post in any thread that is made in my introductions section.

I hope that makes sense, thanks to anybody who can help!

Eosian
08-16-2012, 05:54 PM
Create a plugin on newthread_post_complete



if ( in_array( $foruminfo['forumid'], Array( 1 /* Set any forum ids you want this to apply to here */ ) ) )
{
$posterid = 3; // Set your bot ID here.
$posttitle = 'Welcome Aboard!'; // Set your reply title here.
$template_name = 'auto_greet_template'; // create or use your own.

$templater = vB_Template::create($template_name);
$templater->register_page_templates();
/* Add any variables you want the template to have */
$templater->register('username', $vbulletin->userinfo['username']);
$templater->register('forumname', $vbulletin->options['bbtitle'] );
$postmessage = $templater->render();



$dataman =& datamanager_init('Post', $vbulletin, ERRTYPE_STANDARD, 'threadpost');
$dataman->set_info('thread', $newpost);
$dataman->set_info('forum', $foruminfo);
$dataman->set_info('is_automated', true);
$dataman->set('threadid', $newpost['threadid']);
$dataman->set('userid', $posterid);
$dataman->set('allowsmilie', false);
$dataman->set('visible', true);
$dataman->set('title', $posttitle);
$dataman->set('ipaddress', '127.0.0.1');
$dataman->set('pagetext', $postmessage);

$postid = $dataman->save();
unset($dataman);
}



You can easily modify this to work on several forums with different templates, or to work on all forums to automatically add a second post of some sort, such as an advertisement post.

My sample template looks like this;

Welcome to {vb:raw forumname}, {vb:raw username}!

LewisTheobald
08-20-2012, 01:48 PM
Thank you so much! I really appreciate it.