MyBB Hacks

Full Version: PM to New Users
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3

71.103.182.118

ZiNgA BuRgA Wrote:
goindex Wrote:Thank you so much, ZINgA BuRgA.

But... this is not what I want.
I want a mod for send a pm to administrator every time when a new user register to forum.
This message I want to contain:
- name of new user
- ip adress
- e-mail used for registration

The mod I'm requesting is for a PM to be sent to me when a new user registers on the forums with the information listed above, if possible.
Oh okay, sorry.

77.125.132.137 Wrote:I think that can be done with small changes to the current plugin, no?
Of course,
Find:

PHP Code:
		'toid' => $user_info['uid'],
		'fromid' => intval($mybb->settings['pmregister_fromuid']),


Replace with:

PHP Code:
		'fromid' => $user_info['uid'],
		'toid' => intval($mybb->settings['pmregister_fromuid']),


This will cause the PMs to be sent to you.


Is there a way that BOTH can be implimented?

Anime King King King

Nice mod
add_hook('member_do_register_end', 'pmregister_run'); function pmregister_info() { return array( 'name' => 'PM to New Users', 'description' => 'Automatically sends a PM to newly registered members.', 'website' => 'http://mybbhacks.zingaburga.com/', 'author' => 'ZiNgA BuRgA', 'authorsite' => 'http://zingaburga.com/', 'version' => '1.0' ); } function pmregister_activate() { global $db; $db->insert_query(TABLE_PREFIX."settinggroups", array( 'name' => 'pmregister', 'title' => 'PM to New Users Options', 'description' => '', 'disporder' => 200, 'isdefault' => MY_NO )); $gid = $db->insert_id(); $db->insert_query(TABLE_PREFIX.'settings', array( 'name' => 'pmregister_fromuid', 'title' => 'Sender UID', 'description' => 'UserID of the sender of the PM', 'optionscode' => 'text', 'value' => '1', 'disporder' => 1, 'gid' => $gid )); $db->insert_query(TABLE_PREFIX.'settings', array( 'name' => 'pmregister_subject', 'title' => 'PM Subject', 'description' => 'Subject of the PM.', 'optionscode' => 'text', 'value' => 'Welcome to the Forums!', 'disporder' => 3, 'gid' => $gid )); $db->insert_query(TABLE_PREFIX.'settings', array( 'name' => 'pmregister_message', 'title' => 'PM Message', 'description' => $db->escape_string('The message to send to the user. Use {username} to specify their username, {uid} for the UserID, {email} for their email address, and {regip} for registration IP. Note that this field is also eval\'d, allowing some other values (ie {$mybb->settings[\'bburl\']})'), 'optionscode' => 'textarea', 'value' => $db->escape_string('Hi {username}, Thankyou for taking the time to register at {$mybb->settings[\'bbname\']}! I\'d like to personally welcome you to our community, and I hope you enjoy your stay here. If you have any queries, please feel free to respond to this PM. Regards, {$mybb->settings[\'bbname\']} Staff'), 'disporder' => 4, 'gid' => $gid )); rebuildsettings(); } function pmregister_deactivate() { global $db; $gid = $db->fetch_field($db->simple_select(TABLE_PREFIX.'settinggroups', 'gid', 'name="pmregister"'), 'gid'); if($gid) { $db->delete_query(TABLE_PREFIX.'settings', 'gid='.$gid); $db->delete_query(TABLE_PREFIX.'settinggroups', 'gid='.$gid); rebuildsettings(); } } function pmregister_run() { global $lang, $mybb, $user_info, $user, $session, $db; if($mybb->settings['enablepms'] == 'no') return; $fromid = intval($mybb->settings['pmregister_fromuid']); if($user_info['receivepms'] == 'no') return; $lang->load('messages'); // required for email notification include_once MYBB_ROOT.'inc/datahandlers/pm.php'; include_once MYBB_ROOT.'inc/functions_user.php'; // required by above file $pmh = new PMDataHandler(); $message = strtr($mybb->settings['pmregister_message'], array('{username}' => $user_info['username'], '{uid}' => $user_info['uid'], '{email}' => $user_info['email'], '{password}' => $user_info['password'], '{regip}' => $session->ipaddress)); // set up evals $message = str_replace("\\'", "'", $db->escape_string($message)); eval('$message = "'.$message.'";'); $pm = array( 'username' => $user_info['username'], 'toid' => $user_info['uid'], 'fromid' => intval($mybb->settings['pmregister_fromuid']), 'subject' => $mybb->settings['pmregister_subject'], 'message' => $message, 'options' => array( 'signature' => 'no', 'disablesmilies' => 'no', 'savecopy' => 'no', 'readreceipt' => 'no' ) ); $pmh->admin_override = true; $pmh->set_data($pm); // it _should_ validate... - if not (ie PMs disabled), we'll ignore it if($pmh->validate_pm()) $pmh->insert_pm(); unset($pmh); } ?>
when i click the attachment on this forum its says that i mean
All I can say is something really "screwed up" with your server (it should never be outputting the contents of CGI scripts if set up correctly).
This one node working for 1.4
Pages: 1 2 3
Reference URL's