• Resolved den1sa

    (@den1sa)


    Hi,

    I am using PMP to register a new user. I have the Register Helper addon to enable me to introduce new fields during the registration process. After registration, I am managing and displaying the user via Ultimate Member.

    function my_pmprorh_init() {
    	if ( ! function_exists( 'pmprorh_add_registration_field' ) ) {
    		return false;
    	}
    
    	// Define the fields.
    	$fields = array();
    	
    	$fields[] = new PMProRH_Field(
    		'talent_categories',				// input name, will also be used as meta key
    		'select',							// type of field
    		array(
    		'required'	=> true,				// make this field required
    		'profile'	=> false,				// do not only show in profile for admins
    		'levels'	=> array(6),
    		'label'		=> 'What type of talent are you registering?',			// custom field label
    		'options' => array(				// <option> elements for select field
    				''		=> 'Please select talent type',				// blank option - cannot be selected if this field is required
    				'Model'	=> 'Model',	// <option value="1</option>
    				'Actors'		=> 'Actors',	// <option value="2</option>
    				'Dancers'		=> 'Dancers',	// <option value="3</option>
    			)
    		)
    	);	
    
    	// Add the fields into a new checkout_boxes are of the checkout page.
    	foreach ( $fields as $field ) {
    		pmprorh_add_registration_field(
    			'checkout_boxes',				// location on checkout page
    			$field							// PMProRH_Field object
    		);
    	}
    
    	// That's it. 
    }
    add_action( 'init', 'my_pmprorh_init' );
    

    I now want to add this code to the above, so that it will set the users Ultimate Member status to ‘Pending Review’ directly after the new user registers in PMP.

            um_fetch_user( $user_id );
    		UM()->user()->pending();

    Can anyone help me to incorporate this code in my main script.

    Thanks in advance.

    Denis

    • This topic was modified 2 years, 9 months ago by den1sa.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter den1sa

    (@den1sa)

    I managed to integrate this code and it now sets a new user to Pending Review, but for some reason it is also setting the admin user to Pending Review.

    How can i prevent the admin user from being changed to Pending Review?

    function my_pmprorh_init() {
    	if ( ! function_exists( 'pmprorh_add_registration_field' ) ) {
    		return false;
    	}
    
    	// Define the fields.
    	$fields = array();
    	
    	$fields[] = new PMProRH_Field(
    		'talent_categories',				// input name, will also be used as meta key
    		'select',							// type of field
    		array(
    		'required'	=> true,				// make this field required
    		'profile'	=> false,				// do not only show in profile for admins
    		'levels'	=> array(6),
    		'label'		=> 'What type of talent are you registering?',			// custom field label
    		'options' => array(				// <option> elements for select field
    				''		=> 'Please select talent type',				// blank option - cannot be selected if this field is required
    				'Model'	=> 'Model',	// <option value="1</option>
    				'Actors'		=> 'Actors',	// <option value="2</option>
    				'Dancers'		=> 'Dancers',	// <option value="3</option>
    			)
    		)
    	);	
    
    //  ADDED HERE
        um_fetch_user( $user_id );
        UM()->user()->pending();
    
    	// Add the fields into a new checkout_boxes are of the checkout page.
    	foreach ( $fields as $field ) {
    		pmprorh_add_registration_field(
    			'checkout_boxes',				// location on checkout page
    			$field							// PMProRH_Field object
    		);
    	}
    
    	// That's it. 
    }
    add_action( 'init', 'my_pmprorh_init' );
    • This reply was modified 2 years, 9 months ago by den1sa.
    • This reply was modified 2 years, 9 months ago by den1sa.

    Hello @den1sa,

    Thank you for using Paid Memberships Pro.

    I’m not sure why the admin user is set to pending review, but you can reach out to our team for more technical support: https://www.paidmembershipspro.com/support/

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Register Helper incorporate code help’ is closed to new replies.