Change the HTML of Password confirmation and Beta Test Code

Hi !

I have installed the "Set Password" and "Signup Code" plugins and I would like to change the HTML that is generated by these 2 plugins. For example I would like a extra container around the "Leave fields blank for a random password to be generated." phrase (by the way, what you did is not semantic at all. This phrase is inside the form, with no <p> container or <span> ro something else).

I don't want to edit the plugin code because I need it to be updatable. Is there a hook or a way of doing that ?

Thanks a lot :slight_smile: !

  • Vaughan

    Hi @noomia,

    Thanks for your feedback, currently there are no hooks to allow you to do this without editing the plugin code.

    I can certainly add this to the feature requests for the developer to look at including in a future update.

    The place you would do it in the Set Password plugin is below

    Find:

    function signup_password_fields($errors) {
    	global $signup_password_form_printed;
    
    	if ($errors && method_exists($errors, 'get_error_message')) {
    		$error = $errors->get_error_message('password_1');
    	} else {
    		$error = false;
    	}
    	$signup_password_form_printed = 1;
    	?>
        <label for="password"><?php _e('Password', 'signup_password'); ?>:</label>
    		<?php
            if($error) {
    			echo '<p class="error">' . $error . '</p>';
            }
    		?>
    		<input name="password_1" type="password" id="password_1" value="" autocomplete="off" maxlength="20" /><br />
    		(<?php _e('Leave fields blank for a random password to be generated.', 'signup_password') ?>)
        <label for="password"><?php _e('Confirm Password', 'signup_password'); ?>:</label>
    		<input name="password_2" type="password" id="password_2" value="" autocomplete="off" maxlength="20" /><br />
    		(<?php _e('Type your new password again.', 'signup_password') ?>)
    	<?php
    }

    Then add the <p> or <span> tags around the following:

    <span class="pass_random">(<?php _e('Leave fields blank for a random password to be generated.', 'signup_password') ?>)</span>

    Hope this helps

  • Noomia

    Hi Vaughan :slight_smile: !

    Thanks for your answer. Finally, with some further investigation, it seems that I've found the right HOOKS.

    The function you gave me 'signup_password_fields' is related to this hook, at the beginning of 'signup-password.php' :

    add_action('signup_extra_fields', 'signup_password_fields');

    So, in my functions.php, here is what I did :

    remove_action('signup_extra_fields', 'signup_password_fields',10);
    
    add_action('signup_extra_fields', 'signup_password_fields_custom',10);
    
    function signup_password_fields_custom($errors) { my modified code }

    This way, I can add what I want in the default HTML, directly in my functions.php :slight_smile:

    I did exactly the same for the "Anti-splog" and "Signup TOS" plugins.

    Thanks,

    Noomia !

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.