我已经安装了主题我的登录插件,我想更改password\\u fields功能:这是自定义密码的代码。插件的php:
/**
* 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
}
在函数中。php我添加了以下内容,但不起作用:
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(){
}
有什么想法吗?