• Resolved Erfan MHDi

    (@erfanmhd)


    hello,
    i’m trying to add <label> to input filed inside password recovery page,
    i have tried overriding the password-reset.php file but as UM is generating this field from predefiend_fields Function inside class-buildin.php file i think i have to override the field attr inside my theme function.

    pardon my code but this is what i got so far:

    function set_predefined_fields(){
    
    	global $ultimatemember;
    	
    	if ( !isset( $ultimatemember->query ) || ! method_exists( $ultimatemember->query, 'get_roles' ) ) {
    		return;
    	} else {
    		//die('Method loaded!');
    	}
    	
    	$um_roles = $ultimatemember->query->get_roles( false, array('admin') );
    	
    	$profile_privacy = apply_filters('um_profile_privacy_options', array( __('Everyone','ultimate-member'), __('Only me','ultimate-member') ) );
    	
    	$this->predefined_fields = array(
    
    		
    		'username_b' => array(
    			'title' => 'tst',
    			'metakey' => 'username_b',
    			'type' => 'text',
    			'placeholder' => 'test',
    			'required' => 1,
    			'public' => 1,
    			'editable' => 0,
    			'private_use' => true,
    		),
    		
    		
    	
    	);
    	$this->predefined_fields = apply_filters('um_predefined_fields_hook', $this->predefined_fields );
    
    }

    can you guys help me complete this?
    my goal is to recreate a .um-field box with label and etc… like registration or login form.

    • This topic was modified 4 years, 1 month ago by Erfan MHDi.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @erfanmhd

    Using the global variable $ultimatemeber is obselete.

    Please try using UM() class.

    function set_predefined_fields(){
    
    	if ( !isset( UM()->query ) || ! method_exists( $ultimatemember->query, 'get_roles' ) ) {
    		return;
    	} else {
    		//die('Method loaded!');
    	}
    	
    	$um_roles =  UM()->query()->get_roles( false, array('admin') );
    	
    	$profile_privacy = apply_filters('um_profile_privacy_options', array( __('Everyone','ultimate-member'), __('Only me','ultimate-member') ) );
    	
    	$this->predefined_fields = array(
    
    		
    		'username_b' => array(
    			'title' => 'tst',
    			'metakey' => 'username_b',
    			'type' => 'text',
    			'placeholder' => 'test',
    			'required' => 1,
    			'public' => 1,
    			'editable' => 0,
    			'private_use' => true,
    		),
    		
    		
    	
    	);
    	$this->predefined_fields = apply_filters('um_predefined_fields_hook', $this->predefined_fields );
    
    }
    

    I haven’t tested the above code but it should let you give an idea with the usage of the new class. Feel free to re-open this thread by marking this unresolved.

    Regards,

    Thread Starter Erfan MHDi

    (@erfanmhd)

    Hello,
    Thanks for your reply,
    but no chance with UM() class too.
    can you please take a closer look into it ?

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @erfanmhd

    Sorry i missed something in the condition.

    Please change it from
    if ( !isset( UM()->query ) || ! method_exists( $ultimatemember->query, 'get_roles' ) )

    to
    if ( !isset( UM()->query ) )

    Regards,

    Thread Starter Erfan MHDi

    (@erfanmhd)

    Hi @champsupertramp,
    Thanks for your response,
    but still i cannot change placeholder or add any label to username field inside password recovery page.

    here is my full code:

    
    function set_predefined_fields(){
    
    	if ( !isset( UM()->query ) ) {
    		return;
    	} else {
    		//die('Method loaded!');
    	}
    	
    	$um_roles =  UM()->query()->get_roles( false, array('admin') );
    	
    	$profile_privacy = apply_filters('um_profile_privacy_options', array( __('Everyone','ultimate-member'), __('Only me','ultimate-member') ) );
    	
    	$this->predefined_fields = array(
    
    		
    		'username_b' => array(
    			'title' => 'tst',
    			'metakey' => 'username_b',
    			'type' => 'text',
    			'placeholder' => 'test',
    			'required' => 1,
    			'public' => 1,
    			'editable' => 0,
    			'private_use' => true,
    		),
    		
    		
    	
    	);
    	$this->predefined_fields = apply_filters('um_predefined_fields_hook', $this->predefined_fields );
    
    }
    

    is there any other problem with this code?

    Thread Starter Erfan MHDi

    (@erfanmhd)

    hello @champsupertramp,

    did you got time to take a look into this ?
    i’m really looking forward to here from you …

    out

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Add Label to Password Recovery Input Field’ is closed to new replies.