- This topic has 3 replies, 3 voices, and was last updated 6 years, 7 months ago by .
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.
WordPress Membership Plugin
Simple Membership Plugin › Forums › Simple Membership Plugin › [SOLVED] Mini Login will not redirect to previous page
Tagged: login mini_login redirect
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
Thank you for sharing your solution. I have submitted a message to the developers to investigate further your patch.
Kind regards
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.
Great, thank you for fixing this upstream. I’ll advise that the plugin can be updated without regressing the fixed behaviour.