Support » Plugin: Paid Memberships Pro - Register Helper Add On » Deliver profile fields to admin without saving to database

  • yewzy

    (@yewzy)


    Hi,

    First of all, thanks for an amazing and flexible plugin.

    Some context, for members who choose to renew by check, we would like them to submit a picture of their check and a few other receipt details before checkout.

    Thus, this field data does not need to be saved in the database and made available to the user as it will cause confusion the second time the user renews their membership (as the image of the previous check will appear).

    I have attempted to use the ‘save_function’, with the (trimmed) code below:

    
    function my_pmprorh_init() {
    
    	if ( ! function_exists( 'pmprorh_add_registration_field' ) ) {
    		return false;
    	}
    
    	$fields = array();
    
    $fields[] = new PMProRH_Field(
    		'receipt_bank',		
    		'text',						
    		array(
    			'label'		=> 'Name of Bank',		
    			'size'		=> 15,				
    			'required'	=> true,			
    			'profile' => 'admin',
    			'save_function' => 'pmpro_delete_info',
    		)
    	);
    
    add_action( 'init', 'my_pmprorh_init' );
    
    function pmpro_delete_info ($user_id, $field_name, $field_value ) {
    		
    delete_user_meta ($user_id, $field_name, $field_value);
    		
    }

    However, by using this save_function, the data from the field is not delivered to the ‘Membership Checkout’ email notification, with only !!receipt_bank!! being sent.

    I am not sure if this is me barking at the wrong tree by (mis)using the save_function, or it is just due to my terrible coding skills.

    I’ll really appreciate if someone can point me to the right direction. Thanks!

  • You must be logged in to reply to this topic.