Membership Plugin

WordPress Membership Plugin

  • Home
  • Documentation
  • Addons
  • Support
    • Quick Setup
    • Documentation
    • Premium Addon Support
    • Paid Support
    • Support Forum
    • Support Forum Search
    • Forum Login
    • Forum Registration
  • Contact

[Resolved] [SOLVED] Mini Login will not redirect to previous page

Simple Membership Plugin › Forums › Simple Membership Plugin › [SOLVED] Mini Login will not redirect to previous page

Tagged: login mini_login redirect

  • This topic has 3 replies, 3 voices, and was last updated 6 years, 7 months ago by Nick Piggott.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • April 14, 2020 at 6:37 pm #20099
    Nick Piggott
    Participant

    The site is using the mini login shortcode to provide a login link within a partially protected page. The site has the Redirect After Login plugin installed and enabled.

    The URL to the login page from the mini login form does not contain the swmp_redirect_to parameter. Therefore, after a successful login, no redirect back to the original page takes place. The filter defined in the redirect plugin is not applied when creating the login_url for the mini login box.

    I adapted the code in /simple-membership/classes/shortcode-related/class.swpm-shortcodes-handler.php to add the parameter to the login URL. The code is amended at:

    Line 110 to add:

    
     		$current_uri = home_url( add_query_arg( NULL, NULL ) );
    

    Line 124 to amend:

    
                //User not logged in.
                $output .= '<span class="swpm_mini_login_login_here"><a href="'.$login_page_url.'?swpm_redirect_to='.$current_uri.'">'.SwpmUtils::_('Login Here').'</a></span>';
    

    Can I submit this to developers for a proper patch?

    Nick

    April 16, 2020 at 10:24 am #20107
    mbrsolution
    Moderator

    Thank you for sharing your solution. I have submitted a message to the developers to investigate further your patch.

    Kind regards

    April 17, 2020 at 3:24 am #20123
    admin
    Keymaster

    Thank you. What you have done looks good. However, it is probably better to use the following existing filter of the plugin to handle this.

    apply_filters( ‘swpm_get_login_link_url’, $login_url )

    I have updated the plugin’s code so the mini login shortcode will respect the “Redirection to Last Page” feature. The next release of the plugin will have this update.

    April 17, 2020 at 9:02 am #20125
    Nick Piggott
    Participant

    Great, thank you for fixing this upstream. I’ll advise that the plugin can be updated without regressing the fixed behaviour.

  • Author
    Posts
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Log In

Please read this message before using our plugin.

Search

Featured Addons and Extensions

  • Membership Form Builder Addon
  • Member Directory Listing Addon
  • WooCommerce Payment Integration
  • Member Data Exporter Addon

Documentation

  • Documentation Index Page

Copyright © 2026 | Simple Membership Plugin | Privacy Policy