WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Registration and Login page

[Resolved] Registration and Login page

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi @WPPaton,

    I hope you are well today and thank you for your question.

    You can use [subscriptionform] membership plugin shortcode to display subscription form on the page but there currently there isn’t any shortcode to display login form, you can create a [login-form] shortcode to display login form by adding following code in functions.php file of your theme.

    add_shortcode( 'login-form', 'my_login_form_shortcode' );
    /**
     * Displays a login form.
     *
     * @uses wp_login_form() Displays the login form.
     */
    function my_login_form_shortcode( $atts, $content = null ) {
    
    	$defaults = array(		"redirect"				=>	site_url( $_SERVER['REQUEST_URI'] )
    						);
    
    		extract(shortcode_atts($defaults, $atts));
    		if (!is_user_logged_in()) {
    		$content = wp_login_form( array( 'echo' => false, 'redirect' => $redirect ) );
    		}
    	return $content;
    }

    Best Regards,

    WPPaton
    Member

    @wordpress-paton

    so just two questions: 1) Where would I place the shortcode? 2) Would this give both an option to register or login?

    Thanks for your help I appreciate it!

    Hi @WPPaton,

    Thanks for reply.

    1) Where would I place the shortcode?

    You should place the shortcodes in the Protected Content page where you want to display it.

    2) Would this give both an option to register or login?

    Yes, the [subscriptionform] shortcode will display subscription form and the [login-form] shortcode will display login form.

    Best Regards,

    WPPaton
    Member

    @wordpress-paton

    Tried adding your php code above in the functions.php file of the theme and it broke the website or logging into the back end. Could you take a look to make sure it isn’t missing anything?

    WPPaton
    Member

    @wordpress-paton

    it works but was hoping to get a registration form as well but thanks.

    Hi @WPPaton,

    Thanks for reply.

    Have you used [subscriptionform] shortcode to display registration form? If yes then have you faced any problem or get any error message?

    Best Regards,

    Hey there.

    We haven’t heard from you in awhile, so I just wanted to check in to make sure all was good.

    This thread was marked resolved, but please, if you still need help then just respond and open it back up. We can then take it from there. 🙂

    Hope you have a fantastic day!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Resolved] Registration and Login page’ is closed to new replies.