Forums

SimpleModal Login
[resolved] No generated password, Users must enter their own password (8 posts)

  1. Sina Saeedi
    Member
    Posted 1 year ago #

    I want users choose their own passwords during registration like "Modal Register" plugin.
    I modyfied registration_form function like this:

    function registration_form() {
    			$output .= sprintf('
    <form name="registerform" id="registerform" action="%s" method="post">
    	<div class="title">%s</div>
    	<div class="simplemodal-login-fields">
    	<p>
    		<label>%s<br />
    		<input type="text" name="user_login" class="user_login input" value="" size="20" tabindex="10" /></label>
    	</p>
    	<p>
    		<label>%s<br />
    		<input type="text" name="user_email" class="user_email input" value="" size="25" tabindex="20" /></label>
    	</p>
    	<p>
    		<label>%s<br />
    		<input type="password" name="password" id="register-pass" class="user_pass input" value="" size="20" tabindex="30" /></label>
    	</p>
    	<p>
    		<label>%s<br />
    		<input type="password" name="re_password" id="register-re-pass" class="user_pass input" value="" size="20" tabindex="31" /></label>
    	</p>',
    				site_url('wp-login.php?action=register', 'login_post'),
    				__('Register', 'simplemodal-login'),
    				__('Username', 'simplemodal-login'),
    				__('E-mail', 'simplemodal-login'),
    				__('Password', 'simplemodal-login'),
    				__('Retype Password', 'simplemodal-login')
    			);
    
    			do_action('register_form');
    
    			$output .= sprintf('
    	<p class="submit">
    		<input type="submit" name="wp-submit" value="%s" tabindex="100" />
    		<input type="button" class="simplemodal-close" value="%s" tabindex="101" />
    	</p>
    	<p class="nav">
    		<a class="simplemodal-login" href="%s">%s</a>',
    				__('Register', 'simplemodal-login'),
    				__('Cancel', 'simplemodal-login'),
    				site_url('wp-login.php', 'login'),
    				__('Log in', 'simplemodal-login')
    			);
    
    			if ($this->options['reset']) {
    				$output .= sprintf(' | <a class="simplemodal-forgotpw" href="%s" title="%s">%s</a>',
    					site_url('wp-login.php?action=lostpassword', 'login'),
    					__('Password Lost and Found', 'simplemodal-login'),
    					__('Lost your password?', 'simplemodal-login')
    				);
    			}
    
    			$output .= '
    	</p>
    	</div>
    	<div class="simplemodal-login-activity" style="display:none;"></div>
    </form>';
    
    			return $output;
    		}

    Now I cant find a function that runs wp_create_user.
    Can you tell me how the registration system works in ths plugin?

    It can be an option in next releases:
    1) Users choose their own passwords
    2) Send generated password to email given

  2. Sina Saeedi
    Member
    Posted 1 year ago #

    any idea?

  3. Sina Saeedi
    Member
    Posted 1 year ago #

    I found a solution.
    1) Install Register Plus Plugin
    2) Go to Register Plus Settings in the Admin->Setting->Register Plus
    3) Check Allow New Registrations to set their own Password
    4) Set CAPTCHA on None
    5) Go to /wp-content/plugins/simplemodal-login/simplemodal-login.php and find function registration_form()
    6) Change it like this:

    function registration_form() {
    			$output .= sprintf('
    <form name="registerform" id="registerform" action="%s" method="post">
    	<div class="title">%s</div>
    	<div class="simplemodal-login-fields">
    	<p>
    		<label>%s<br />
    		<input type="text" name="user_login" class="user_login input" value="" size="20" tabindex="10" /></label>
    	</p>
    	<p>
    		<label>%s<br />
    		<input type="text" name="user_email" class="user_email input" value="" size="25" tabindex="20" /></label>
    	</p>
    	<p>
    		<label>%s<br />
    		<input type="password" name="pass1" class="user_pass input" value="" size="20" tabindex="20" /></label>
    	</p>
    	<p>
    		<label>%s<br />
    		<input type="password" name="pass2" class="user_pass input" value="" size="20" tabindex="30" /></label>
    	</p>',
    				site_url('wp-login.php?action=register', 'login_post'),
    				__('Register', 'simplemodal-login'),
    				__('Username', 'simplemodal-login'),
    				__('E-mail', 'simplemodal-login'),
    				__('Password', 'simplemodal-login'),
    				__('Retype Password', 'simplemodal-login')
    			);
    
    			do_action('register_form');
    
    			$output .= sprintf('
    	<p class="submit">
    		<input type="submit" name="wp-submit" value="%s" tabindex="100" />
    		<input type="button" class="simplemodal-close" value="%s" tabindex="101" />
    	</p>
    	<p class="nav">
    		<a class="simplemodal-login" href="%s">%s</a>',
    				__('Register', 'simplemodal-login'),
    				__('Cancel', 'simplemodal-login'),
    				site_url('wp-login.php', 'login'),
    				__('Log in', 'simplemodal-login')
    			);
    
    			if ($this->options['reset']) {
    				$output .= sprintf(' | <a class="simplemodal-forgotpw" href="%s" title="%s">%s</a>',
    					site_url('wp-login.php?action=lostpassword', 'login'),
    					__('Password Lost and Found', 'simplemodal-login'),
    					__('Lost your password?', 'simplemodal-login')
    				);
    			}
    
    			$output .= '
    	</p>
    	</div>
    	<div class="simplemodal-login-activity" style="display:none;"></div>
    </form>';
    
    			return $output;
    		}
  4. akehat
    Member
    Posted 1 year ago #

    why update the function registration_form()?
    What's the benefit?

  5. Sina Saeedi
    Member
    Posted 1 year ago #

    Do you have a better idea?

  6. Eric Martin
    Member
    Posted 1 year ago #

    Instead of modifying the code in the plugin directly, you should use a filter. See example: http://pastebin.com/bVzZBKZf

  7. Cubikated
    Member
    Posted 1 year ago #

    Hi guys,

    I love this plugin. I'm new to WordPress and PHP so have no idea to what all these code means.

    I'm want to add more fields to the registration form like First/Last Name and most importantly want the user to type in a password and the password to be e-mailed to the user. Something like the Register Plus Redux plugin. Only if I could get the SML to pop up with all those custom extra fields would be just great!
    Any tips????? Like I said before I'm taking my first steps....so any simple explanation would be appreciated :)

    Thanks

    p.s Eric any plans of updating "add the custom fields" function to the SML settings?

  8. jskdn
    Member
    Posted 6 months ago #

    Hey Eric, Love this plugin.. just want to finalise one thing with it (having the user set their own passwords)
    I posted your solution into my functions file but there are no password fields in it?
    I tried entering my own ones but they were no good. Here is what I entered.. any ideas??? Thanks

    // SIMPLEMODAL REGISTRATION FORM
        add_filter('simplemodal_registration_form', 'mytheme_registration_form');
        function mytheme_registration_form($form) {
                $options = get_option('simplemodal_login_options');
    
                $output = sprintf('
                <form name="registerform" id="registerform" action="http://localhost/mysite/wp-login.php?action=register" method="post">
                <div class="title">My Website Login!</div>
                <div class="simplemodal-login-fields">
                <p>
                        <label>User Login<br />
                        <input type="text" name="user_login" class="user_login input" value="" size="20" tabindex="10" /></label>
                </p>
                <p>
                        <label>E-Mail Address<br />
                        <input type="text" name="user_email" class="user_email input" value="" size="25" tabindex="20" /></label>
                </p>
            <p>
    		<label>Enter password<br />
    		<input type="password" name="user_pass" class="user_pass input" value="" size="20" tabindex="20" /></label>
    	</p>
    	<p>
    		<label>Re-enter password<br />
    		<input type="password" name="user_pass" class="user_pass input" value="" size="20" tabindex="30" /></label>
    	</p>',
                        __('http://localhost/mysite/wp-login.php?action=register', 'login_post'),
                        __('Register', 'simplemodal-login'),
                        __('Username', 'simplemodal-login'),
                        __('E-mail', 'simplemodal-login'),
                        __('Password', 'simplemodal-login'),
    					__('Retype Password', 'simplemodal-login')
                );
    
                ob_start();
                do_action('register_form');
                $output .= ob_get_clean();
    
                $output .= sprintf('
                <p class="reg_passmail">%s</p>
                <p class="submit">
                        <input type="submit" name="wp-submit" value="%s" tabindex="100" />
                        <input type="button" class="simplemodal-close" value="%s" tabindex="101" />
                </p>
                <p class="nav">
                        <a class="simplemodal-login" href="%s">%s</a>',
                        __('A password will be e-mailed to you.', 'simplemodal-login'),
                        __('Register', 'simplemodal-login'),
                        __('Cancel', 'simplemodal-login'),
                        site_url('', 'login'),
                        __('Log in', 'simplemodal-login')
                );
    
                if ($options['reset']) {
                        $output .= sprintf(' | <a class="simplemodal-forgotpw" href="%s" title="%s">%s</a>',
                                site_url('wp-login.php?action=lostpassword', 'login'),
                                __('Password Lost and Found', 'simplemodal-login'),
                                __('Lost your password?', 'simplemodal-login')
                        );
                }
    
                $output .= '
                </p>
                </div>
                <div class="simplemodal-login-activity" style="display:none;"></div>
        </form>';
    
                return $output;
        }

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic