Plugin Directory

Changeset 3018102


Ignore:
Timestamp:
01/06/2024 02:46:54 PM (2 years ago)
Author:
avi.megladon
Message:

Bug fixes and improvements

Location:
wp-register-profile-with-shortcode
Files:
77 added
10 edited

Legend:

Unmodified
Added
Removed
  • wp-register-profile-with-shortcode/trunk/includes/class-edit-profile.php

    r2393730 r3018102  
    11<?php
    22
    3 class Register_Profile_Edit{
     3class Register_Profile_Edit
     4{
    45
    5      public function __construct() {
    6         add_action( 'init', array($this, 'edit_profile_validate' ) );
    7      }
    8          
    9      public function is_field_enabled($value){
    10         $data = get_option( $value );
    11         if($data == 'Yes'){
    12             return true;
    13         } else {
    14             return false;
    15         }
    16     }
    17    
    18     public function is_field_required($value){
    19         $data = get_option( $value );
    20         if($data == 'Yes'){
    21             return 'required="required"';
    22         } else {
    23             return '';
    24         }
    25     }
    26    
    27    
    28     public function edit_profile_validate(){
    29        
    30         if(isset($_POST['option']) and sanitize_text_field($_POST['option']) == "wprp_user_edit_profile"){
    31             start_session_if_not_started();
    32             global $post;
    33             $error = false;
    34            
    35             if(!is_user_logged_in()){
    36                 $msg = __('Login to update profile!','wp-register-profile-with-shortcode');
    37                 $error = true;
    38             }
    39            
    40             /*if( email_exists( sanitize_text_field($_POST['user_email']) )) {
    41                 $msg = __('Email already exists. Please use a different one!','wp-register-profile-with-shortcode');
    42                 $error = true;
    43             }*/
    44            
    45             $userdata = array();
    46            
    47             if( $this->is_field_enabled('firstname_in_profile') ){
    48                 if( $this->is_field_enabled('is_firstname_required') and sanitize_text_field($_POST['first_name']) == '' ){
    49                     $msg .= __('Please enter first name','wp-register-profile-with-shortcode');
    50                     $msg .= '</br>';
    51                     $error = true;
    52                 } else {
    53                     $userdata['first_name'] = sanitize_text_field($_POST['first_name']);
    54                 }
    55             }
    56            
    57             if($this->is_field_enabled('lastname_in_profile')){
    58                 if( $this->is_field_enabled('is_lastname_required') and sanitize_text_field($_POST['last_name']) == '' ){
    59                     $msg .= __('Please enter last name','wp-register-profile-with-shortcode');
    60                     $msg .= '</br>';
    61                     $error = true;
    62                 } else {
    63                     $userdata['last_name'] = sanitize_text_field($_POST['last_name']);
    64                 }
    65             }
    66            
    67             if($this->is_field_enabled('displayname_in_profile')){
    68                 if( $this->is_field_enabled('is_displayname_required') and sanitize_text_field($_POST['display_name']) == '' ){
    69                     $msg .= __('Please enter display name','wp-register-profile-with-shortcode');
    70                     $msg .= '</br>';
    71                     $error = true;
    72                 } else {
    73                     $userdata['display_name'] = sanitize_text_field($_POST['display_name']);
    74                 }
    75             }
    76            
    77             if($this->is_field_enabled('userdescription_in_profile')){
    78                 if( $this->is_field_enabled('is_userdescription_required') and sanitize_text_field($_POST['description']) == '' ){
    79                     $msg .= __('Please enter description','wp-register-profile-with-shortcode');
    80                     $msg .= '</br>';
    81                     $error = true;
    82                 } else {
    83                     $userdata['description'] = sanitize_text_field($_POST['description']);
    84                 }
    85             }
    86            
    87             if($this->is_field_enabled('userurl_in_profile')){
    88                 if( $this->is_field_enabled('is_userurl_required') and sanitize_text_field($_POST['user_url']) == '' ){
    89                     $msg .= __('Please enter description','wp-register-profile-with-shortcode');
    90                     $msg .= '</br>';
    91                     $error = true;
    92                 } else {
    93                     $userdata['user_url'] = sanitize_text_field($_POST['user_url']);
    94                 }
    95             }
    96            
    97             if(!$error){
    98                 $user_id = get_current_user_id();
    99                 $userdata['ID'] = $user_id;
    100                 $userdata['user_email'] = sanitize_text_field($_POST['user_email']);
    101                
    102                 // update user profile in db //
    103                     $user_id = wp_update_user( $userdata );
    104                 // update user profile in db //
    105                
    106                 // check for any errors //
    107                 if ( is_wp_error( $user_id ) ) {
    108                     $msg = $user_id->get_error_message();
    109                     $_SESSION['reg_error_msg'] = $msg;
    110                     $_SESSION['reg_msg_class'] = 'reg_error';
    111                     if(!empty($_POST['redirect'])){
    112                         $redirect =  sanitize_text_field($_POST['redirect']);
    113                         wp_redirect($redirect);
    114                         exit;
    115                     } else {
    116                         wp_redirect(get_permalink());
    117                         exit;
    118                     }
    119                 }
    120                 // check for any errors //
    121                
    122                 $_SESSION['reg_error_msg'] = __('Profile data updated successfully.','wp-register-profile-with-shortcode');
    123                 $_SESSION['reg_msg_class'] = 'reg_success';
    124                
    125             } else {
    126                 $_SESSION['reg_error_msg'] = $msg;
    127                 $_SESSION['reg_msg_class'] = 'reg_error';
    128             }
    129            
    130             if(!empty($_POST['redirect'])){
    131                 $redirect =  sanitize_text_field($_POST['redirect']);
    132                 wp_redirect($redirect);
    133                 exit;
    134             }
    135         }
    136        
    137      }
    138      
    139     public function profile_edit(){
    140         global $post;
    141         if(is_user_logged_in()){
    142             $current_user = wp_get_current_user();
    143             $user_id = get_current_user_id();
    144             echo '<div id="reg_forms" class="reg_forms">';
    145             $this->load_script();
    146             do_action('wprp_before_profile_form_start');
    147             $this->error_message();
    148             include( WPRPWS_DIR_PATH . '/view/frontend/profile-edit.php');
    149             do_action('wprp_after_profile_form_end');
    150             echo '</div>';
    151         }
    152     }
    153    
    154     public function load_script(){?>
     6    public function __construct()
     7    {
     8        add_action('init', array($this, 'edit_profile_validate'));
     9    }
     10
     11    public function is_field_enabled($value)
     12    {
     13        $data = get_option($value);
     14        if ($data == 'Yes') {
     15            return true;
     16        } else {
     17            return false;
     18        }
     19    }
     20
     21    public function is_field_required($value)
     22    {
     23        $data = get_option($value);
     24        if ($data == 'Yes') {
     25            return 'required="required"';
     26        } else {
     27            return '';
     28        }
     29    }
     30
     31    public function edit_profile_validate()
     32    {
     33
     34        if (isset($_POST['option']) and sanitize_text_field($_POST['option']) == "wprp_user_edit_profile") {
     35
     36            if (!wp_verify_nonce($_POST['wprp_5q5rt78'], 'wprp_action')) {
     37                wp_die('Error');
     38            }
     39
     40            start_session_if_not_started();
     41            global $post;
     42            $error = false;
     43
     44            if (!is_user_logged_in()) {
     45                $msg = __('Login to update profile!', 'wp-register-profile-with-shortcode');
     46                $error = true;
     47            }
     48
     49            /*if( email_exists( sanitize_text_field($_POST['user_email']) )) {
     50            $msg = __('Email already exists. Please use a different one!','wp-register-profile-with-shortcode');
     51            $error = true;
     52            }*/
     53
     54            $userdata = array();
     55
     56            if ($this->is_field_enabled('firstname_in_profile')) {
     57                if ($this->is_field_enabled('is_firstname_required') and sanitize_text_field($_POST['first_name']) == '') {
     58                    $msg .= __('Please enter first name', 'wp-register-profile-with-shortcode');
     59                    $msg .= '</br>';
     60                    $error = true;
     61                } else {
     62                    $userdata['first_name'] = sanitize_text_field($_POST['first_name']);
     63                }
     64            }
     65
     66            if ($this->is_field_enabled('lastname_in_profile')) {
     67                if ($this->is_field_enabled('is_lastname_required') and sanitize_text_field($_POST['last_name']) == '') {
     68                    $msg .= __('Please enter last name', 'wp-register-profile-with-shortcode');
     69                    $msg .= '</br>';
     70                    $error = true;
     71                } else {
     72                    $userdata['last_name'] = sanitize_text_field($_POST['last_name']);
     73                }
     74            }
     75
     76            if ($this->is_field_enabled('displayname_in_profile')) {
     77                if ($this->is_field_enabled('is_displayname_required') and sanitize_text_field($_POST['display_name']) == '') {
     78                    $msg .= __('Please enter display name', 'wp-register-profile-with-shortcode');
     79                    $msg .= '</br>';
     80                    $error = true;
     81                } else {
     82                    $userdata['display_name'] = sanitize_text_field($_POST['display_name']);
     83                }
     84            }
     85
     86            if ($this->is_field_enabled('userdescription_in_profile')) {
     87                if ($this->is_field_enabled('is_userdescription_required') and sanitize_text_field($_POST['description']) == '') {
     88                    $msg .= __('Please enter description', 'wp-register-profile-with-shortcode');
     89                    $msg .= '</br>';
     90                    $error = true;
     91                } else {
     92                    $userdata['description'] = sanitize_text_field($_POST['description']);
     93                }
     94            }
     95
     96            if ($this->is_field_enabled('userurl_in_profile')) {
     97                if ($this->is_field_enabled('is_userurl_required') and sanitize_text_field($_POST['user_url']) == '') {
     98                    $msg .= __('Please enter description', 'wp-register-profile-with-shortcode');
     99                    $msg .= '</br>';
     100                    $error = true;
     101                } else {
     102                    $userdata['user_url'] = sanitize_text_field($_POST['user_url']);
     103                }
     104            }
     105
     106            if (!$error) {
     107                $user_id = get_current_user_id();
     108                $userdata['ID'] = $user_id;
     109                $userdata['user_email'] = sanitize_text_field($_POST['user_email']);
     110
     111                // update user profile in db //
     112                $user_id = wp_update_user($userdata);
     113                // update user profile in db //
     114
     115                // check for any errors //
     116                if (is_wp_error($user_id)) {
     117                    $msg = $user_id->get_error_message();
     118                    $_SESSION['reg_error_msg'] = $msg;
     119                    $_SESSION['reg_msg_class'] = 'reg_error';
     120                    if (!empty($_POST['redirect'])) {
     121                        $redirect = sanitize_text_field($_POST['redirect']);
     122                        wp_redirect($redirect);
     123                        exit;
     124                    } else {
     125                        wp_redirect(get_permalink());
     126                        exit;
     127                    }
     128                }
     129                // check for any errors //
     130
     131                $_SESSION['reg_error_msg'] = __('Profile data updated successfully.', 'wp-register-profile-with-shortcode');
     132                $_SESSION['reg_msg_class'] = 'reg_success';
     133
     134            } else {
     135                $_SESSION['reg_error_msg'] = $msg;
     136                $_SESSION['reg_msg_class'] = 'reg_error';
     137            }
     138
     139            if (!empty($_POST['redirect'])) {
     140                $redirect = sanitize_text_field($_POST['redirect']);
     141                wp_redirect($redirect);
     142                exit;
     143            }
     144        }
     145
     146    }
     147
     148    public function profile_edit()
     149    {
     150        global $post;
     151        if (is_user_logged_in()) {
     152            $current_user = wp_get_current_user();
     153            $user_id = get_current_user_id();
     154            echo '<div id="reg_forms" class="reg_forms">';
     155            $this->load_script();
     156            do_action('wprp_before_profile_form_start');
     157            $this->error_message();
     158            include WPRPWS_DIR_PATH . '/view/frontend/profile-edit.php';
     159            do_action('wprp_after_profile_form_end');
     160            echo '</div>';
     161        }
     162    }
     163
     164    public function load_script()
     165    {?>
    155166        <script type="text/javascript">
    156167            jQuery(document).ready(function () {
     
    159170        </script>
    160171    <?php }
    161    
    162     public function error_message(){       
    163         start_session_if_not_started();
    164         if(isset($_SESSION['reg_error_msg']) and $_SESSION['reg_error_msg']){
    165             echo '<div class="'.$_SESSION['reg_msg_class'].'">'.$_SESSION['reg_error_msg'].'</div>';
    166             unset($_SESSION['reg_error_msg']);
    167             unset($_SESSION['reg_msg_class']);
    168         }
    169     }
    170        
     172
     173    public function error_message()
     174    {
     175        start_session_if_not_started();
     176        if (isset($_SESSION['reg_error_msg']) and $_SESSION['reg_error_msg']) {
     177            echo '<div class="' . $_SESSION['reg_msg_class'] . '">' . $_SESSION['reg_error_msg'] . '</div>';
     178            unset($_SESSION['reg_error_msg']);
     179            unset($_SESSION['reg_msg_class']);
     180        }
     181    }
     182
    171183}
  • wp-register-profile-with-shortcode/trunk/includes/class-password-update.php

    r2379514 r3018102  
    11<?php
    22
    3 class Register_Update_Password{
     3class Register_Update_Password
     4{
    45
    5      public function __construct() {
    6         add_action( 'init', array($this, 'update_password_validate' ) );
    7      }
    8          
     6    public function __construct()
     7    {
     8        add_action('init', array($this, 'update_password_validate'));
     9    }
    910
    10      public function update_password_validate(){
    11         if(isset($_POST['option']) and sanitize_text_field($_POST['option']) == "rpws_user_update_password"){
    12             start_session_if_not_started();
    13             global $post;
    14             $error = false;
    15            
    16             if(!is_user_logged_in()){
    17                 $msg = __('Login to update profile!','wp-register-profile-with-shortcode');
    18                 $error = true;
    19             }
    20            
    21             if($_POST['user_new_password'] == ''){
    22                 $msg = __('Password can\'t be empty.','wp-register-profile-with-shortcode');
    23                 $error = true;
    24             }
    25            
    26             if(isset($_POST['user_new_password']) and ( $_POST['user_new_password'] != $_POST['user_retype_password'])){
    27                 $msg = __('Your new password don\'t match with retype password!','wp-register-profile-with-shortcode');
    28                 $error = true;
    29             }
    30                        
    31             if(!$error){
    32                 $user_id = get_current_user_id();
    33                 wp_set_password( $_POST['user_new_password'], $user_id );
    34                
    35                 $_SESSION['reg_error_msg'] = __('Your password updated successfully. Please login again.','wp-register-profile-with-shortcode');
    36                 $_SESSION['reg_msg_class'] = 'reg_success';
    37                
    38             } else {
    39                 $_SESSION['reg_error_msg'] = $msg;
    40                 $_SESSION['reg_msg_class'] = 'reg_error';
    41             }
    42            
    43             if(!empty($_POST['redirect'])){
    44                 $redirect =  sanitize_text_field($_POST['redirect']);
    45                 wp_redirect($redirect);
    46                 exit;
    47             }
    48         }
    49      }
    50    
    51    
    52     public function load_script(){?>
     11    public function update_password_validate()
     12    {
     13        if (isset($_POST['option']) and sanitize_text_field($_POST['option']) == "rpws_user_update_password") {
     14
     15            if (!wp_verify_nonce($_POST['wprp_5q5rt78'], 'wprp_action')) {
     16                wp_die('Error');
     17            }
     18
     19            start_session_if_not_started();
     20            global $post;
     21            $error = false;
     22
     23            if (!is_user_logged_in()) {
     24                $msg = __('Login to update profile!', 'wp-register-profile-with-shortcode');
     25                $error = true;
     26            }
     27
     28            if ($_POST['user_new_password'] == '') {
     29                $msg = __('Password can\'t be empty.', 'wp-register-profile-with-shortcode');
     30                $error = true;
     31            }
     32
     33            if (isset($_POST['user_new_password']) and ($_POST['user_new_password'] != $_POST['user_retype_password'])) {
     34                $msg = __('Your new password don\'t match with retype password!', 'wp-register-profile-with-shortcode');
     35                $error = true;
     36            }
     37
     38            if (!$error) {
     39                $user_id = get_current_user_id();
     40                wp_set_password($_POST['user_new_password'], $user_id);
     41
     42                $_SESSION['reg_error_msg'] = __('Your password updated successfully. Please login again.', 'wp-register-profile-with-shortcode');
     43                $_SESSION['reg_msg_class'] = 'reg_success';
     44
     45            } else {
     46                $_SESSION['reg_error_msg'] = $msg;
     47                $_SESSION['reg_msg_class'] = 'reg_error';
     48            }
     49
     50            if (!empty($_POST['redirect'])) {
     51                $redirect = sanitize_text_field($_POST['redirect']);
     52                wp_redirect($redirect);
     53                exit;
     54            }
     55        }
     56    }
     57
     58    public function load_script()
     59    {?>
    5360        <script type="text/javascript">
    5461            jQuery(document).ready(function () {
     
    5764        </script>
    5865    <?php }
    59      
    60     public function update_password_form(){
    61         global $post;
    62         if(is_user_logged_in()){
    63             echo '<div id="reg_forms" class="reg_forms">';
    64             $this->load_script();
    65             do_action('wprp_before_update_pass_form_start');
    66             $this->error_message();
    67             include( WPRPWS_DIR_PATH . '/view/frontend/update-password.php');
    68             do_action('wprp_after_update_pass_form_end');
    69             echo '</div>';
    70         }
    71     }
    72    
    73     public function error_message(){
    74         start_session_if_not_started();
    75         if(isset($_SESSION['reg_error_msg']) and $_SESSION['reg_error_msg']){
    76             echo '<div class="'.$_SESSION['reg_msg_class'].'">'.$_SESSION['reg_error_msg'].'</div>';
    77             unset($_SESSION['reg_error_msg']);
    78             unset($_SESSION['reg_msg_class']);
    79         }
    80     }
    81        
     66
     67    public function update_password_form()
     68    {
     69        global $post;
     70        if (is_user_logged_in()) {
     71            echo '<div id="reg_forms" class="reg_forms">';
     72            $this->load_script();
     73            do_action('wprp_before_update_pass_form_start');
     74            $this->error_message();
     75            include WPRPWS_DIR_PATH . '/view/frontend/update-password.php';
     76            do_action('wprp_after_update_pass_form_end');
     77            echo '</div>';
     78        }
     79    }
     80
     81    public function error_message()
     82    {
     83        start_session_if_not_started();
     84        if (isset($_SESSION['reg_error_msg']) and $_SESSION['reg_error_msg']) {
     85            echo '<div class="' . $_SESSION['reg_msg_class'] . '">' . $_SESSION['reg_error_msg'] . '</div>';
     86            unset($_SESSION['reg_error_msg']);
     87            unset($_SESSION['reg_msg_class']);
     88        }
     89    }
     90
    8291}
  • wp-register-profile-with-shortcode/trunk/includes/class-register-process.php

    r2393730 r3018102  
    11<?php
    22
    3 class Register_Process {
    4 
    5     public function __construct() {
    6         add_action( 'init', array($this, 'register_validate' ) );
    7     }
    8    
    9     public function is_field_enabled($value){
    10         $data = get_option( $value );
    11         if($data === 'Yes'){
    12             return true;
    13         } else {
    14             return false;
    15         }
    16     }
    17    
    18     public function is_field_required($value){
    19         $data = get_option( $value );
    20         if($data === 'Yes'){
    21             return 'required="required"';
    22         } else {
    23             return '';
    24         }
    25     }
    26    
    27     public static function curPageURL() {
    28     $pageURL = 'http';
    29     if (isset($_SERVER["HTTPS"]) and $_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
    30     $pageURL .= "://";
    31         if (isset($_SERVER["SERVER_PORT"]) and $_SERVER["SERVER_PORT"] != "80") {
    32             $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
    33         } else {
    34             $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
    35         }
    36     return $pageURL;
    37     }
    38    
    39     public function create_user( $data = array() ){
    40         start_session_if_not_started();
    41         global $wprw_mail_to_user_subject,$wprw_mail_to_admin_subject;
    42         $wprw_admin_email = get_option( 'wprw_admin_email' );
    43         $wprw_from_email = get_option( 'wprw_from_email' );
    44         $wprw_success_msg = Register_Settings::removeslashes(get_option( 'wprw_success_msg' ));
    45        
    46         if(empty($wprw_success_msg)){
    47             $success_msg = __(Register_Settings::$wprw_success_msg,'wp-register-profile-with-shortcode');
    48         } else {
    49             $success_msg = $wprw_success_msg;
    50         }
    51        
    52         if($wprw_from_email == ''){
    53             $wprw_from_email = 'no-reply@wordpress.com';
    54         }
    55        
    56         $userdata = $data['userdata'];
    57        
    58         // insert new user in db //
    59             $user_id = wp_insert_user( $userdata );
    60         // insert new user in db //
    61        
    62         // after insert action //
    63             do_action( 'wprp_after_insert_user', $user_id );
    64         // after insert action //
    65        
    66         // subscription action //
    67             do_action( 'cfws_subscription', $user_id, $data );
    68         // subscription action //
    69        
    70         $headers[] = 'From: <'.$wprw_from_email.'>';
    71        
    72         // send mail to user //
    73         $subject = Register_Settings::removeslashes(get_option('new_user_register_mail_subject'));
    74         $body = $this->new_user_data_to_user_mail( $userdata );
    75         $body = html_entity_decode($body);
    76        
    77         $to_array = array($userdata['user_email']);
    78         add_filter( 'wp_mail_content_type', 'wprw_set_html_content_type' );
    79         wp_mail( $to_array, $subject, $body, $headers );
    80         remove_filter( 'wp_mail_content_type', 'wprw_set_html_content_type' );
    81         // send mail to user //
    82        
    83         // send mail to admin //
    84         if(!empty($wprw_admin_email)){
    85             $subject1 = __($wprw_mail_to_admin_subject,'wp-register-profile-with-shortcode');
    86             $body1 = $this->new_user_data_to_admin_mail( $userdata );
    87             $body1 = html_entity_decode($body1);
    88             add_filter( 'wp_mail_content_type', 'wprw_set_html_content_type' );
    89             wp_mail( $wprw_admin_email, $subject1, $body1, $headers );
    90             remove_filter( 'wp_mail_content_type', 'wprw_set_html_content_type' );
    91         }
    92         // send mail to admin //
    93        
    94         if( !$this->is_field_enabled('force_login_after_registration') and $user_id ){
    95             $_SESSION['reg_error_msg'] = $success_msg;
    96             $_SESSION['reg_msg_class'] = 'reg_success';
    97         }
    98        
    99         unset($_SESSION['wp_register_temp_data']);
    100         return $user_id;
    101     }
    102    
    103     public function new_user_data_to_user_mail( $userdata = array() ){
    104         $wprw_mail_to_user_body = Register_Settings::removeslashes(get_option('new_user_register_mail_body'));
    105        
    106         $wprw_mail_to_user_body = str_replace(array("#site_name#","#user_name#","#user_password#","#site_url#"), array( get_bloginfo('name'), $userdata['user_login'], $userdata['user_pass'], site_url() ), $wprw_mail_to_user_body);
    107         return $wprw_mail_to_user_body;
    108     }
    109    
    110     public function new_user_data_to_admin_mail( $userdata = array() ){
    111         global $wprw_mail_to_admin_body;
    112         $data = '';
    113        
    114         if(!empty($userdata['user_login'])){
    115             $data .= '<strong>'.__( 'User Name', 'wp-register-profile-with-shortcode' ).':</strong> '.$userdata['user_login'];
    116             $data .= '<br>';
    117         }
    118         if(!empty($userdata['user_email'])){
    119             $data .= '<strong>'.__( 'User Email', 'wp-register-profile-with-shortcode' ).':</strong> '.$userdata['user_email'];
    120             $data .= '<br>';
    121         }
    122         if(!empty($userdata['first_name'])){
    123             $data .= '<strong>'.__( 'First Name', 'wp-register-profile-with-shortcode' ).':</strong> '.$userdata['first_name'];
    124             $data .= '<br>';
    125         }
    126         if(!empty($userdata['last_name'])){
    127             $data .= '<strong>'.__( 'Last Name', 'wp-register-profile-with-shortcode' ).':</strong> '.$userdata['last_name'];
    128             $data .= '<br>';
    129         }
    130         if(!empty($userdata['display_name'])){
    131             $data .= '<strong>'.__( 'Display Name', 'wp-register-profile-with-shortcode' ).':</strong> '.$userdata['display_name'];
    132             $data .= '<br>';
    133         }
    134         if(!empty($userdata['description'])){
    135             $data .= '<strong>'.__( 'About User', 'wp-register-profile-with-shortcode' ).':</strong> '.$userdata['description'];
    136             $data .= '<br>';
    137         }
    138         if(!empty($userdata['user_url'])){
    139             $data .= '<strong>'.__( 'User URL', 'wp-register-profile-with-shortcode' ).':</strong> '.$userdata['user_url'];
    140             $data .= '<br>';
    141         }
    142        
    143         $wprw_mail_to_admin_body = str_replace( array("#site_name#", "#new_user_data#", '#user_name#'), array(get_bloginfo('name'), $data, $userdata['user_login']), $wprw_mail_to_admin_body);
    144        
    145         return $wprw_mail_to_admin_body;
    146     }
    147    
    148     public function register_validate(){
    149         if(isset($_POST['option']) and sanitize_text_field($_POST['option']) == "wprp_user_register"){
    150             start_session_if_not_started();
    151             global $post;
    152             $error = false;
    153             $comp_errors = array();
    154             $msg = '';
    155             $_SESSION['wp_register_temp_data'] = $_POST;
    156            
    157             // validation compatibility filter //
    158             $default_registration_form_hooks = get_option('default_registration_form_hooks');
    159             if($default_registration_form_hooks == 'Yes'){
    160                 $comp_validation = apply_filters( 'registration_errors', $comp_errors, sanitize_text_field(@$_POST['user_login']), sanitize_text_field(@$_POST['user_email']) );
    161                 if ( is_wp_error( $comp_validation ) ) {
    162                     $msg .= __($comp_validation->get_error_message(),'wp-register-profile-with-shortcode');
    163                     $msg .= '</br>';
    164                     $error = true;
    165                 }
    166             }
    167             // validation compatibility filter //
    168            
    169             if($this->is_field_enabled('captcha_in_registration')){
    170                 if ( sanitize_text_field($_POST['user_captcha']) != $_SESSION['wprp_captcha_code'] ){
    171                     $msg .= __('Security code do not match!','wp-register-profile-with-shortcode');
    172                     $msg .= '</br>';
    173                     $error = true;
    174                 }
    175             }
    176            
    177             if(!$this->is_field_enabled('username_in_registration') and empty($_POST['user_login'])){
    178                 $_POST['user_login'] = sanitize_text_field($_POST['user_email']);
    179             }
    180            
    181             if ( username_exists( sanitize_text_field($_POST['user_login']) ) ){
    182                 $msg .= __('Username already exists. Please use a different one!','wp-register-profile-with-shortcode');
    183                 $msg .= '</br>';
    184                 $error = true;
    185             }
    186            
    187             if( email_exists( sanitize_text_field($_POST['user_email']) )) {
    188                 $msg .= __('Email already exists. Please use a different one!','wp-register-profile-with-shortcode');
    189                 $msg .= '</br>';
    190                 $error = true;
    191             }
    192            
    193             if($this->is_field_enabled('password_in_registration')){
    194                 if($_POST['new_user_password'] != $_POST['re_user_password']){
    195                     $msg .= __('Password and Retype password do not match!','wp-register-profile-with-shortcode');
    196                     $msg .= '</br>';
    197                     $error = true;
    198                 }
    199             }
    200            
    201             $userdata = array();
    202            
    203             if($this->is_field_enabled('firstname_in_registration')){
    204                 if( $this->is_field_enabled('is_firstname_required') and sanitize_text_field($_POST['first_name']) == '' ){
    205                     $msg .= __('Please enter first name','wp-register-profile-with-shortcode');
    206                     $msg .= '</br>';
    207                     $error = true;
    208                 } else {
    209                     $userdata['first_name'] = sanitize_text_field($_POST['first_name']);
    210                 }
    211             }
    212            
    213             if($this->is_field_enabled('lastname_in_registration')){
    214                 if( $this->is_field_enabled('is_lastname_required') and sanitize_text_field($_POST['last_name']) == '' ){
    215                     $msg .= __('Please enter last name','wp-register-profile-with-shortcode');
    216                     $msg .= '</br>';
    217                     $error = true;
    218                 } else {
    219                     $userdata['last_name'] = sanitize_text_field($_POST['last_name']);
    220                 }
    221             }
    222            
    223             if($this->is_field_enabled('displayname_in_registration')){
    224                 if( $this->is_field_enabled('is_displayname_required') and sanitize_text_field($_POST['display_name']) == '' ){
    225                     $msg .= __('Please enter display name','wp-register-profile-with-shortcode');
    226                     $msg .= '</br>';
    227                     $error = true;
    228                 } else {
    229                     $userdata['display_name'] = sanitize_text_field($_POST['display_name']);
    230                 }
    231             }
    232            
    233             if($this->is_field_enabled('userdescription_in_registration')){
    234                 if( $this->is_field_enabled('is_userdescription_required') and sanitize_text_field($_POST['description']) == '' ){
    235                     $msg .= __('Please enter description','wp-register-profile-with-shortcode');
    236                     $msg .= '</br>';
    237                     $error = true;
    238                 } else {
    239                     $userdata['description'] = sanitize_text_field($_POST['description']);
    240                 }
    241             }
    242            
    243             if($this->is_field_enabled('userurl_in_registration')){
    244                 if( $this->is_field_enabled('is_userurl_required') and sanitize_text_field($_POST['user_url']) == '' ){
    245                     $msg .= __('Please enter description','wp-register-profile-with-shortcode');
    246                     $msg .= '</br>';
    247                     $error = true;
    248                 } else {
    249                     $userdata['user_url'] = sanitize_text_field($_POST['user_url']);
    250                 }
    251             }
    252            
    253             if(!$error){
    254                 $userdata['user_login'] = sanitize_text_field($_POST['user_login']);
    255                 $userdata['user_email'] = sanitize_text_field($_POST['user_email']);
    256                
    257                 if($this->is_field_enabled('password_in_registration') and $_POST['new_user_password'] != ''){
    258                     $new_pass = $_POST['new_user_password'];
    259                     $userdata['user_pass'] = $new_pass;
    260                 } else {
    261                     $new_pass = wp_generate_password();
    262                     $userdata['user_pass'] = $new_pass;
    263                 }
    264                
    265                 $enable_cfws_newsletter_subscription = get_option( 'enable_cfws_newsletter_subscription' );
    266                 if($enable_cfws_newsletter_subscription == 'Yes'){
    267                     $userdata['cf_subscribe_newsletter'] = sanitize_text_field($_POST['cf_subscribe_newsletter']);
    268                 }
    269                
    270                 if(get_option('enable_subscription') == 'Yes'){
    271                     $_SESSION['wp_register_subscription']['userdata'] = $userdata;
    272                     $_SESSION['wp_register_subscription']['sub_type'] = sanitize_text_field($_REQUEST['sub_type']);
    273                     $redirect_page = get_permalink(get_option('subscription_page'));
    274                     wp_redirect($redirect_page);
    275                     exit;
    276                 } else {
    277                     $create_user_data['userdata'] = $userdata;
    278                     $user_id = $this->create_user($create_user_data);
    279                    
    280                     if( $this->is_field_enabled('force_login_after_registration') and $user_id ){
    281                         $nuser = get_user_by( 'id', $user_id );
    282                         if( $nuser ) {
    283                             wp_set_current_user( $user_id, $nuser->user_login );
    284                             wp_set_auth_cookie( $user_id );
    285                             do_action( 'wp_login', $nuser->user_login, $nuser );
    286                         }
    287                     }
    288                    
    289                     $redirect_page = get_option('thank_you_page_after_registration_url');
    290                     if($redirect_page){
    291                         $redirect =  get_permalink($redirect_page);
    292                     } else {
    293                         $redirect =  sanitize_text_field($_REQUEST['redirect']);
    294                     }
    295                    
    296                     wp_redirect($redirect);
    297                     exit;
    298                 }
    299             } else {
    300                 $_SESSION['reg_error_msg'] = $msg;
    301                 $_SESSION['reg_msg_class'] = 'reg_error';
    302             }
    303         }
    304     }
     3class Register_Process
     4{
     5
     6    public function __construct()
     7    {
     8        add_action('init', array($this, 'register_validate'));
     9    }
     10
     11    public function is_field_enabled($value)
     12    {
     13        $data = get_option($value);
     14        if ($data === 'Yes') {
     15            return true;
     16        } else {
     17            return false;
     18        }
     19    }
     20
     21    public function is_field_required($value)
     22    {
     23        $data = get_option($value);
     24        if ($data === 'Yes') {
     25            return 'required="required"';
     26        } else {
     27            return '';
     28        }
     29    }
     30
     31    public static function curPageURL()
     32    {
     33        $pageURL = 'http';
     34        if (isset($_SERVER["HTTPS"]) and $_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
     35        $pageURL .= "://";
     36        if (isset($_SERVER["SERVER_PORT"]) and $_SERVER["SERVER_PORT"] != "80") {
     37            $pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
     38        } else {
     39            $pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
     40        }
     41        return $pageURL;
     42    }
     43
     44    public function create_user($data = array())
     45    {
     46        start_session_if_not_started();
     47        global $wprw_mail_to_user_subject, $wprw_mail_to_admin_subject;
     48        $wprw_admin_email = get_option('wprw_admin_email');
     49        $wprw_from_email = get_option('wprw_from_email');
     50        $wprw_success_msg = Register_Settings::removeslashes(get_option('wprw_success_msg'));
     51
     52        if (empty($wprw_success_msg)) {
     53            $success_msg = __(Register_Settings::$wprw_success_msg, 'wp-register-profile-with-shortcode');
     54        } else {
     55            $success_msg = $wprw_success_msg;
     56        }
     57
     58        if ($wprw_from_email == '') {
     59            $wprw_from_email = 'no-reply@wordpress.com';
     60        }
     61
     62        $userdata = $data['userdata'];
     63
     64        // insert new user in db //
     65        $user_id = wp_insert_user($userdata);
     66        // insert new user in db //
     67
     68        // after insert action //
     69        do_action('wprp_after_insert_user', $user_id);
     70        // after insert action //
     71
     72        // subscription action //
     73        do_action('cfws_subscription', $user_id, $data);
     74        // subscription action //
     75
     76        $headers[] = 'From: <' . $wprw_from_email . '>';
     77
     78        // send mail to user //
     79        $subject = Register_Settings::removeslashes(get_option('new_user_register_mail_subject'));
     80        $body = $this->new_user_data_to_user_mail($userdata);
     81        $body = html_entity_decode($body);
     82
     83        $to_array = array($userdata['user_email']);
     84        add_filter('wp_mail_content_type', 'wprw_set_html_content_type');
     85        wp_mail($to_array, $subject, $body, $headers);
     86        remove_filter('wp_mail_content_type', 'wprw_set_html_content_type');
     87        // send mail to user //
     88
     89        // send mail to admin //
     90        if (!empty($wprw_admin_email)) {
     91            $subject1 = __($wprw_mail_to_admin_subject, 'wp-register-profile-with-shortcode');
     92            $body1 = $this->new_user_data_to_admin_mail($userdata);
     93            $body1 = html_entity_decode($body1);
     94            add_filter('wp_mail_content_type', 'wprw_set_html_content_type');
     95            wp_mail($wprw_admin_email, $subject1, $body1, $headers);
     96            remove_filter('wp_mail_content_type', 'wprw_set_html_content_type');
     97        }
     98        // send mail to admin //
     99
     100        if (!$this->is_field_enabled('force_login_after_registration') and $user_id) {
     101            $_SESSION['reg_error_msg'] = $success_msg;
     102            $_SESSION['reg_msg_class'] = 'reg_success';
     103        }
     104
     105        unset($_SESSION['wp_register_temp_data']);
     106        return $user_id;
     107    }
     108
     109    public function new_user_data_to_user_mail($userdata = array())
     110    {
     111        $wprw_mail_to_user_body = Register_Settings::removeslashes(get_option('new_user_register_mail_body'));
     112
     113        $wprw_mail_to_user_body = str_replace(array("#site_name#", "#user_name#", "#user_password#", "#site_url#"), array(get_bloginfo('name'), $userdata['user_login'], $userdata['user_pass'], site_url()), $wprw_mail_to_user_body);
     114        return $wprw_mail_to_user_body;
     115    }
     116
     117    public function new_user_data_to_admin_mail($userdata = array())
     118    {
     119        global $wprw_mail_to_admin_body;
     120        $data = '';
     121
     122        if (!empty($userdata['user_login'])) {
     123            $data .= '<strong>' . __('User Name', 'wp-register-profile-with-shortcode') . ':</strong> ' . $userdata['user_login'];
     124            $data .= '<br>';
     125        }
     126        if (!empty($userdata['user_email'])) {
     127            $data .= '<strong>' . __('User Email', 'wp-register-profile-with-shortcode') . ':</strong> ' . $userdata['user_email'];
     128            $data .= '<br>';
     129        }
     130        if (!empty($userdata['first_name'])) {
     131            $data .= '<strong>' . __('First Name', 'wp-register-profile-with-shortcode') . ':</strong> ' . $userdata['first_name'];
     132            $data .= '<br>';
     133        }
     134        if (!empty($userdata['last_name'])) {
     135            $data .= '<strong>' . __('Last Name', 'wp-register-profile-with-shortcode') . ':</strong> ' . $userdata['last_name'];
     136            $data .= '<br>';
     137        }
     138        if (!empty($userdata['display_name'])) {
     139            $data .= '<strong>' . __('Display Name', 'wp-register-profile-with-shortcode') . ':</strong> ' . $userdata['display_name'];
     140            $data .= '<br>';
     141        }
     142        if (!empty($userdata['description'])) {
     143            $data .= '<strong>' . __('About User', 'wp-register-profile-with-shortcode') . ':</strong> ' . $userdata['description'];
     144            $data .= '<br>';
     145        }
     146        if (!empty($userdata['user_url'])) {
     147            $data .= '<strong>' . __('User URL', 'wp-register-profile-with-shortcode') . ':</strong> ' . $userdata['user_url'];
     148            $data .= '<br>';
     149        }
     150
     151        $wprw_mail_to_admin_body = str_replace(array("#site_name#", "#new_user_data#", '#user_name#'), array(get_bloginfo('name'), $data, $userdata['user_login']), $wprw_mail_to_admin_body);
     152
     153        return $wprw_mail_to_admin_body;
     154    }
     155
     156    public function register_validate()
     157    {
     158        if (isset($_POST['option']) and sanitize_text_field($_POST['option']) == "wprp_user_register") {
     159
     160            if (!wp_verify_nonce($_POST['wprp_5q5rt78'], 'wprp_action')) {
     161                wp_die('Error');
     162            }
     163
     164            start_session_if_not_started();
     165            global $post;
     166            $error = false;
     167            $comp_errors = array();
     168            $msg = '';
     169            $_SESSION['wp_register_temp_data'] = $_POST;
     170
     171            // validation compatibility filter //
     172            $default_registration_form_hooks = get_option('default_registration_form_hooks');
     173            if ($default_registration_form_hooks == 'Yes') {
     174                $comp_validation = apply_filters('registration_errors', $comp_errors, sanitize_text_field(@$_POST['user_login']), sanitize_text_field(@$_POST['user_email']));
     175                if (is_wp_error($comp_validation)) {
     176                    $msg .= __($comp_validation->get_error_message(), 'wp-register-profile-with-shortcode');
     177                    $msg .= '</br>';
     178                    $error = true;
     179                }
     180            }
     181            // validation compatibility filter //
     182
     183            if ($this->is_field_enabled('captcha_in_registration')) {
     184                if (sanitize_text_field($_POST['user_captcha']) != $_SESSION['wprp_captcha_code']) {
     185                    $msg .= __('Security code do not match!', 'wp-register-profile-with-shortcode');
     186                    $msg .= '</br>';
     187                    $error = true;
     188                }
     189            }
     190
     191            if (!$this->is_field_enabled('username_in_registration') and empty($_POST['user_login'])) {
     192                $_POST['user_login'] = sanitize_text_field($_POST['user_email']);
     193            }
     194
     195            if (username_exists(sanitize_text_field($_POST['user_login']))) {
     196                $msg .= __('Username already exists. Please use a different one!', 'wp-register-profile-with-shortcode');
     197                $msg .= '</br>';
     198                $error = true;
     199            }
     200
     201            if (email_exists(sanitize_text_field($_POST['user_email']))) {
     202                $msg .= __('Email already exists. Please use a different one!', 'wp-register-profile-with-shortcode');
     203                $msg .= '</br>';
     204                $error = true;
     205            }
     206
     207            if ($this->is_field_enabled('password_in_registration')) {
     208                if ($_POST['new_user_password'] != $_POST['re_user_password']) {
     209                    $msg .= __('Password and Retype password do not match!', 'wp-register-profile-with-shortcode');
     210                    $msg .= '</br>';
     211                    $error = true;
     212                }
     213            }
     214
     215            $userdata = array();
     216
     217            if ($this->is_field_enabled('firstname_in_registration')) {
     218                if ($this->is_field_enabled('is_firstname_required') and sanitize_text_field($_POST['first_name']) == '') {
     219                    $msg .= __('Please enter first name', 'wp-register-profile-with-shortcode');
     220                    $msg .= '</br>';
     221                    $error = true;
     222                } else {
     223                    $userdata['first_name'] = sanitize_text_field($_POST['first_name']);
     224                }
     225            }
     226
     227            if ($this->is_field_enabled('lastname_in_registration')) {
     228                if ($this->is_field_enabled('is_lastname_required') and sanitize_text_field($_POST['last_name']) == '') {
     229                    $msg .= __('Please enter last name', 'wp-register-profile-with-shortcode');
     230                    $msg .= '</br>';
     231                    $error = true;
     232                } else {
     233                    $userdata['last_name'] = sanitize_text_field($_POST['last_name']);
     234                }
     235            }
     236
     237            if ($this->is_field_enabled('displayname_in_registration')) {
     238                if ($this->is_field_enabled('is_displayname_required') and sanitize_text_field($_POST['display_name']) == '') {
     239                    $msg .= __('Please enter display name', 'wp-register-profile-with-shortcode');
     240                    $msg .= '</br>';
     241                    $error = true;
     242                } else {
     243                    $userdata['display_name'] = sanitize_text_field($_POST['display_name']);
     244                }
     245            }
     246
     247            if ($this->is_field_enabled('userdescription_in_registration')) {
     248                if ($this->is_field_enabled('is_userdescription_required') and sanitize_text_field($_POST['description']) == '') {
     249                    $msg .= __('Please enter description', 'wp-register-profile-with-shortcode');
     250                    $msg .= '</br>';
     251                    $error = true;
     252                } else {
     253                    $userdata['description'] = sanitize_text_field($_POST['description']);
     254                }
     255            }
     256
     257            if ($this->is_field_enabled('userurl_in_registration')) {
     258                if ($this->is_field_enabled('is_userurl_required') and sanitize_text_field($_POST['user_url']) == '') {
     259                    $msg .= __('Please enter description', 'wp-register-profile-with-shortcode');
     260                    $msg .= '</br>';
     261                    $error = true;
     262                } else {
     263                    $userdata['user_url'] = sanitize_text_field($_POST['user_url']);
     264                }
     265            }
     266
     267            if (!$error) {
     268                $userdata['user_login'] = sanitize_text_field($_POST['user_login']);
     269                $userdata['user_email'] = sanitize_text_field($_POST['user_email']);
     270
     271                if ($this->is_field_enabled('password_in_registration') and $_POST['new_user_password'] != '') {
     272                    $new_pass = $_POST['new_user_password'];
     273                    $userdata['user_pass'] = $new_pass;
     274                } else {
     275                    $new_pass = wp_generate_password();
     276                    $userdata['user_pass'] = $new_pass;
     277                }
     278
     279                $enable_cfws_newsletter_subscription = get_option('enable_cfws_newsletter_subscription');
     280                if ($enable_cfws_newsletter_subscription == 'Yes') {
     281                    $userdata['cf_subscribe_newsletter'] = sanitize_text_field($_POST['cf_subscribe_newsletter']);
     282                }
     283
     284                if (get_option('enable_subscription') == 'Yes') {
     285                    $_SESSION['wp_register_subscription']['userdata'] = $userdata;
     286                    $_SESSION['wp_register_subscription']['sub_type'] = sanitize_text_field($_REQUEST['sub_type']);
     287                    $redirect_page = get_permalink(get_option('subscription_page'));
     288                    wp_redirect($redirect_page);
     289                    exit;
     290                } else {
     291                    $create_user_data['userdata'] = $userdata;
     292                    $user_id = $this->create_user($create_user_data);
     293
     294                    if ($this->is_field_enabled('force_login_after_registration') and $user_id) {
     295                        $nuser = get_user_by('id', $user_id);
     296                        if ($nuser) {
     297                            wp_set_current_user($user_id, $nuser->user_login);
     298                            wp_set_auth_cookie($user_id);
     299                            do_action('wp_login', $nuser->user_login, $nuser);
     300                        }
     301                    }
     302
     303                    $redirect_page = get_option('thank_you_page_after_registration_url');
     304                    if ($redirect_page) {
     305                        $redirect = get_permalink($redirect_page);
     306                    } else {
     307                        $redirect = sanitize_text_field($_REQUEST['redirect']);
     308                    }
     309
     310                    wp_redirect($redirect);
     311                    exit;
     312                }
     313            } else {
     314                $_SESSION['reg_error_msg'] = $msg;
     315                $_SESSION['reg_msg_class'] = 'reg_error';
     316            }
     317        }
     318    }
    305319}
  • wp-register-profile-with-shortcode/trunk/includes/class-settings.php

    r2969364 r3018102  
    1313    {
    1414        if (isset($_POST['option']) and sanitize_text_field($_POST['option']) == "register_widget_save_settings") {
     15
     16            if (!wp_verify_nonce($_POST['wprp_58irt78'], 'wprp_admin_action')) {
     17                wp_die('Error');
     18            }
     19
    1520            start_session_if_not_started();
    1621            global $wprp_default_options_data;
  • wp-register-profile-with-shortcode/trunk/readme.txt

    r2969364 r3018102  
    44Tags: register, responsive user registration, wp register, profile, register widget, widget, user register, register user, responsive form, responsive register form, custom fields, profile image, date, time, user image, custom profile fields, profile data
    55Requires at least: 2.0.2
    6 Tested up to: 6.2.2
    7 Stable tag: 3.5.9
     6Tested up to: 6.4.2
     7Stable tag: 3.6.0
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    8989== Changelog ==
    9090
     91= 3.6.0 =
     92* Bug fixes and improvements.
     93
    9194= 3.5.9 =
    9295* Bug fixes and improvements.
  • wp-register-profile-with-shortcode/trunk/register.php

    r2969364 r3018102  
    44Plugin URI: https://wordpress.org/plugins/wp-register-profile-with-shortcode/
    55Description: This is a simple registration form in the widget. just install the plugin and add the register widget in the sidebar. Thats it. :)
    6 Version: 3.5.9
     6Version: 3.6.0
    77Text Domain: wp-register-profile-with-shortcode
    88Domain Path: /languages
  • wp-register-profile-with-shortcode/trunk/view/admin/settings.php

    r2944276 r3018102  
    33wp_nonce_field('register_widget_save_action', 'register_widget_save_action_field');
    44Form_Class::form_input('hidden', 'option', '', 'register_widget_save_settings');
     5wp_nonce_field('wprp_admin_action', 'wprp_58irt78');
    56?>
    67<table width="100%" border="0" class="ap-table">
  • wp-register-profile-with-shortcode/trunk/view/frontend/profile-edit.php

    r2393730 r3018102  
    11<form name="profile" id="profile" method="post" action="" <?php do_action('wprp_profile_form_tag');?>>
    22  <input type="hidden" name="option" value="wprp_user_edit_profile" />
    3   <input type="hidden" name="redirect" value="<?php echo sanitize_text_field( Register_Process::curPageURL() ); ?>">
     3  <input type="hidden" name="redirect" value="<?php echo sanitize_text_field(Register_Process::curPageURL()); ?>">
     4  <?php wp_nonce_field('wprp_action', 'wprp_5q5rt78');?>
    45  <div class="reg-form-group">
    56    <label for="name">
    6       <?php _e('Username','wp-register-profile-with-shortcode');?>
     7      <?php _e('Username', 'wp-register-profile-with-shortcode');?>
    78    </label>
    8     <input type="text" required value="<?php echo $current_user->user_login;?>" disabled <?php do_action( 'wprp_profile_user_login_field' );?>/>
     9    <input type="text" required value="<?php echo $current_user->user_login; ?>" disabled <?php do_action('wprp_profile_user_login_field');?>/>
    910  </div>
    1011  <div class="reg-form-group">
    1112    <label for="name">
    12       <?php _e('User Email','wp-register-profile-with-shortcode');?>
     13      <?php _e('User Email', 'wp-register-profile-with-shortcode');?>
    1314    </label>
    14     <input type="email" name="user_email" value="<?php echo $current_user->user_email;?>" required title="<?php _e('Please enter email','wp-register-profile-with-shortcode');?>" <?php do_action( 'wprp_profile_user_email_field' );?>/>
     15    <input type="email" name="user_email" value="<?php echo $current_user->user_email; ?>" required title="<?php _e('Please enter email', 'wp-register-profile-with-shortcode');?>" <?php do_action('wprp_profile_user_email_field');?>/>
    1516  </div>
    16   <?php if($this->is_field_enabled('firstname_in_profile')){ ?>
     17  <?php if ($this->is_field_enabled('firstname_in_profile')) {?>
    1718  <div class="reg-form-group">
    1819    <label for="name">
    19       <?php _e('First Name','wp-register-profile-with-shortcode');?>
     20      <?php _e('First Name', 'wp-register-profile-with-shortcode');?>
    2021    </label>
    21     <input type="text" name="first_name" <?php echo $this->is_field_required('is_firstname_required');?> title="<?php _e('Please enter first name','wp-register-profile-with-shortcode');?>" placeholder="First Name" value="<?php echo $current_user->first_name;?>" <?php do_action( 'wprp_profile_first_name_field' );?>/>
     22    <input type="text" name="first_name" <?php echo $this->is_field_required('is_firstname_required'); ?> title="<?php _e('Please enter first name', 'wp-register-profile-with-shortcode');?>" placeholder="First Name" value="<?php echo $current_user->first_name; ?>" <?php do_action('wprp_profile_first_name_field');?>/>
    2223  </div>
    23   <?php } ?>
    24   <?php if($this->is_field_enabled('lastname_in_profile')){ ?>
     24  <?php }?>
     25  <?php if ($this->is_field_enabled('lastname_in_profile')) {?>
    2526  <div class="reg-form-group">
    2627    <label for="name">
    27       <?php _e('Last Name','wp-register-profile-with-shortcode');?>
     28      <?php _e('Last Name', 'wp-register-profile-with-shortcode');?>
    2829    </label>
    29     <input type="text" name="last_name" <?php echo $this->is_field_required('is_lastname_required');?> title="<?php _e('Please enter last name','wp-register-profile-with-shortcode');?>" placeholder="Last Name" value="<?php echo $current_user->last_name;?>" <?php do_action( 'wprp_profile_last_name_field' );?>/>
     30    <input type="text" name="last_name" <?php echo $this->is_field_required('is_lastname_required'); ?> title="<?php _e('Please enter last name', 'wp-register-profile-with-shortcode');?>" placeholder="Last Name" value="<?php echo $current_user->last_name; ?>" <?php do_action('wprp_profile_last_name_field');?>/>
    3031  </div>
    31   <?php } ?>
    32   <?php if($this->is_field_enabled('displayname_in_profile')){ ?>
     32  <?php }?>
     33  <?php if ($this->is_field_enabled('displayname_in_profile')) {?>
    3334  <div class="reg-form-group">
    3435    <label for="name">
    35       <?php _e('Display Name','wp-register-profile-with-shortcode');?>
     36      <?php _e('Display Name', 'wp-register-profile-with-shortcode');?>
    3637    </label>
    37     <input type="text" name="display_name" <?php echo $this->is_field_required('is_displayname_required');?> title="<?php _e('Please enter display name','wp-register-profile-with-shortcode');?>" placeholder="Display Name" value="<?php echo $current_user->display_name;?>" <?php do_action( 'wprp_profile_display_name_field' );?>/>
     38    <input type="text" name="display_name" <?php echo $this->is_field_required('is_displayname_required'); ?> title="<?php _e('Please enter display name', 'wp-register-profile-with-shortcode');?>" placeholder="Display Name" value="<?php echo $current_user->display_name; ?>" <?php do_action('wprp_profile_display_name_field');?>/>
    3839  </div>
    39   <?php } ?>
    40   <?php if($this->is_field_enabled('userdescription_in_profile')){ ?>
     40  <?php }?>
     41  <?php if ($this->is_field_enabled('userdescription_in_profile')) {?>
    4142  <div class="reg-form-group">
    4243    <label for="name">
    43       <?php _e('About User','wp-register-profile-with-shortcode');?>
     44      <?php _e('About User', 'wp-register-profile-with-shortcode');?>
    4445    </label>
    45     <textarea name="description" <?php echo $this->is_field_required('is_userdescription_required');?> title="<?php _e('Please enter about','wp-register-profile-with-shortcode');?>" <?php do_action( 'wprp_profile_description_field' );?>><?php echo get_the_author_meta( 'description', $user_id );?></textarea>
     46    <textarea name="description" <?php echo $this->is_field_required('is_userdescription_required'); ?> title="<?php _e('Please enter about', 'wp-register-profile-with-shortcode');?>" <?php do_action('wprp_profile_description_field');?>><?php echo get_the_author_meta('description', $user_id); ?></textarea>
    4647  </div>
    47   <?php } ?>
    48   <?php if($this->is_field_enabled('userurl_in_profile')){ ?>
     48  <?php }?>
     49  <?php if ($this->is_field_enabled('userurl_in_profile')) {?>
    4950  <div class="reg-form-group">
    5051    <label for="name">
    51       <?php _e('Website','wp-register-profile-with-shortcode');?>
     52      <?php _e('Website', 'wp-register-profile-with-shortcode');?>
    5253    </label>
    53     <input type="url" name="user_url" <?php echo $this->is_field_required('is_userurl_required');?> title="<?php _e('Please enter website url','wp-register-profile-with-shortcode');?>" placeholder="User URL" value="<?php echo get_the_author_meta( 'user_url', $user_id );?>" <?php do_action( 'wprp_profile_user_url_field' );?>/>
     54    <input type="url" name="user_url" <?php echo $this->is_field_required('is_userurl_required'); ?> title="<?php _e('Please enter website url', 'wp-register-profile-with-shortcode');?>" placeholder="User URL" value="<?php echo get_the_author_meta('user_url', $user_id); ?>" <?php do_action('wprp_profile_user_url_field');?>/>
    5455  </div>
    55   <?php } ?>
     56  <?php }?>
    5657  <?php do_action('wp_register_profile_edit_form');?>
    5758  <div class="reg-form-group">
    58     <input name="profile" type="submit" value="<?php _e('Update','wp-register-profile-with-shortcode');?>" <?php do_action( 'wprp_profile_form_submit_tag' );?>/>
     59    <input name="profile" type="submit" value="<?php _e('Update', 'wp-register-profile-with-shortcode');?>" <?php do_action('wprp_profile_form_submit_tag');?>/>
    5960  </div>
    6061</form>
  • wp-register-profile-with-shortcode/trunk/view/frontend/register.php

    r2393730 r3018102  
    11<form name="register" id="register" method="post" action="" <?php do_action('wprp_register_form_tag');?>>
    22  <input type="hidden" name="option" value="wprp_user_register" />
    3   <input type="hidden" name="redirect" value="<?php echo sanitize_text_field( Register_Process::curPageURL() ); ?>" />
    4   <?php if($wprp_p->is_field_enabled('username_in_registration')){ ?>
     3  <input type="hidden" name="redirect" value="<?php echo sanitize_text_field(Register_Process::curPageURL()); ?>" />
     4  <?php wp_nonce_field('wprp_action', 'wprp_5q5rt78');?>
     5  <?php if ($wprp_p->is_field_enabled('username_in_registration')) {?>
    56  <div class="reg-form-group">
    67    <label for="username">
    7       <?php _e('Username','wp-register-profile-with-shortcode');?>
     8      <?php _e('Username', 'wp-register-profile-with-shortcode');?>
    89    </label>
    9     <input type="text" name="user_login" value="<?php echo sanitize_text_field(@$_SESSION['wp_register_temp_data']['user_login']);?>" required title="<?php _e('Please enter username','wp-register-profile-with-shortcode');?>" placeholder="<?php _e('Username','wp-register-profile-with-shortcode');?>" <?php do_action( 'wprp_user_login_field' );?>/>
     10    <input type="text" name="user_login" value="<?php echo sanitize_text_field(@$_SESSION['wp_register_temp_data']['user_login']); ?>" required title="<?php _e('Please enter username', 'wp-register-profile-with-shortcode');?>" placeholder="<?php _e('Username', 'wp-register-profile-with-shortcode');?>" <?php do_action('wprp_user_login_field');?>/>
    1011  </div>
    11   <?php } ?>
     12  <?php }?>
    1213  <div class="reg-form-group">
    1314    <label for="useremail">
    14       <?php _e('User Email','wp-register-profile-with-shortcode');?>
     15      <?php _e('User Email', 'wp-register-profile-with-shortcode');?>
    1516    </label>
    16     <input type="email" name="user_email" value="<?php echo sanitize_text_field(@$_SESSION['wp_register_temp_data']['user_email']);?>" required title="<?php _e('Please enter email','wp-register-profile-with-shortcode');?>" placeholder="<?php _e('User Email','wp-register-profile-with-shortcode');?>" <?php do_action( 'wprp_user_email_field' );?>/>
     17    <input type="email" name="user_email" value="<?php echo sanitize_text_field(@$_SESSION['wp_register_temp_data']['user_email']); ?>" required title="<?php _e('Please enter email', 'wp-register-profile-with-shortcode');?>" placeholder="<?php _e('User Email', 'wp-register-profile-with-shortcode');?>" <?php do_action('wprp_user_email_field');?>/>
    1718  </div>
    18   <?php if($wprp_p->is_field_enabled('password_in_registration')){ ?>
     19  <?php if ($wprp_p->is_field_enabled('password_in_registration')) {?>
    1920  <div class="reg-form-group">
    2021    <label for="password">
    21       <?php _e('Password','wp-register-profile-with-shortcode');?>
     22      <?php _e('Password', 'wp-register-profile-with-shortcode');?>
    2223    </label>
    23     <input type="password" name="new_user_password" required placeholder="<?php _e('Password','wp-register-profile-with-shortcode');?>" title="<?php _e('Please enter password','wp-register-profile-with-shortcode');?>" <?php do_action( 'wprp_new_user_password_field' );?>/>
     24    <input type="password" name="new_user_password" required placeholder="<?php _e('Password', 'wp-register-profile-with-shortcode');?>" title="<?php _e('Please enter password', 'wp-register-profile-with-shortcode');?>" <?php do_action('wprp_new_user_password_field');?>/>
    2425  </div>
    2526  <div class="reg-form-group">
    2627    <label for="retypepassword">
    27       <?php _e('Retype Password','wp-register-profile-with-shortcode');?>
     28      <?php _e('Retype Password', 'wp-register-profile-with-shortcode');?>
    2829    </label>
    29     <input type="password" name="re_user_password" required title="<?php _e('Please re-enter password','wp-register-profile-with-shortcode');?>" placeholder="<?php _e('Retype Password','wp-register-profile-with-shortcode');?>" <?php do_action( 'wprp_re_user_password_field' );?>/>
     30    <input type="password" name="re_user_password" required title="<?php _e('Please re-enter password', 'wp-register-profile-with-shortcode');?>" placeholder="<?php _e('Retype Password', 'wp-register-profile-with-shortcode');?>" <?php do_action('wprp_re_user_password_field');?>/>
    3031  </div>
    31   <?php } ?>
    32   <?php if($wprp_p->is_field_enabled('firstname_in_registration')){ ?>
     32  <?php }?>
     33  <?php if ($wprp_p->is_field_enabled('firstname_in_registration')) {?>
    3334  <div class="reg-form-group">
    3435    <label for="firstname">
    35       <?php _e('First Name','wp-register-profile-with-shortcode');?>
     36      <?php _e('First Name', 'wp-register-profile-with-shortcode');?>
    3637    </label>
    37     <input type="text" name="first_name" value="<?php echo sanitize_text_field(@$_SESSION['wp_register_temp_data']['first_name']);?>" <?php echo $wprp_p->is_field_required('is_firstname_required');?> title="<?php _e('Please enter first name','wp-register-profile-with-shortcode');?>" placeholder="<?php _e('First Name','wp-register-profile-with-shortcode');?>" <?php do_action( 'wprp_first_name_field' );?>/>
     38    <input type="text" name="first_name" value="<?php echo sanitize_text_field(@$_SESSION['wp_register_temp_data']['first_name']); ?>" <?php echo $wprp_p->is_field_required('is_firstname_required'); ?> title="<?php _e('Please enter first name', 'wp-register-profile-with-shortcode');?>" placeholder="<?php _e('First Name', 'wp-register-profile-with-shortcode');?>" <?php do_action('wprp_first_name_field');?>/>
    3839  </div>
    39   <?php } ?>
    40   <?php if($wprp_p->is_field_enabled('lastname_in_registration')){ ?>
     40  <?php }?>
     41  <?php if ($wprp_p->is_field_enabled('lastname_in_registration')) {?>
    4142  <div class="reg-form-group">
    4243    <label for="lastname">
    43       <?php _e('Last Name','wp-register-profile-with-shortcode');?>
     44      <?php _e('Last Name', 'wp-register-profile-with-shortcode');?>
    4445    </label>
    45     <input type="text" name="last_name" value="<?php echo sanitize_text_field(@$_SESSION['wp_register_temp_data']['last_name']);?>" <?php echo $wprp_p->is_field_required('is_lastname_required');?> title="<?php _e('Please enter last name','wp-register-profile-with-shortcode');?>" placeholder="<?php _e('Last Name','wp-register-profile-with-shortcode');?>" <?php do_action( 'wprp_last_name_field' );?>/>
     46    <input type="text" name="last_name" value="<?php echo sanitize_text_field(@$_SESSION['wp_register_temp_data']['last_name']); ?>" <?php echo $wprp_p->is_field_required('is_lastname_required'); ?> title="<?php _e('Please enter last name', 'wp-register-profile-with-shortcode');?>" placeholder="<?php _e('Last Name', 'wp-register-profile-with-shortcode');?>" <?php do_action('wprp_last_name_field');?>/>
    4647  </div>
    47   <?php } ?>
    48   <?php if($wprp_p->is_field_enabled('displayname_in_registration')){ ?>
     48  <?php }?>
     49  <?php if ($wprp_p->is_field_enabled('displayname_in_registration')) {?>
    4950  <div class="reg-form-group">
    5051    <label for="displayname">
    51       <?php _e('Display Name','wp-register-profile-with-shortcode');?>
     52      <?php _e('Display Name', 'wp-register-profile-with-shortcode');?>
    5253    </label>
    53     <input type="text" name="display_name" value="<?php echo sanitize_text_field(@$_SESSION['wp_register_temp_data']['display_name']);?>" <?php echo $wprp_p->is_field_required('is_displayname_required');?> title="<?php _e('Please enter display name','wp-register-profile-with-shortcode');?>" placeholder="<?php _e('Display Name','wp-register-profile-with-shortcode');?>" <?php do_action( 'wprp_display_name_field' );?>/>
     54    <input type="text" name="display_name" value="<?php echo sanitize_text_field(@$_SESSION['wp_register_temp_data']['display_name']); ?>" <?php echo $wprp_p->is_field_required('is_displayname_required'); ?> title="<?php _e('Please enter display name', 'wp-register-profile-with-shortcode');?>" placeholder="<?php _e('Display Name', 'wp-register-profile-with-shortcode');?>" <?php do_action('wprp_display_name_field');?>/>
    5455  </div>
    55   <?php } ?>
    56   <?php if($wprp_p->is_field_enabled('userdescription_in_registration')){ ?>
     56  <?php }?>
     57  <?php if ($wprp_p->is_field_enabled('userdescription_in_registration')) {?>
    5758  <div class="reg-form-group">
    5859    <label for="aboutuser">
    59       <?php _e('About User','wp-register-profile-with-shortcode');?>
     60      <?php _e('About User', 'wp-register-profile-with-shortcode');?>
    6061    </label>
    61     <textarea name="description" <?php echo $wprp_p->is_field_required('is_userdescription_required');?> title="<?php _e('Please enter about','wp-register-profile-with-shortcode');?>" <?php do_action( 'wprp_description_field' );?>><?php echo sanitize_text_field(@$_SESSION['wp_register_temp_data']['description']);?></textarea>
     62    <textarea name="description" <?php echo $wprp_p->is_field_required('is_userdescription_required'); ?> title="<?php _e('Please enter about', 'wp-register-profile-with-shortcode');?>" <?php do_action('wprp_description_field');?>><?php echo sanitize_text_field(@$_SESSION['wp_register_temp_data']['description']); ?></textarea>
    6263  </div>
    63   <?php } ?>
    64   <?php if($wprp_p->is_field_enabled('userurl_in_registration')){ ?>
     64  <?php }?>
     65  <?php if ($wprp_p->is_field_enabled('userurl_in_registration')) {?>
    6566  <div class="reg-form-group">
    6667    <label for="website">
    67       <?php _e('Website','wp-register-profile-with-shortcode');?>
     68      <?php _e('Website', 'wp-register-profile-with-shortcode');?>
    6869    </label>
    69     <input type="url" name="user_url" value="<?php echo sanitize_text_field(@$_SESSION['wp_register_temp_data']['user_url']);?>" <?php echo $wprp_p->is_field_required('is_userurl_required');?> title="<?php _e('Please enter website url','wp-register-profile-with-shortcode');?>" placeholder="<?php _e('Website','wp-register-profile-with-shortcode');?>" <?php do_action( 'wprp_user_url_field' );?>/>
     70    <input type="url" name="user_url" value="<?php echo sanitize_text_field(@$_SESSION['wp_register_temp_data']['user_url']); ?>" <?php echo $wprp_p->is_field_required('is_userurl_required'); ?> title="<?php _e('Please enter website url', 'wp-register-profile-with-shortcode');?>" placeholder="<?php _e('Website', 'wp-register-profile-with-shortcode');?>" <?php do_action('wprp_user_url_field');?>/>
    7071  </div>
    71   <?php } ?>
    72   <?php do_action('wp_register_profile_subscription'); ?>
    73   <?php if($wprp_p->is_field_enabled('captcha_in_registration')){ ?>
     72  <?php }?>
     73  <?php do_action('wp_register_profile_subscription');?>
     74  <?php if ($wprp_p->is_field_enabled('captcha_in_registration')) {?>
    7475  <div class="reg-form-group">
    7576    <label for="captcha">
    76       <?php _e('Captcha','wp-register-profile-with-shortcode');?>
     77      <?php _e('Captcha', 'wp-register-profile-with-shortcode');?>
    7778    </label>
    7879    <?php $this->captcha_image();?>
    79     <input type="text" name="user_captcha" autocomplete="off" required title="<?php _e('Please enter captcha','wp-register-profile-with-shortcode');?>" <?php do_action( 'wprp_user_captcha_field' );?>/>
     80    <input type="text" name="user_captcha" autocomplete="off" required title="<?php _e('Please enter captcha', 'wp-register-profile-with-shortcode');?>" <?php do_action('wprp_user_captcha_field');?>/>
    8081  </div>
    81   <?php } ?>
    82   <?php $default_registration_form_hooks == 'Yes'?do_action('register_form'):'';?>
     82  <?php }?>
     83  <?php $default_registration_form_hooks == 'Yes' ? do_action('register_form') : '';?>
    8384  <?php do_action('wp_register_profile_form');?>
    8485  <div class="reg-form-group">
    85     <input name="register" type="submit" value="<?php _e('Register','wp-register-profile-with-shortcode');?>" <?php do_action( 'wprp_register_form_submit_tag' );?>/>
     86    <input name="register" type="submit" value="<?php _e('Register', 'wp-register-profile-with-shortcode');?>" <?php do_action('wprp_register_form_submit_tag');?>/>
    8687  </div>
    8788</form>
  • wp-register-profile-with-shortcode/trunk/view/frontend/update-password.php

    r2379514 r3018102  
    11<form name="update-password" id="update-password" method="post" action="" <?php do_action('wprp_update_pass_form_tag');?>>
    22  <input type="hidden" name="option" value="rpws_user_update_password" />
    3   <input type="hidden" name="redirect" value="<?php echo sanitize_text_field( Register_Process::curPageURL() ); ?>">
     3  <input type="hidden" name="redirect" value="<?php echo sanitize_text_field(Register_Process::curPageURL()); ?>">
     4  <?php wp_nonce_field('wprp_action', 'wprp_5q5rt78');?>
    45  <div class="reg-form-group">
    56    <label for="name">
    6       <?php _e('New Password','wp-register-profile-with-shortcode');?>
     7      <?php _e('New Password', 'wp-register-profile-with-shortcode');?>
    78    </label>
    8     <input type="password" name="user_new_password" required title="<?php _e('Please enter password','wp-register-profile-with-shortcode');?>" <?php do_action( 'wprp_update_pass_user_new_password_field' );?>/>
     9    <input type="password" name="user_new_password" required title="<?php _e('Please enter password', 'wp-register-profile-with-shortcode');?>" <?php do_action('wprp_update_pass_user_new_password_field');?>/>
    910  </div>
    1011  <div class="reg-form-group">
    1112    <label for="name">
    12       <?php _e('Retype Password','wp-register-profile-with-shortcode');?>
     13      <?php _e('Retype Password', 'wp-register-profile-with-shortcode');?>
    1314    </label>
    14     <input type="password" name="user_retype_password" required title="<?php _e('Please re-enter password','wp-register-profile-with-shortcode');?>" <?php do_action( 'wprp_update_pass_user_retype_password_field' );?>/>
     15    <input type="password" name="user_retype_password" required title="<?php _e('Please re-enter password', 'wp-register-profile-with-shortcode');?>" <?php do_action('wprp_update_pass_user_retype_password_field');?>/>
    1516  </div>
    1617  <div class="reg-form-group">
    17     <input name="profile" type="submit" value="<?php _e('Update','wp-register-profile-with-shortcode');?>" <?php do_action( 'wprp_update_pass_form_submit_tag' );?>/>
     18    <input name="profile" type="submit" value="<?php _e('Update', 'wp-register-profile-with-shortcode');?>" <?php do_action('wprp_update_pass_form_submit_tag');?>/>
    1819  </div>
    1920</form>
Note: See TracChangeset for help on using the changeset viewer.