RE: PM to New Users
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
|