Disable new user approval for specific roles

Hello,

I use the plugin "New User Approve" to modify the registration process in my website but I would like to disable it for customers and authors. I have to use this code
do_action( 'new_user_approve_approve_user', $user_id );
but I have no idea how to use it... Could you please help me?

  • lesanis

    Hello Kasia,

    The form I will use for customers is the registration form of woocommerce that is located in woocommerce / templates / myaccount / form-login.php. I have created a new page template in which I have dropped the code

    <div class="registration-box">
    
    	<h2><?php _e( 'Register', 'woocommerce' ); ?></h2>
    
    		<form method="post" class="register">
    
    			<?php do_action( 'woocommerce_register_form_start' ); ?>
    
    			<?php if ( 'no' === get_option( 'woocommerce_registration_generate_username' ) ) : ?>
    
    				<p class="registration-row">
    					<label for="reg_username"><?php _e( 'Username', 'woocommerce' ); ?> <span class="required">*</span></label>
    					<input type="text" class="woocommerce-Input woocommerce-Input--text input-text" name="username" id="reg_username" value="<?php if ( ! empty( $_POST['username'] ) ) echo esc_attr( $_POST['username'] ); ?>" />
    				</p>
    
    			<?php endif; ?>
    
    			<p class="registration-row">
    				<label for="reg_email"><?php _e( 'Email address', 'woocommerce' ); ?> <span class="required">*</span></label>
    				<input type="email" class="woocommerce-Input woocommerce-Input--text input-text" name="email" id="reg_email" value="<?php if ( ! empty( $_POST['email'] ) ) echo esc_attr( $_POST['email'] ); ?>" />
    			</p>
    
    			<?php if ( 'no' === get_option( 'woocommerce_registration_generate_password' ) ) : ?>
    
    				<p class="registration-row">
    					<label for="reg_password"><?php _e( 'Password', 'woocommerce' ); ?> <span class="required">*</span></label>
    					<input type="password" class="woocommerce-Input woocommerce-Input--text input-text" name="password" id="reg_password" />
    				</p>
    
    			<?php endif; ?>
    
    			<!-- Spam Trap -->
    			<div style="<?php echo ( ( is_rtl() ) ? 'right' : 'left' ); ?>: -999em; position: absolute;"><label for="trap"><?php _e( 'Anti-spam', 'woocommerce' ); ?></label><input type="text" name="email_2" id="trap" tabindex="-1" /></div>
    
    			<?php do_action( 'woocommerce_register_form' ); ?>
    			<?php do_action( 'register_form' ); ?>
    
    			<p class="registration-row">
    				<?php wp_nonce_field( 'woocommerce-register', 'woocommerce-register-nonce' ); ?>
    				<input type="submit" class="woocommerce-Button button" name="register" value="<?php esc_attr_e( 'Register', 'woocommerce' );  ?>" />
    			</p>
    			<?php do_action( 'woocommerce_register_form_end' ); ?>
    		</form>
    			</div>

    How could I use the code
    do_action( 'new_user_approve_approve_user', $user_id );
    in the form so New User Approval is disabled for the customers? I have tried
    <?php do_action( 'new_user_approve_approve_user', $user_id ); ?>
    but it didn't work..

    Kind Regards,
    lesanis

  • Ash

    Hello lesanis

    First of all, are you sure the above form creates author and customer only, not any other role?

    Though either way, you have to add the do_action code just after registration. Do you have any code that handles the registration? If so, just after operating the registration you need to put the code. Consider the following example:

    $username = $_POST['username'];
    $pw = $_POST['pw'];
    // and some other code
    // ........
    
    // Now registration here
    $user_id = wp_create_user( ........ );
    // Now here goes the do_action code
    // ......

    Hope it helps :slight_smile: Please feel free to ask more question if you have any.

    Cheers
    Ash

  • Ash

    Hello @lesanis

    I have doubt if adding the code in the registration form will work, but as you said, you can add like below:

    <div class="registration-box">
            <?php do_action( 'new_user_approve_approve_user', $user_id ); ?>
    	<h2><?php _e( 'Register', 'woocommerce' ); ?></h2>
    
    		<form method="post" class="register">
    
    			<?php do_action( 'woocommerce_register_form_start' ); ?>
    
    			<?php if ( 'no' === get_option( 'woocommerce_registration_generate_username' ) ) : ?>
    
    				<p class="registration-row">
    					<label for="reg_username"><?php _e( 'Username', 'woocommerce' ); ?> <span class="required">*</span></label>
    					<input type="text" class="woocommerce-Input woocommerce-Input--text input-text" name="username" id="reg_username" value="<?php if ( ! empty( $_POST['username'] ) ) echo esc_attr( $_POST['username'] ); ?>" />
    				</p>
    
    			<?php endif; ?>
    
    			<p class="registration-row">
    				<label for="reg_email"><?php _e( 'Email address', 'woocommerce' ); ?> <span class="required">*</span></label>
    				<input type="email" class="woocommerce-Input woocommerce-Input--text input-text" name="email" id="reg_email" value="<?php if ( ! empty( $_POST['email'] ) ) echo esc_attr( $_POST['email'] ); ?>" />
    			</p>
    
    			<?php if ( 'no' === get_option( 'woocommerce_registration_generate_password' ) ) : ?>
    
    				<p class="registration-row">
    					<label for="reg_password"><?php _e( 'Password', 'woocommerce' ); ?> <span class="required">*</span></label>
    					<input type="password" class="woocommerce-Input woocommerce-Input--text input-text" name="password" id="reg_password" />
    				</p>
    
    			<?php endif; ?>
    
    			<!-- Spam Trap -->
    			<div style="<?php echo ( ( is_rtl() ) ? 'right' : 'left' ); ?>: -999em; position: absolute;"><label for="trap"><?php _e( 'Anti-spam', 'woocommerce' ); ?></label><input type="text" name="email_2" id="trap" tabindex="-1" /></div>
    
    			<?php do_action( 'woocommerce_register_form' ); ?>
    			<?php do_action( 'register_form' ); ?>
    
    			<p class="registration-row">
    				<?php wp_nonce_field( 'woocommerce-register', 'woocommerce-register-nonce' ); ?>
    				<input type="submit" class="woocommerce-Button button" name="register" value="<?php esc_attr_e( 'Register', 'woocommerce' );  ?>" />
    			</p>
    			<?php do_action( 'woocommerce_register_form_end' ); ?>
    		</form>
    			</div>

    Hope it helps :slight_smile: Please feel free to ask more question if you have any.

    Cheers
    Ash

  • lesanis

    Hello Ash,

    Indeed it didn't worked as you assumed:frowning2: I have in my website three registration forms.
    1) Woocomerce (the above code)
    2) Buddypress registration form
    3) s2 member registration form that is

    <?php
    if(!defined('WPINC')) // MUST have WordPress.
    	exit("Do not access this file directly.");
    ?>
    
    <div id="s2p-form"></div><!-- This is for hash anchors; do NOT remove please. -->
    
    <form id="s2member-pro-paypal-registration-form" class="s2member-pro-paypal-form s2member-pro-paypal-registration-form" method="post" action="%%action%%" autocomplete="off">
    
    	<!-- Response Section (this is auto-filled after form submission). -->
    	<div id="s2member-pro-paypal-registration-form-response-section" class="s2member-pro-paypal-form-section s2member-pro-paypal-registration-form-section s2member-pro-paypal-form-response-section s2member-pro-paypal-registration-form-response-section">
    		<div id="s2member-pro-paypal-registration-form-response-div" class="s2member-pro-paypal-form-div s2member-pro-paypal-registration-form-div s2member-pro-paypal-form-response-div s2member-pro-paypal-registration-form-response-div">
    			%%response%%
    		</div>
    		<div style="clear:both;"></div>
    	</div>
    
    	<!-- Options Section (this is filled by Shortcode options; when/if specified). -->
    	<div id="s2member-pro-paypal-registration-form-options-section" class="s2member-pro-paypal-form-section s2member-pro-paypal-registration-form-section s2member-pro-paypal-form-options-section s2member-pro-paypal-registration-form-options-section">
    		<div id="s2member-pro-paypal-registration-form-options-section-title" class="s2member-pro-paypal-form-section-title s2member-pro-paypal-registration-form-section-title s2member-pro-paypal-form-options-section-title s2member-pro-paypal-registration-form-options-section-title">
    			<?php echo _x("Registration Options", "s2member-front", "s2member"); ?>
    		</div>
    		<div id="s2member-pro-paypal-registration-form-options-div" class="s2member-pro-paypal-form-div s2member-pro-paypal-registration-form-div s2member-pro-paypal-form-options-div s2member-pro-paypal-registration-form-options-div">
    			<select name="s2p-option" id="s2member-pro-paypal-registration-options" class="s2member-pro-paypal-options s2member-pro-paypal-registration-options form-control" tabindex="-1">
    				%%options%%
    			</select>
    		</div>
    		<div style="clear:both;"></div>
    	</div>
    
    	<!-- Registration Description (this is the desc="" attribute from your Shortcode). -->
    	<div id="s2member-pro-paypal-registration-form-description-section" class="s2member-pro-paypal-form-section s2member-pro-paypal-registration-form-section s2member-pro-paypal-form-description-section s2member-pro-paypal-registration-form-description-section">
    		<div id="s2member-pro-paypal-registration-form-description-div" class="s2member-pro-paypal-form-div s2member-pro-paypal-registration-form-div s2member-pro-paypal-form-description-div s2member-pro-paypal-registration-form-description-div">
    			%%description%%
    		</div>
    		<div style="clear:both;"></div>
    	</div>
    
    	<!-- Registration Details (Name, Email, Username, Password). -->
    	<!-- Name fields will be hidden automatically when/if your Registration/Profile Field options dictate this behavior. -->
    	<div id="s2member-pro-paypal-registration-form-registration-section" class="s2member-pro-paypal-form-section s2member-pro-paypal-registration-form-section s2member-pro-paypal-form-registration-section s2member-pro-paypal-registration-form-registration-section">
    		<div id="s2member-pro-paypal-registration-form-registration-section-title" class="s2member-pro-paypal-form-section-title s2member-pro-paypal-registration-form-section-title s2member-pro-paypal-form-registration-section-title s2member-pro-paypal-registration-form-registration-section-title">
    			<?php echo _x ("Create Profile", "s2member-front", "s2member"); ?>
    		</div>
    		<div id="s2member-pro-paypal-registration-form-first-name-div" class="s2member-pro-paypal-form-div s2member-pro-paypal-registration-form-div s2member-pro-paypal-form-first-name-div s2member-pro-paypal-registration-form-first-name-div">
    			<label for="s2member-pro-paypal-registration-first-name" id="s2member-pro-paypal-registration-form-first-name-label" class="s2member-pro-paypal-form-first-name-label s2member-pro-paypal-registration-form-first-name-label">
    				<span><?php echo _x ("First Name", "s2member-front", "s2member"); ?> *</span><br />
    				<input type="text" aria-required="true" maxlength="100" autocomplete="off" name="s2member_pro_paypal_registration[first_name]" id="s2member-pro-paypal-registration-first-name" class="s2member-pro-paypal-first-name s2member-pro-paypal-registration-first-name form-control" value="%%first_name_value%%" tabindex="10" />
    			</label>
    		</div>
    		<div id="s2member-pro-paypal-registration-form-last-name-div" class="s2member-pro-paypal-form-div s2member-pro-paypal-registration-form-div s2member-pro-paypal-form-last-name-div s2member-pro-paypal-registration-form-last-name-div">
    			<label for="s2member-pro-paypal-registration-last-name" id="s2member-pro-paypal-registration-form-last-name-label" class="s2member-pro-paypal-form-last-name-label s2member-pro-paypal-registration-form-last-name-label">
    				<span><?php echo _x ("Last Name", "s2member-front", "s2member"); ?> *</span><br />
    				<input type="text" aria-required="true" maxlength="100" autocomplete="off" name="s2member_pro_paypal_registration[last_name]" id="s2member-pro-paypal-registration-last-name" class="s2member-pro-paypal-last-name s2member-pro-paypal-registration-last-name form-control" value="%%last_name_value%%" tabindex="20" />
    			</label>
    		</div>
    		<div id="s2member-pro-paypal-registration-form-email-div" class="s2member-pro-paypal-form-div s2member-pro-paypal-registration-form-div s2member-pro-paypal-form-email-div s2member-pro-paypal-registration-form-email-div">
    			<label for="s2member-pro-paypal-registration-email" id="s2member-pro-paypal-registration-form-email-label" class="s2member-pro-paypal-form-email-label s2member-pro-paypal-registration-form-email-label">
    				<span><?php echo _x ("Email Address", "s2member-front", "s2member"); ?> *</span><br />
    				<input type="email" aria-required="true" data-expected="email" maxlength="100" autocomplete="off" name="s2member_pro_paypal_registration[email]" id="s2member-pro-paypal-registration-email" class="s2member-pro-paypal-email s2member-pro-paypal-registration-email form-control" value="%%email_value%%" tabindex="30" />
    			</label>
    		</div>
    		<div id="s2member-pro-paypal-registration-form-username-div" class="s2member-pro-paypal-form-div s2member-pro-paypal-registration-form-div s2member-pro-paypal-form-username-div s2member-pro-paypal-registration-form-username-div">
    			<label for="s2member-pro-paypal-registration-username" id="s2member-pro-paypal-registration-form-username-label" class="s2member-pro-paypal-form-username-label s2member-pro-paypal-registration-form-username-label">
    				<span><?php echo _x ("Username (lowercase alphanumeric)", "s2member-front", "s2member"); ?> *</span><br />
    				<input type="text" aria-required="true" maxlength="60" autocomplete="off" name="s2member_pro_paypal_registration[username]" id="s2member-pro-paypal-registration-username" class="s2member-pro-paypal-username s2member-pro-paypal-registration-username form-control" value="%%username_value%%" tabindex="40" />
    			</label>
    		</div>
    		<div id="s2member-pro-paypal-registration-form-password-div" class="s2member-pro-paypal-form-div s2member-pro-paypal-registration-form-div s2member-pro-paypal-form-password-div s2member-pro-paypal-registration-form-password-div">
    			<label for="s2member-pro-paypal-registration-password1" id="s2member-pro-paypal-registration-form-password-label" class="s2member-pro-paypal-form-password-label s2member-pro-paypal-registration-form-password-label">
    				<span><?php echo _x ("Password (type this twice please)", "s2member-front", "s2member"); ?> *</span><br />
    				<input type="password" aria-required="true" maxlength="100" autocomplete="off" name="s2member_pro_paypal_registration[password1]" id="s2member-pro-paypal-registration-password1" class="s2member-pro-paypal-password1 s2member-pro-paypal-registration-password1 form-control" value="%%password1_value%%" tabindex="50" />
    			</label>
    			<input type="password" maxlength="100" autocomplete="off" name="s2member_pro_paypal_registration[password2]" id="s2member-pro-paypal-registration-password2" class="s2member-pro-paypal-password2 s2member-pro-paypal-registration-password2 form-control" value="%%password2_value%%" tabindex="60" />
    			<div id="s2member-pro-paypal-registration-form-password-strength" class="ws-plugin--s2member-password-strength s2member-pro-paypal-form-password-strength s2member-pro-paypal-registration-form-password-strength"><em><?php echo _x ("password strength indicator", "s2member-front", "s2member"); ?></em></div>
    		</div>
    		<div style="clear:both;"></div>
    	</div>
    
    	<!-- Custom Fields (Custom Registration/Profile Fields will appear here, when/if they've been configured). -->
    	%%custom_fields%%
    
    	<!-- Captcha ( A reCaptcha section, with a required security code will appear here; if captcha="1" ). -->
    	%%captcha%%
    
    	<!-- Complete Registration (this holds the submit button, and also some dynamic hidden input variables). -->
    	<div id="s2member-pro-paypal-registration-form-submission-section" class="s2member-pro-paypal-form-section s2member-pro-paypal-registration-form-section s2member-pro-paypal-form-submission-section s2member-pro-paypal-registration-form-submission-section">
    		<div id="s2member-pro-paypal-registration-form-submission-section-title" class="s2member-pro-paypal-form-section-title s2member-pro-paypal-registration-form-section-title s2member-pro-paypal-form-submission-section-title s2member-pro-paypal-registration-form-submission-section-title">
    			<?php echo _x ("Complete Registration", "s2member-front", "s2member"); ?>
    		</div>
    		%%opt_in%% <!-- s2Member will fill this when/if there are list servers integrated, and the Opt-In Box is turned on. -->
    		<div id="s2member-pro-paypal-registration-form-submit-div" class="s2member-pro-paypal-form-div s2member-pro-paypal-registration-form-div s2member-pro-paypal-form-submit-div s2member-pro-paypal-registration-form-submit-div">
    			%%hidden_inputs%% <!-- Auto-filled by the s2Member software. Do NOT remove this under any circumstance. -->
    			<button type="submit" id="s2member-pro-paypal-registration-submit" class="s2member-pro-paypal-submit s2member-pro-paypal-registration-submit btn btn-primary" tabindex="400"><?php echo esc_html (_x ("Submit Form", "s2member-front", "s2member")); ?></button>
    		</div>
    		<div style="clear:both;"></div>
    	</div>
    </form>

    Is there a way to make this code
    do_action( 'new_user_approve_approve_user', $user_id );
    work with one of these registration forms? I am trying to disable user approval for the users that will register through one of these three forms. I wish that this is possible...

    Thank you,
    lesanis

  • Kasia Swiderska

    Hello lesanis,

    I did a small research about WooCommerce registration form and there is hook you could try to use. You would need to try that.

    function action_woocommerce_created_customer( $customer_id, $new_customer_data, $password_generated ) {
      do_action( 'new_user_approve_approve_user', $customer_id );
    }; 
    
    add_action( 'woocommerce_created_customer', 'action_woocommerce_created_customer', 10, 3 );

    that code needs to be added to functions.php file in your theme.
    Source: http://hookr.io/actions/woocommerce_created_customer/

    kind regards,
    Kasia

  • lesanis

    Hello Kasia,

    wooow your code worked like a charm!!! Is there a way to make the code work for users that register after a payment too? I have found the following code that hooks registration after payment:

    add_action('ws_plugin__s2member_during_paypal_notify_during_subscr_signup_w_update_vars', 'expiration_date');
    function expiration_date($vars = array()) {
    	$user_id = $vars['user_id'];
    	$expire_on = strtotime('04/04/2015');
    	update_user_option ($user_id, "s2member_auto_eot_time", $expire_on);
    }

    Is it possible to modify the above code and make ws_plugin__s2member_during_paypal_notify_during_subscr_signup_w_update_vars
    work with
    do_action( 'new_user_approve_approve_user', $user_id );
    so "New User Approve" is disabled for users that register after a payment?

    Thank you,
    lesanis

  • Kasia Swiderska

    Hello lesanis,

    Ok, try this (however I'm not sure that is right hook - but lets check).

    add_action('ws_plugin__s2member_during_paypal_notify_during_subscr_signup_w_update_vars', 'expiration_date');
    function expiration_date($vars = array()) {
    	$user_id = $vars['user_id'];
    	$expire_on = strtotime('04/04/2015');
    	update_user_option ($user_id, "s2member_auto_eot_time", $expire_on);
             do_action( 'new_user_approve_approve_user', $user_id );
    }

    Let me know if this will work.

    kind regards,
    Kasia

  • lesanis

    Hello Kasia,

    Unfortunately it didn't work.. Do you think that it would work with this code that autologins users to website after succesfull payment?

    <?php
    add_action('ws_plugin__s2member_during_configure_user_registration', 's2_auto_login_after_registration');
      function s2_auto_login_after_registration($vars = array())
          {
              if(is_admin()) return; // Not when an Admin is creating accounts.
    
              wp_set_auth_cookie($vars['user_id'], FALSE, FALSE); // Log the user in.
    
              remove_all_filters('login_redirect'); // BuddyPress compatibility.
    
              if(did_action('login_form_register')) // For <code>/wp-login.php?action=register</code> compatibility.
                  c_ws_plugin__s2member_login_redirects::login_redirect($vars['login'], $vars['user']);
    
              $GLOBALS['_s2_auto_login_after_registration_vars'] = $vars; // For Pro Form compatibility.
              add_action('template_redirect', '_s2_auto_login_after_registration', 1);
          }
      function _s2_auto_login_after_registration() // Pro Form redirection handler.
          {
              $vars = $GLOBALS['_s2_auto_login_after_registration_vars'];
              c_ws_plugin__s2member_login_redirects::login_redirect($vars['login'], $vars['user']);
          }

    Best Regards,
    lesanis

  • Vadym

    Hello! On my site, users can register as Guest and Local. I use the “New User Approve” plugin for my site, and all registered users get access to their accounts after manual approval. But I need the Guest role to be automatically confirmed, and the Local - manually. Please, help me.
    I have this code on rigistration.

    <?php
    /**
     * Template Name: Register Page Template
    */
    global $post;
    	get_header();
    	if(!isset($_REQUEST['role'])){
    ?>
    <div class="fre-page-wrapper">
    	<div class="fre-page-section">
    		<div class="container">
    			<div class="fre-authen-wrapper">
    				<div class="fre-register-default">
    					<h2><?php _e('Sign Up Free Account', ET_DOMAIN)?></h2>
    					<div class="fre-register-wrap">
    						<div class="row">
    							<div class="col-sm-6">
    								<div class="register-employer">
    									<h3><?php _e('Guest', ET_DOMAIN);?></h3>
    									<p><?php _e('Post requests, get offers from Locals to assist your goals at your next destination place.', ET_DOMAIN);?></p>
    									<a class="fre-small-btn" href="<?php echo home_url() . '/register/?role=' . EMPLOYER;?>"><?php _e('Sign Up', ET_DOMAIN);?></a>
    								</div>
    							</div>
    							<div class="col-sm-6">
    								<div class="register-freelancer">
    									<h3><?php _e('Local', ET_DOMAIN);?></h3>
    									<p><?php _e('Create professional profile, find freelance work delivering concierge services for Guests of the location where you live.', ET_DOMAIN);?></p>
    									<a class="fre-small-btn" href="<?php echo home_url() . '/register/?role=' . FREELANCER;?>"><?php _e('Sign Up', ET_DOMAIN);?></a>
    								</div>
    							</div>
    						</div>
    					</div>
    					<div class="fre-authen-footer">
    						<?php
    			                if(fre_check_register() && function_exists('ae_render_social_button')){
    			                    $before_string = __("You can use social account to login", ET_DOMAIN);
    			                    ae_render_social_button( array(), array(), $before_string );
    			                }
    			            ?>
    					</div>
    				</div>
    			</div>
    		</div>
    	</div>
    </div>
    <?php
    	}else{
    		$role = $_REQUEST['role'];
    		$re_url = '';
    		if( isset($_GET['ae_redirect_url']) ){
    			$re_url = $_GET['ae_redirect_url'];
    		}
    ?>
    	<div class="fre-page-wrapper">
    		<div class="fre-page-section">
    			<div class="container">
    				<div class="fre-authen-wrapper">
    					<div class="fre-authen-register">
    						<?php if($role == 'employer'){ ?>
    								<h2><?php _e('Sign up as a Guest', ET_DOMAIN);?></h2>
    						<form role="form" id="signup_form">
    							<input type="hidden" name="ae_redirect_url"  value="<?php echo $re_url ?>" />
    							<input type="hidden" name="role" id="role" value="<?php echo $role;?>" />
    							<div class="fre-input-field">
    								<input type="text" name="first_name" id="first_name" placeholder="<?php _e('First Name', ET_DOMAIN);?>">
    							</div>
    							<div class="fre-input-field">
    								<input type="text" name="last_name" id="last_name" placeholder="<?php _e('Last Name', ET_DOMAIN);?>">
    							</div>
    
    							<!-- TEST
    
    							<div class="fre-input-field">
    								<input type="text" name="last_name" id="last_name" placeholder="<?php _e('ast Name', ET_DOMAIN);?>">
    							</div>
    
    							END -->
    
    							<div class="fre-input-field">
    								<input type="text" name="user_email" id="user_email" placeholder="<?php _e('Email', ET_DOMAIN);?>">
    							</div>
    							<div class="fre-input-field">
    								<input type="text" name="user_login" id="user_login" placeholder="<?php _e('Username', ET_DOMAIN);?>">
    							</div>
    							<div class="fre-input-field">
    								<input type="password" name="user_pass" id="user_pass" placeholder="<?php _e('Password', ET_DOMAIN);?>">
    							</div>
    							<div class="fre-input-field">
    								<input type="password" name="repeat_pass" id="repeat_pass" placeholder="<?php _e('Confirm Your Password', ET_DOMAIN);?>">
    							</div>
    							<?php ae_gg_recaptcha( $container = 'fre-input-field' );?>
    							<div class="fre-input-field">
    								<button class="fre-btn btn-submit"><?php _e('Sign Up', ET_DOMAIN);?></button>
    							</div>
    						</form>
    						<?php }else{ ?>
    								<h2><?php _e('Sign up as a Local', ET_DOMAIN);?></h2>
    
    						<form role="form" id="signup_form">
    							<input type="hidden" name="ae_redirect_url"  value="<?php echo $re_url ?>" />
    							<input type="hidden" name="role" id="role" value="<?php echo $role;?>" />
    							<div class="fre-input-field">
    								<input type="text" name="first_name" id="first_name" placeholder="<?php _e('First Name', ET_DOMAIN);?>">
    							</div>
    							<div class="fre-input-field">
    								<input type="text" name="last_name" id="last_name" placeholder="<?php _e('Last Name', ET_DOMAIN);?>">
    							</div>
    
    							<!-- TEST
    
    							<div class="fre-input-field">
    								<input type="text" name="last_name" id="last_name" placeholder="<?php _e('ast Name', ET_DOMAIN);?>">
    							</div>
    
    							END -->
    
    							<div class="fre-input-field">
    								<input type="text" name="user_email" id="user_email" placeholder="<?php _e('Email', ET_DOMAIN);?>">
    							</div>
    							<div class="fre-input-field">
    								<input type="text" name="user_login" id="user_login" placeholder="<?php _e('Username', ET_DOMAIN);?>">
    							</div>
    							<div class="fre-input-field">
    								<input type="password" name="user_pass" id="user_pass" placeholder="<?php _e('Password', ET_DOMAIN);?>">
    							</div>
    							<div class="fre-input-field">
    								<input type="password" name="repeat_pass" id="repeat_pass" placeholder="<?php _e('Confirm Your Password', ET_DOMAIN);?>">
    							</div>
    							<?php ae_gg_recaptcha( $container = 'fre-input-field' );?>
    							<div class="fre-input-field">
    								<button class="fre-btn btn-submit"  onClick='location.href="https://localsassist.com/verification/"'><?php _e('Sign Up', ET_DOMAIN);?></button>
    							</div>
    						</form>
    						<!-- MY CODE -->
    
    						<!--END-->
    
    						<?php } ?>
    						<?php
    							$tos = et_get_page_link('tos', array() ,false);
    			                $url_tos = '<a href="'.et_get_page_link('tos').'" rel="noopener noreferrer" target="_Blank">'.__('Term of Use and Privacy policy', ET_DOMAIN).'</a>';
    			                if($tos) {
    			                	echo "<p>";
    			                	printf(__('By signing up to create an account I accept the %s', ET_DOMAIN), $url_tos );
    			                	echo "</p>";
    			                }
    						?>
    						<div class="fre-authen-footer">
    							<p><?php _e('Already have an account?', ET_DOMAIN);?> <a href="<?php echo et_get_page_link("login") ?>"><?php _e('Log In', ET_DOMAIN);?></a></p>
    						</div>
    					</div>
    				</div>
    			</div>
    		</div>
    	</div>
    <?php
    	}
    	get_footer();
    ?>

    Where do I paste this code?
    do_action( 'new_user_approve_approve_user', $user_id );
    I tried to insert, it does not work anyway.

    • viobru

      Hi, Vadym!

      Thanks for contacting us, hope you are doing great :slight_smile:

      I checked your code and I can't find "$user_id" anywhere on it, so I guess that just adding the "do_action( ..." code inside the current code won't work at all.

      Also, please note that this thread was opened by another member and also your registration code is different so, could you please open a new ticket so any reply on it is only received by you?
      Please, include a link to this thread on the new ticket so we know to what your new ticket is related to.

      Thanks for your comprehension and many thanks in advance :slight_smile:

      Have a nice day ahead and Happy New Year!

      Kind regards,
      Violeta

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.