Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

i have installed the theme-my-login plugin and i want change the password_fields function: this is the code of custom-password.php of the plugin:

     /**
 * Loads the module
 *
 * @since 6.0
 * @access protected
 */
protected function load() {
    add_action( 'register_form',       array( &$this, 'password_fields' ) );
    add_filter( 'registration_errors', array( &$this, 'password_errors' ) );
    add_filter( 'random_password',     array( &$this, 'set_password'    ) );

    add_action( 'signup_extra_fields',       array( &$this, 'ms_password_fields'       ) );
    add_action( 'signup_hidden_fields',      array( &$this, 'ms_hidden_password_field' ) );
    add_filter( 'wpmu_validate_user_signup', array( &$this, 'ms_password_errors'       ) );
    add_filter( 'add_signup_meta',           array( &$this, 'ms_save_password'         ) );

    add_action( 'tml_new_user_registered', array( &$this, 'remove_default_password_nag' ) );
    add_action( 'approve_user',            array( &$this, 'remove_default_password_nag' ) );

    add_filter( 'tml_register_passmail_template_message', array( &$this, 'register_passmail_template_message' ) );
    add_action( 'tml_request',                            array( &$this, 'action_messages'                    ) );

    add_filter( 'registration_redirect', array( &$this, 'registration_redirect' ) );
}

/**
 * Outputs password fields to registration form
 *
 * Callback for "register_form" hook in file "register-form.php", included by Theme_My_Login_Template::display()
 *
 * @see Theme_My_Login::display()
 * @since 6.0
 * @access public
 */
public function password_fields() {
    $template =& Theme_My_Login::get_object()->get_active_instance();
    ?>
    <p><label for="pass1<?php $template->the_instance(); ?>"><?php _e( 'Password' ); ?></label>
    <input autocomplete="off" name="pass1" id="pass1<?php $template->the_instance(); ?>" class="input" size="20" value="" type="password" /></p>
    <p><label for="pass2<?php $template->the_instance(); ?>"><?php _e( 'Confirm Password', 'theme-my-login' ); ?></label>
    <input autocomplete="off" name="pass2" id="pass2<?php $template->the_instance(); ?>" class="input" size="20" value="" type="password" /></p>
    <?php
}

in functions.php i have added this but not working:

     function init_wp() {

// remove parent theme's header content action
remove_action('register_form', 'password_fields');

// add child theme's header content action
add_action('register_form', 'cust_password_fields');

     }
     add_action('init', 'init_wp');

function cust_password_fields(){

}

any ideas ?

share|improve this question
    
This is a plain PHP problem: Class vs. function. function_name vs. array( $this, 'method_name' ) or in other words: array( 'Class_Name', 'method_name' );. Close voting as off topic. Please consult php.net and SO for further info about this topic. –  kaiser Jan 25 at 13:31
add comment

1 Answer

up vote 0 down vote accepted

Thank you kaiser, your comment is helpful but insufficient, so the solution is :

to remove function in other class in wordpress :

    remove_action('register_form', array(Theme_My_Login_Custom_Passwords::get_object(),'password_fields' ) );

Thank you

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.