WordPress 2.5+ ONLY. Enhance your Registration Page. Add Custom Logo, Password Field, Invitation Codes, Disclaimer, Captcha Validation, Email Validation, User Moderation, Profile Fields and more.
Author: Skullbit
Version: 3.3
Author URI: http://www.skullbit.com
LOCALIZATION
Place your language file within this plugin directory and name it "regplus-{language}.mo" replace {language} with your language value from wp-config.php
CHANGELOG
v3.3 - July 23, 2006
* Updated conflict warning error to only appear on the RegPlus options page only.
v3.2 - July 22, 2008
* Fixed Custom Field Checkbox saving issue
* Additional field types available for Custom Fields.
* Password Meter is now optional and text is editable within options page
v3.1 - July 8, 2008
* Added Logo Removal Option
* Updated Email Validation text after registering
* Added User Sub-Panel for resending validation emails and automatic admin validation
* Added User Moderation Ability - new registrations must be approved by admin before becoming active.
* Fixed bad version control code
v3.0.2 - June 23, 2008
* Updated Email notifications to use a filter to replace the From Name and Email address
v3.0.1 - June 19, 2008
* Added more localization files
* Added doccumentation for auto-complete queries
* Fixed Admin notification email to now actually go to the administrator
v3.0 - June 18, 2008
* Added localization to password strength text
* Added stripslashes to missing areas
* Added Login Redirect option for registration email url
* Added Ability to populate registration fields using URL GET statements
* Added Simple CAPTCHA Session check and warning if not enabled
* Added ability to email all user data in notification emails
v2.9 - June 10, 2008
* Fixed foreach error for custom invite codes
* Custom logos can now be any size
* Login fields are now hidden after registration if email verification is enabled.
v2.8 - June 9, 2008
* Fixed Fatal Error on Options Page
v2.7 - June 8, 2008
* Added full customization option to User Registration Email and Admin Email.
* Added ability to disable Admin notification email.
* Added style feature for required fields
* Added Custom Logo upload for replacing WP Logo on register & login pages
v2.6 - May 15, 2008
* Fixed error on ranpass function.
v2.5 - May 14, 2008
* Fixed registration password email to work when user set password is disabled
v2.4 - May 13, 2008
* Fixed localization issue
* Added License Agreement & Privacy Policy plus user defined titles and agree text for these and the Disclaimer
* Fixed Javascript error in IE
v2.3 - May 12, 2008
* Added reCAPTCHA support
* Fixed PHP short-code issue
* Added option to not require Invite Code but still show it on registration page
* Added ability to customize the registration email's From address, Subject and add your own message to the email body.
v2.2 - April 27, 2008
* Fixed About Us Slashes from showing with apostrophes
* Modified the Captcha code to hopefully fix some compatibility issues
v2.1 - April 26, 2008
* Fixed Admin Registation Password issue
* Added Dashboard Widget for showing invitation code tracking
* Added Email Verification for ensuring legitimate addresses are registered.
* Unvalidated registrations are unable to login and are deleted after a set grace period
v2.0 - April 20, 2008
*Added Profile Fields to registration
*Added multiple invite codes
*Added Custom User Defined Fields with Profile integration
*Added ability to ignore duplicate email registrations
v1.2 - April 13, 2008
*Altered Options saving and retrievals for less database interactions
*Added Disclaimer Feature
*Allowed register fields to retain values on submission if there is an error.
v1.1 - April 10, 2008
*Fixed Invitation Code from displaying when disabled.
*Added Captcha Feature
*/
$rp = get_option( 'register_plus' );
if( $rp['dash_widget'] )
include_once('dash_widget.php');
if( !class_exists('RegisterPlusPlugin') ){
class RegisterPlusPlugin{
function RegisterPlusPlugin() { //constructor
global $wp_version;
//ACTIONS
#Add Settings Panel
add_action( 'admin_menu', array($this, 'AddPanel') );
#Update Settings on Save
if( $_POST['action'] == 'reg_plus_update' )
add_action( 'init', array($this,'SaveSettings') );
#Enable jQuery on Settings panel
if( $_GET['page'] == 'register-plus' ){
wp_enqueue_script('jquery');
add_action( 'admin_head', array($this, 'SettingsHead') );
}
#Add Register Form Fields
add_action( 'register_form', array($this, 'RegForm') );
#Add Register Page Javascript & CSS
if($_GET['action'] == 'register')
add_action( 'login_head', array($this, 'PassHead') );
#Add Custom Logo CSS to Login Page
add_action( 'login_head', array($this, 'LogoHead') );
#Hide initial login fields when email verification is enabled
add_action( 'login_head', array($this, 'HideLogin') );
#Save Default Settings
add_action( 'init', array($this, 'DefaultSettings') );
#Profile
add_action( 'show_user_profile', array($this, 'Add2Profile') );
add_action( 'edit_user_profile', array($this, 'Add2Profile') );
add_action( 'profile_update', array($this, 'SaveProfile') );
#Validate User
add_action( 'login_form', array($this, 'ValidateUser') );
#Delete Invalid Users
add_action( 'init', array($this, 'DeleteInvalidUsers') );
#Unverified Users Head Scripts
add_action( 'admin_head', array($this, 'UnverifiedHead') );
#Admin Validate Users
if( $_POST['verifyit'] )
add_action( 'init', array($this, 'AdminValidate') );
#Admin Resend VerificatioN Email
if( $_POST['emailverifyit'] )
add_action( 'init', array($this, 'AdminEmailValidate') );
#Admin Delete Unverified User
if( $_POST['vdeleteit'] )
add_action( 'init', array($this, 'AdminDeleteUnvalidated') );
//FILTERS
#Check Register Form for Errors
add_filter( 'registration_errors', array($this, 'RegErrors') );
//LOCALIZATION
#Place your language file in the plugin folder and name it "regplus-{language}.mo"
#replace {language} with your language value from wp-config.php
load_plugin_textdomain( 'regplus', '/wp-content/plugins/register-plus' );
//VERSION CONTROL
if( $wp_version < 2.5 )
add_action('admin_notices', array($this, 'version_warning'));
}
function version_warning(){
global $wp_version;
echo "
".__('Register Plus is only compatible with WordPress v2.5 and up. You are currently using WordPress v.', 'regplus').$wp_version."
";
}
function AddPanel(){
add_options_page( 'Register Plus', 'Register Plus', 10, 'register-plus', array($this, 'RegPlusSettings') );
$regplus = get_option('register_plus');
if( $regplus['email_verify'] || $regplus['admin_verify'] )
add_users_page( 'Unverified Users', 'Unverified Users', 10, 'unverified-users', array($this, 'Unverified') );
}
function DefaultSettings () {
$default = array(
'password' => '0',
'password_meter' => '0',
'short' => 'Too Short',
'bad' => 'Bad Password',
'good' => 'Good Password',
'strong' => 'Strong Password',
'code' => '0',
'codepass' => array('0'),
'captcha' => '0',
'disclaimer' => '0',
'disclaimer_title' => 'Disclaimer',
'disclaimer_content' => '',
'disclaimer_agree' => 'Accept the Disclaimer',
'license' => '0',
'license_title' => 'License Agreement',
'license_content' => '',
'license_agree' => 'Accept the License Agreement',
'privacy' => '0',
'privacy_title' => 'Privacy Policy',
'privacy_content' => '',
'privacy_agree' => 'Accept the Privacy Policy',
'email_exists' => '0',
'firstname' => '0',
'lastname' => '0',
'website' => '0',
'aim' => '0',
'yahoo' => '0',
'jabber' => '0',
'about' => '0',
'profile_req' => array('0'),
'require_style' => 'border:solid 1px #E6DB55;background-color:#FFFFE0;',
'dash_widget' => '0',
'email_verify' => '0',
'admin_verify' => '0',
'email_delete_grace' => '7',
'html' => '0',
'adminhtml' => '0',
'from' => get_option('admin_email'),
'fromname' => get_option('blogname'),
'subject' => sprintf(__('[%s] Your username and password', 'regplus'), get_option('blogname')),
'custom_msg' => '0',
'user_nl2br' => '0',
'msg' => " %blogname% Registration \r\n --------------------------- \r\n\r\n Here are your credentials: \r\n Username: %user_login% \r\n Password: %user_pass% \r\n Confirm Registration: %siteurl% \r\n\r\n Thank you for registering with %blogname%! \r\n",
'disable_admin' => '0',
'adminfrom' => get_option('admin_email'),
'adminfromname' => get_option('blogname'),
'adminsubject' => sprintf(__('[%s] New User Register', 'regplus'), get_option('blogname')),
'custom_adminmsg' => '0',
'admin_nl2br' => '0',
'adminmsg' => " New %blogname% Registration \r\n --------------------------- \r\n\r\n Username: %user_login% \r\n E-Mail: %user_email% \r\n",
'logo' => '',
'login_redirect' => get_option('siteurl')
);
# Get Previously Saved Items and put into new Settings
if( get_option("regplus_password") )
$default['password'] = get_option("regplus_password");
if( get_option("regplus_code") )
$default['code'] = get_option("regplus_code");
if( get_option("regplus_codepass") )
$default['codepass'] = get_option("regplus_codepass");
if( get_option("regplus_captcha") )
$default['captcha'] = get_option("regplus_captcha");
#Delete Previous Saved Items
delete_option('regplus_password');
delete_option('regplus_code');
delete_option('regplus_codepass');
delete_option('regplus_captcha');
#Set Default Settings
if( !get_option('register_plus') ){ #Set Defaults if no values exist
add_option( 'register_plus', $default );
}else{ #Set Defaults if new value does not exist
$regplus = get_option( 'register_plus' );
foreach( $default as $key => $val ){
if( !$regplus[$key] ){
$regplus[$key] = $val;
$new = true;
}
}
if( $new )
update_option( 'register_plus', $regplus );
}
}
function SaveSettings(){
check_admin_referer('regplus-update-options');
$update = get_option( 'register_plus' );
$update["password"] = $_POST['regplus_password'];
$update["password_meter"] = $_POST['regplus_password_meter'];
$update["short"] = $_POST['regplus_short'];
$update["bad"] = $_POST['regplus_bad'];
$update["good"] = $_POST['regplus_good'];
$update["strong"] = $_POST['regplus_strong'];
$update["code"] = $_POST['regplus_code'];
if( $_POST['regplus_code'] ) {
$update["codepass"] = $_POST['regplus_codepass'];
foreach( $update["codepass"] as $k=>$v ){
$update["codepass"][$k] = strtolower($v);
}
$update["code_req"] = $_POST['regplus_code_req'];
}
$update["captcha"] = $_POST['regplus_captcha'];
$update["disclaimer"] = $_POST['regplus_disclaimer'];
$update["disclaimer_title"] = $_POST['regplus_disclaimer_title'];
$update["disclaimer_content"] = $_POST['regplus_disclaimer_content'];
$update["disclaimer_agree"] = $_POST['regplus_disclaimer_agree'];
$update["license"] = $_POST['regplus_license'];
$update["license_title"] = $_POST['regplus_license_title'];
$update["license_content"] = $_POST['regplus_license_content'];
$update["license_agree"] = $_POST['regplus_license_agree'];
$update["privacy"] = $_POST['regplus_privacy'];
$update["privacy_title"] = $_POST['regplus_privacy_title'];
$update["privacy_content"] = $_POST['regplus_privacy_content'];
$update["privacy_agree"] = $_POST['regplus_privacy_agree'];
$update["email_exists"] = $_POST['regplus_email_exists'];
$update["firstname"] = $_POST['regplus_firstname'];
$update["lastname"] = $_POST['regplus_lastname'];
$update["website"] = $_POST['regplus_website'];
$update["aim"] = $_POST['regplus_aim'];
$update["yahoo"] = $_POST['regplus_yahoo'];
$update["jabber"] = $_POST['regplus_jabber'];
$update["about"] = $_POST['regplus_about'];
$update["profile_req"] = $_POST['regplus_profile_req'];
$update["require_style"] = $_POST['regplus_require_style'];
$update["dash_widget"] = $_POST['regplus_dash_widget'];
$update["admin_verify"] = $_POST['regplus_admin_verify'];
$update["email_verify"] = $_POST['regplus_email_verify'];
$update["email_verify_date"] = $_POST['regplus_email_verify_date'];
$update["email_delete_grace"] = $_POST['regplus_email_delete_grace'];
$update["reCAP_public_key"] = $_POST['regplus_reCAP_public_key'];
$update["reCAP_private_key"] = $_POST['regplus_reCAP_private_key'];
$update['html'] = $_POST['regplus_html'];
$update['from'] = $_POST['regplus_from'];
$update['fromname'] = $_POST['regplus_fromname'];
$update['subject'] = $_POST['regplus_subject'];
$update['custom_msg'] = $_POST['regplus_custom_msg'];
$update['user_nl2br'] = $_POST['regplus_user_nl2br'];
$update['msg'] = $_POST['regplus_msg'];
$update['disable_admin'] = $_POST['regplus_disable_admin'];
$update['adminhtml'] = $_POST['regplus_adminhtml'];
$update['adminfrom'] = $_POST['regplus_adminfrom'];
$update['adminfromname'] = $_POST['regplus_adminfromname'];
$update['adminsubject'] = $_POST['regplus_adminsubject'];
$update['custom_adminmsg'] = $_POST['regplus_custom_adminmsg'];
$update['admin_nl2br'] = $_POST['regplus_admin_nl2br'];
$update['adminmsg'] = $_POST['regplus_adminmsg'];
$update['login_redirect'] = $_POST['regplus_login_redirect'];
if( $_FILES['regplus_logo']['name'] ) $update['logo'] = $this->UploadLogo();
else if( $_POST['remove_logo'] ) $update['logo'] = '';
if( $_POST['label'] ){
foreach( $_POST['label'] as $k => $field ){
if( $field )
$custom[$k] = array( 'label' => $field, 'profile' => $_POST['profile'][$k], 'reg' => $_POST['reg'][$k], 'required' => $_POST['required'][$k], 'fieldtype' => $_POST['fieldtype'][$k], 'extraoptions' => $_POST['extraoptions'][$k] );
}
}
update_option( 'register_plus_custom', $custom );
update_option( 'register_plus', $update );
$_POST['notice'] = __('Settings Saved', 'regplus');
}
function UploadLogo(){
$upload_dir = ABSPATH . get_option('upload_path');
$upload_file = trailingslashit($upload_dir) . basename($_FILES['regplus_logo']['name']);
//echo $upload_file;
if( !is_dir($upload_dir) )
wp_upload_dir();
if( move_uploaded_file($_FILES['regplus_logo']['tmp_name'], $upload_file) ){
chmod($upload_file, 0777);
$logo = $_FILES['regplus_logo']['name'];
return trailingslashit( get_option('siteurl') ) . 'wp-content/uploads/' . $logo;
}else{
return false;
}
}
function SettingsHead(){
$regplus = get_option( 'register_plus' );
?>
";
}
function AdminValidate(){
global $wpdb;
$regplus = get_option('register_plus');
check_admin_referer('regplus-unverified');
$valid = $_POST['vusers'];
foreach( $valid as $user_id ){
if ( $user_id ) {
if( $regplus['email_verify'] ){
$login = get_usermeta($user_id, 'email_verify_user');
$wpdb->query( "UPDATE $wpdb->users SET user_login = '$login' WHERE ID = '$user_id'" );
delete_usermeta($user_id, 'email_verify_user');
delete_usermeta($user_id, 'email_verify');
delete_usermeta($user_id, 'email_verify_date');
}else if( $regplus['admin_verify'] ){
$login = get_usermeta($user_id, 'admin_verify_user');
$wpdb->query( "UPDATE $wpdb->users SET user_login = '$login' WHERE ID = '$user_id'" );
delete_usermeta($user_id, 'admin_verify_user');
}
$this->VerifyNotification($user_id);
}
}
$_POST['notice'] = __("Users Verified","regplus");
}
function AdminDeleteUnvalidated() {
global $wpdb;
$regplus = get_option('register_plus');
check_admin_referer('regplus-unverified');
$delete = $_POST['vusers'];
include_once( ABSPATH . 'wp-admin/includes/user.php' );
foreach( $delete as $user_id ){
if ( $user_id ) {
wp_delete_user($user_id);
}
}
$_POST['notice'] = __("Users Deleted","regplus");
}
function AdminEmailValidate(){
global $wpdb;
check_admin_referer('regplus-unverified');
$valid = $_POST['vusers'];
foreach( $valid as $user_id ){
$code = get_usermeta($user_id, 'email_verify');
$user_login = get_usermeta($user_id, 'email_verify_user');
$user_email = $wpdb->get_var("SELECT user_email FROM $wpdb->users WHERE ID='$user_id'");
$email_code = '?regplus_verification=' . $code;
$prelink = __('Verification URL: ', 'regplus');
$message = sprintf(__('Username: %s', 'regplus'), $user_login) . "\r\n";
//$message .= sprintf(__('Password: %s', 'regplus'), $plaintext_pass) . "\r\n";
$message .= $prelink . get_option('siteurl') . "/wp-login.php" . $email_code . "\r\n";
$message .= $notice;
add_filter('wp_mail_from', array($register_plus, 'userfrom'));
add_filter('wp_mail_from_name', array($register_plus, 'userfromname'));
wp_mail($user_email, sprintf(__('[%s] Verify Account Link', 'regplus'), get_option('blogname')), $message);
}
$_POST['notice'] = __("Verification Emails have been re-sent", "regplus");
}
function VerifyNotification($user_id){
global $wpdb;
$regplus = get_option('register_plus');
$user = $wpdb->get_row("SELECT user_login, user_email FROM $wpdb->users WHERE ID='$user_id'");
$message = __('Your account has now been activated by an administrator.') . "\r\n";
$message .= sprintf(__('Username: %s', 'regplus'), $user->user_login) . "\r\n";
$message .= $prelink . get_option('siteurl') . "/wp-login.php" . $email_code . "\r\n";
add_filter('wp_mail_from', array($register_plus, 'userfrom'));
add_filter('wp_mail_from_name', array($register_plus, 'userfromname'));
wp_mail($user->user_email, sprintf(__('[%s] User Account Activated', 'regplus'), get_option('blogname')), $message);
}
function Unverified(){
global $wpdb;
if( $_POST['notice'] )
echo '' . $_POST['notice'] . '.
';
$unverified = $wpdb->get_results("SELECT * FROM $wpdb->users WHERE user_login LIKE '%unverified__%'");
$regplus = get_option('register_plus');
?>
' . $_POST['notice'] . '.
';
if( !is_array($regplus['profile_req']) )
$regplus['profile_req'] = array();
if( is_array($regplus['codepass']) ){
foreach( $regplus['codepass'] as $code ){
$codes .= '';
}
}
$types = 'Text Field Select Field Checkbox Radio Box Text Area Hidden Field ';
$extras = '';
if( is_array($regplus_custom) ){
foreach( $regplus_custom as $k => $v ) {
$types = '';
}
?>
:
'.$op.' ';
}
?>
:
';
} else if( $v['fieldtype'] == 'radio' ){
$ops = explode(',',$v['extraoptions']);
foreach( $ops as $op ){
$radio .= ' '.$op.' ';
}
?>
:
';
} else if( $v['fieldtype'] == 'textarea' ){ ?>
:
/>
/>
/>
';
echo rp_recaptcha_get_html($publickey);
echo ' ';
}
}
function Label_ID($label){
$id = str_replace(' ', '_', $label);
$id = strtolower($id);
$id = sanitize_user($id, true);
return $id;
}
# Add Javascript & CSS needed
function PassHead(){
$regplus = get_option( 'register_plus' );
if( isset( $_GET['user_login'] ) ) $user_login = $_GET['user_login'];
if( isset( $_GET['user_email'] ) ) $user_email = $_GET['user_email'];
if ( $regplus['password'] ){
?>
0){
$top = '' . __('Additional Information', 'regplus') . ' ';
}
echo $top;
if (!empty($regplus_custom)) {
foreach( $regplus_custom as $k=>$v ){
if( $v['profile'] ){
$id = $this->Label_ID($v['label']);
$value = get_usermeta( $user_ID, $id );
$extraops = explode(',', $v['extraoptions']);
switch( $v['fieldtype'] ){
case "text" :
$outfield = ' ';
break;
case "hidden" :
$outfield = ' ';
break;
case "select" :
$outfield = '';
foreach( $extraops as $op ){
$outfield .= '';
}
$outfield .= ' ';
break;
case "textarea" :
$outfield = '';
break;
case "checkbox" :
$outfield = '';
$valarr = explode(', ', $value);
foreach( $extraops as $op ){
$outfield .= ' ';
}
break;
case "radio" :
$outfield = '';
foreach( $extraops as $op ){
$outfield .= ' ';
}
break;
}
?>
:
$v ){
if( $v['profile'] ){
$key = $this->Label_ID($v['label']);
if( is_array($_POST[$key]) ) $_POST[$key] = implode(', ', $_POST[$key]);
$value = $wpdb->prepare($_POST[$key]);
update_usermeta($user_ID ,$key ,$value);
}
}
}
}
function RanPass($len=7) {
$chars = "0123456789abcdefghijkl0123456789mnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQ0123456789RSTUVWXYZ0123456789";
srand((double)microtime()*1000000);
$i = 0;
$pass = '' ;
while ($i <= $len) {
$num = rand() % 33;
$tmp = substr($chars, $num, 1);
$pass = $pass . $tmp;
$i++;
}
return $pass;
}
function ValidateUser(){
global $wpdb;
$regplus = get_option( 'register_plus' );
if( $regplus['admin_verify'] && isset( $_GET['checkemail'] ) ){
echo '' . __('Your account will be reviewed by an administrator and you will be notified when it is activated.', 'regplus') . '
';
}else if( $regplus['email_verify'] && isset( $_GET['checkemail'] ) ){
echo '' . __('Please activate your account using the verification link sent to your email address.', 'regplus') . '
';
}
if( $regplus['email_verify'] && isset( $_GET['regplus_verification'] ) ){
$regplus = get_option( 'register_plus' );
$verify_key = $_GET['regplus_verification'];
$user_id = $wpdb->get_var( "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = 'email_verify' AND meta_value='$verify_key'");
if ( $user_id ) {
$login = get_usermeta($user_id, 'email_verify_user');
$wpdb->query( "UPDATE $wpdb->users SET user_login = '$login' WHERE ID = '$user_id'" );
delete_usermeta($user_id, 'email_verify_user');
delete_usermeta($user_id, 'email_verify');
delete_usermeta($user_id, 'email_verify_date');
$msg = '' . sprintf(__('Thank you %s, your account has been verified, please login.', 'regplus'), $login ) . '
';
echo $msg;
}
}
}
function adminfrom(){
$regplus = get_option( 'register_plus' );
return $regplus['adminfrom'];
}
function userfrom(){
$regplus = get_option( 'register_plus' );
return $regplus['from'];
}
function adminfromname(){
$regplus = get_option( 'register_plus' );
return $regplus['adminfromname'];
}
function userfromname(){
$regplus = get_option( 'register_plus' );
return $regplus['fromname'];
}
function DeleteInvalidUsers(){
global $wpdb;
$regplus = get_option( 'register_plus' );
$grace = $regplus['email_delete_grace'];
$unverified = $wpdb->get_results( "SELECT user_id, meta_value FROM $wpdb->usermeta WHERE meta_key='email_verify_date'" );
$grace_date = date('Ymd', strtotime("-7 days"));
if( $unverified ){
foreach( $unverified as $bad ){
if( $grace_date > $bad->meta_value ){
include_once( ABSPATH . 'wp-admin/includes/user.php' );
wp_delete_user($bad->user_id);
}
}
}
}
function override_warning(){
if( current_user_can(10) && $_GET['page'] == 'register-plus' )
echo "".__('You have another plugin installed that is conflicting with Register Plus. This other plugin is overriding the user notification emails. Please see Register Plus Conflicts for more information.', 'regplus') . "
";
}
}
}# END Class RegisterPlusPlugin
# Run The Plugin!
if( class_exists('RegisterPlusPlugin') ){
$register_plus = new RegisterPlusPlugin();
}
if ( function_exists('wp_new_user_notification') )
add_action('admin_notices', array($register_plus, 'override_warning'));
# Override set user password and send email to User #
if ( !function_exists('wp_new_user_notification') ) :
function wp_new_user_notification($user_id, $plaintext_pass = '') {
$user = new WP_User($user_id);
#-- REGPLUS --#
global $wpdb, $register_plus;
$regplus = get_option( 'register_plus' );
$regplus_custom = get_option( 'register_plus_custom' );
$ref = explode( '?', $_SERVER['HTTP_REFERER']);
$ref = $ref[0];
$admin = trailingslashit( get_option('siteurl') ) . 'wp-admin/users.php';
if( !is_array( $regplus_custom ) ) $regplus_custom = array();
if( $regplus['password'] && $_POST['user_pw'] )
$plaintext_pass = $wpdb->prepare($_POST['user_pw']);
else if( $ref == $admin && $_POST['pass1'] == $_POST['pass2'] )
$plaintext_pass = $wpdb->prepare($_POST['pass1']);
else
$plaintext_pass = $register_plus->RanPass(6);
if( $regplus['firstname'] && $_POST['firstname'] )
update_usermeta( $user_id, 'first_name', $wpdb->prepare($_POST['firstname']));
if( $regplus['lastname'] && $_POST['lastname'] )
update_usermeta( $user_id, 'last_name', $wpdb->prepare($_POST['lastname']));
if( $regplus['website'] && $_POST['website'] )
update_usermeta( $user_id, 'user_url', $wpdb->prepare($_POST['website']));
if( $regplus['aim'] && $_POST['aim'] )
update_usermeta( $user_id, 'aim', $wpdb->prepare($_POST['aim']));
if( $regplus['yahoo'] && $_POST['yahoo'] )
update_usermeta( $user_id, 'yim', $wpdb->prepare($_POST['yahoo']));
if( $regplus['jabber'] && $_POST['jabber'] )
update_usermeta( $user_id, 'jabber', $wpdb->prepare($_POST['jabber']));
if( $regplus['about'] && $_POST['about'] )
update_usermeta( $user_id, 'description', $wpdb->prepare($_POST['about']));
if( $regplus['code'] && $_POST['regcode'] )
update_usermeta( $user_id, 'invite_code', $wpdb->prepare($_POST['regcode']));
if( $ref != $admin && $regplus['admin_verify'] ){
update_usermeta( $user_id, 'admin_verify_user', $user->user_login );
$temp_id = 'unverified__' . $register_plus->RanPass(7);
$notice = __('Your account requires activation by an administrator before you will be able to login.', 'regplus') . "\r\n";
}else if( $ref != $admin && $regplus['email_verify'] ){
$code = $register_plus->RanPass(25);
update_usermeta( $user_id, 'email_verify', $code );
update_usermeta( $user_id, 'email_verify_date', date('Ymd') );
update_usermeta( $user_id, 'email_verify_user', $user->user_login );
$email_code = '?regplus_verification=' . $code;
$prelink = __('Verification URL: ', 'regplus');
$notice = __('Please use the link above to verify and activate your account', 'regplus') . "\r\n";
$temp_id = 'unverified__' . $register_plus->RanPass(7);
}
if (!empty($regplus_custom)) {
foreach( $regplus_custom as $k=>$v ){
$id = $register_plus->Label_ID($v['label']);
if( $v['reg'] && $_POST[$id] ){
if( is_array( $_POST[$id] ) ) $_POST[$id] = implode(', ', $_POST[$id]);
update_usermeta( $user_id, $id, $wpdb->prepare($_POST[$id]));
}
}
}
#-- END REGPLUS --#
wp_set_password($plaintext_pass, $user_id);
$user_login = stripslashes($user->user_login);
$user_email = stripslashes($user->user_email);
#-- REGPLUS --#
if( !$regplus['custom_adminmsg'] && !$regplus['disable_admin'] ){
#-- END REGPLUS --#
$message = sprintf(__('New user Register on your blog %s:', 'regplus'), get_option('blogname')) . "\r\n\r\n";
$message .= sprintf(__('Username: %s', 'regplus'), $user_login) . "\r\n\r\n";
$message .= sprintf(__('E-mail: %s', 'regplus'), $user_email) . "\r\n";
@wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Register', 'regplus'), get_option('blogname')), $message);
#-- REGPLUS --#
}else if( !$regplus['disable_admin'] ){
if( $regplus['adminhtml'] ){
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
}
//$headers .= 'From: ' . $regplus['adminfrom'] . "\r\n" . 'Reply-To: ' . $regplus['adminfrom'] . "\r\n";
add_filter('wp_mail_from', array($register_plus, 'adminfrom'));
add_filter('wp_mail_from_name', array($register_plus, 'adminfromname'));
$subject = $regplus['adminsubject'];
$message = str_replace('%user_login%', $user_login, $regplus['adminmsg']);
$message = str_replace('%user_email%', $user_email, $message);
$message = str_replace('%blogname%', get_option('blogname'), $message);
$message = str_replace('%user_ip%', $_SERVER['REMOTE_ADDR'], $message);
$message = str_replace('%user_host%', gethostbyaddr($_SERVER['REMOTE_ADDR']), $message);
$message = str_replace('%user_ref%', $_SERVER['HTTP_REFERER'], $message);
$message = str_replace('%user_agent%', $_SERVER['HTTP_USER_AGENT'], $message);
if( $regplus['firstname'] ) $message = str_replace('%firstname%', $_POST['firstname'], $message);
if( $regplus['lastname'] ) $message = str_replace('%lastname%', $_POST['lastname'], $message);
if( $regplus['website'] ) $message = str_replace('%website%', $_POST['website'], $message);
if( $regplus['aim'] ) $message = str_replace('%aim%', $_POST['aim'], $message);
if( $regplus['yahoo'] ) $message = str_replace('%yahoo%', $_POST['yahoo'], $message);
if( $regplus['jabber'] ) $message = str_replace('%jabber%', $_POST['jabber'], $message);
if( $regplus['about'] ) $message = str_replace('%about%', $_POST['about'], $message);
if( $regplus['code'] ) $message = str_replace('%invitecode%', $_POST['code'], $message);
if( !is_array( $regplus_custom ) ) $regplus_custom = array();
if (!empty($regplus_custom)) {
foreach( $regplus_custom as $k=>$v ){
$meta = $register_plus->Label_ID($v['label']);
$value = get_usermeta( $user_id, $meta );
$message = str_replace('%'.$meta.'%', $value, $message);
}
}
$siteurl = get_option('siteurl');
$message = str_replace('%siteurl%', $siteurl, $message);
if( $regplus['adminhtml'] && $regplus['admin_nl2br'] )
$message = nl2br($message);
wp_mail(get_option('admin_email'), $subject, $message, $headers);
}
#-- END REGPLUS --#
if ( empty($plaintext_pass) )
return;
#-- REGPLUS --#
if( !$regplus['custom_msg'] ){
#-- END REGPLUS --#
$message = sprintf(__('Username: %s', 'regplus'), $user_login) . "\r\n";
$message .= sprintf(__('Password: %s', 'regplus'), $plaintext_pass) . "\r\n";
//$message .= get_option('siteurl') . "/wp-login.php";
#-- REGPLUS --#
$message .= $prelink . get_option('siteurl') . "/wp-login.php" . $email_code . "\r\n";
$message .= $notice;
#-- END REGPLUS --#
wp_mail($user_email, sprintf(__('[%s] Your username and password', 'regplus'), get_option('blogname')), $message);
#-- REGPLUS --#
}else{
if( $regplus['html'] ){
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
}
//$headers .= 'From: ' . $regplus['from'] . "\r\n" . 'Reply-To: ' . $regplus['from'] . "\r\n";
add_filter('wp_mail_from', array($register_plus, 'userfrom'));
add_filter('wp_mail_from_name', array($register_plus, 'userfromname'));
$subject = $regplus['subject'];
$message = str_replace('%user_pass%', $plaintext_pass, $regplus['msg']);
$message = str_replace('%user_login%', $user_login, $message);
$message = str_replace('%user_email%', $user_email, $message);
$message = str_replace('%blogname%', get_option('blogname'), $message);
$message = str_replace('%user_ip%', $_SERVER['REMOTE_ADDR'], $message);
$message = str_replace('%user_host%', gethostbyaddr($_SERVER['REMOTE_ADDR']), $message);
$message = str_replace('%user_ref%', $_SERVER['HTTP_REFERER'], $message);
$message = str_replace('%user_agent%', $_SERVER['HTTP_USER_AGENT'], $message);
if( $regplus['firstname'] ) $message = str_replace('%firstname%', $_POST['firstname'], $message);
if( $regplus['lastname'] ) $message = str_replace('%lastname%', $_POST['lastname'], $message);
if( $regplus['website'] ) $message = str_replace('%website%', $_POST['website'], $message);
if( $regplus['aim'] ) $message = str_replace('%aim%', $_POST['aim'], $message);
if( $regplus['yahoo'] ) $message = str_replace('%yahoo%', $_POST['yahoo'], $message);
if( $regplus['jabber'] ) $message = str_replace('%jabber%', $_POST['jabber'], $message);
if( $regplus['about'] ) $message = str_replace('%about%', $_POST['about'], $message);
if( $regplus['code'] ) $message = str_replace('%invitecode%', $_POST['code'], $message);
if( !is_array( $regplus_custom ) ) $regplus_custom = array();
if (!empty($regplus_custom)) {
foreach( $regplus_custom as $k=>$v ){
$meta = $register_plus->Label_ID($v['label']);
$value = get_usermeta( $user_id, $meta );
$message = str_replace('%'.$meta.'%', $value, $message);
}
}
$redirect = 'redirect_to=' . $regplus['login_redirect'];
if( $regplus['email_verify'] )
$siteurl = get_option('siteurl') . "/wp-login.php" . $email_code . '&' . $redirect;
else
$siteurl = get_option('siteurl') . "/wp-login.php?" . $redirect;
$message = str_replace('%siteurl%', $siteurl, $message);
if( $regplus['html'] && $regplus['user_nl2br'] )
$message = nl2br($message);
wp_mail($user_email, $subject, $message, $headers);
}
if( $ref != $admin && ( $regplus['email_verify'] || $regplus['admin_verify'] ) )
$temp_user = $wpdb->query( "UPDATE $wpdb->users SET user_login = '$temp_id' WHERE ID = '$user_id'" );
#-- END REGPLUS --#
}
endif;
?>