[Membership 2 Pro] Redirect to website builder on login Membership 2

Hi,
I talked a couple of days ago to one of your live chat superheroes about a weird problem where on login I am being redirected to bookmark.com. I thought it was because the domain is on a test server and accessed via local hosts, and the guy had the same thing (but arrived at a different website).

However, I've transferred it to my test domain (www.imustardtest.co.uk), which is publicly visible, and I'm still getting the same issue. Please look into this as it's freaking me out!

Thanks,
Arthur

  • Kasia Swiderska

    Hello Arthur,

    How can I replicate this issue? I tried login three times - from login form on account page, from /wp-admin and login form on home page sidebar widget.
    All times I was still on your site. There was no redirects to other sites.

    Only thing I changed was to remove example url in Redirect Add-on in Membership 2 Pro settings. There was inserted this url: http://yourdomain.com/members/username/profile (exactly in this form)

    Please also note there is new update for Membership 2 Pro.

    kind regards,
    Kasia

  • Kasia Swiderska

    Hello Arthur,

    Still don't know why it's happening on the test server but still.

    So you have another site with that? Can you check what do you see in Redirect URL add-on:

    I know it's off-topic, but speaking of the redirect URL after login, is there any way of redirecting people to the page they were reading?

    Membership does that by default. User access page that is protected by membership and they are redirected to login form, after they login they are back to page were they were before.
    I tested that and it works that way on your site. I tried page "Welcome to your ACG Training Member's page!".

    Or do you have something else on mind?

    kind regards,
    Kasia

  • Arthur

    Hi Kasia,

    Sorry, missed this one trying to fix the other issues.

    So you have another site with that? Can you check what do you see in Redirect URL add-on:

    It happens on my development site on the actual domain (which is still with another company/system so the new site is accessed via local hosts, so I have a test site on a live test domain, imustardtest).

    On the Redirect URL...I've just realised I've been a total goof! I copied the example but forgot to change the domain name from yourdomain.com...doh! I've now done that: http://applied-corporate-governance.com/members/username/profile but am getting a 404 (progress - at least I'm not being redirected elsewhere!).

    I only (tried to) set it to user profile, though, because it was directing all the time to the Account page and I prefer the profile page, where I've added additional fields.

    Membership does that by default. User access page that is protected by membership and they are redirected to login form, after they login they are back to page were they were before.

    So this doesn't happen. I don't know how you found the training membership page from not being logged in, as it's not linked anywhere, but I'm talking about finding an article that's protected, e.g.

    http://www.imustardtest.co.uk/archive/how-organisational-stress-affects-corporate-governance/

    I'd like them to be able to register then go back to that page on login (or if they are already registered, but not logged in, of course).

    Thanks!
    Arthur

  • Kasia Swiderska

    Hello Arthur,

    I've now done that: http://applied-corporate-governance.com/members/username/profile but am getting a 404 (progress - at least I'm not being redirected elsewhere!).

    It should be [username] instead of only username - so after login this will be replaced with actual username of the logged user.

    . I don't know how you found the training membership page from not being logged in, as it's not linked anywhere, but I'm talking about finding an article that's protected, e.g.

    Support access was open, so I could check what pages are protected and then test them.

    I'd like them to be able to register then go back to that page on login (or if they are already registered, but not logged in, of course).

    That type of redirect only works when user is already in system so they need only to login. When they need to register and join membership then that redirect back is not present. I believe this was raised once to developer and it might be introduced in future version of the plugin (however I will check with devs about that to be sure).

    kind regards,
    Kasia

  • Arthur

    Thanks Kasia,

    I don't know why it copied it without, but I did indeed put the square brackets and it's redirecting with the brackets, instead of replacing it with the actual username. See the screenshot.

    Actually, I've just realised while continuing testing and looking, that if I manually replace the [username] with a test username, I still get a 404:
    http://www.imustardtest.co.uk/members/arthur/profile

    This means there is no public profile page and the only way to access your details is via the edit account details page /account/?action=edit_profile

    By the way, I removed the redirect URL so I could test what you were saying about standard behaviour of redirect...:

    Membership does that by default. User access page that is protected by membership and they are redirected to login form, after they login they are back to page were they were before.

    ...and it doesn't - it still goes to the account page. I even tried disabling the Redirect Control add-on.

    Two things occur to me, therefore.

    1. Registered but not logged in members: why aren't I being redirected back to the page I was reading as you seemed to experience? Please test again on an example article that people would actually see, e.g. http://www.imustardtest.co.uk/archive/brexit-referendum-was-this-good-governance-part-2/

    2. Unregistered users: how can I change the default redirect page on registration to their profile page instead of the account page? The account page has a menu link but I want people to see and fill in their profile. As I said earlier, there doesn't seem to be a profile page, or I could potentially put a link somewhere, and I don't want to rely on them clicking the edit details, which doesn't imply there is a richer profile.

    I would also like to have that new registration profile redirect without changing the redirect for registered members who were trying to read an article unlogged in, but it seems that by changing the Redirect URL, it changes it for everyone.

    So, if this is how the system is built, and doesn't currently have this flexibility of having different URLs for registering members and already registered members, I think I would like to focus on getting the "take me back to the article I was reading" working rather than the "redirect to profile" - when a new member registers, the account page is a logical enough place to be directed.

    Support access is already enabled if you could have a look...

    Many thanks,
    Arthur

  • Kasia Swiderska

    Hello Arthur,

    Actually, I've just realised while continuing testing and looking, that if I manually replace the [username] with a test username, I still get a 404:
    http://www.imustardtest.co.uk/members/arthur/profile

    This means there is no public profile page and the only way to access your details is via the edit account details page /account/?action=edit_profile

    I just realized that you don't have BuddyPress plugin installed. http://www.imustardtest.co.uk/members/arthur/profile - is link to profile created in BuddyPress. Membership 2 Pro by it's own doesn't have any profiles - there is only account page for member.
    To have profiles you need BuddyPress.

    1. Registered but not logged in members: why aren't I being redirected back to the page I was reading as you seemed to experience? Please test again on an example article that people would actually see, e.g. http://www.imustardtest.co.uk/archive/brexit-referendum-was-this-good-governance-part-2/

    Okey, I checked settings you have and compared to settings on my site and I see whats going on.
    So when I tested that page on your site, it was working because it was whole page protected, so by default it was displaying form on the Protected Content page, which has already redirect in URL included... So this will work for whole protected posts, pages and other types of content.
    But your posts are protected by shortcodes and login form comes from widget... and it doesn't have that redirect like Protected Content :slight_frown: - it has in-build automatic redirect to account page.
    That is why this is not redirecting on your posts.

    I'm checking with developer if there is any workaround or a simple way to turn of redirect from login widget to account page and just refresh page.
    We are testing some options, but not available solution yet.

    2. Unregistered users: how can I change the default redirect page on registration to their profile page instead of the account page?

    There is no option for that. But - when they register and join membership they do need to see a Thank you page. Where is link usually to Account page.
    But you can actually create a custom page for Thank you page and there you could put a link to profile (after you will install BuddyPress).
    It is described in Help section of the Help in Membership 2 /wp-admin/admin.php?page=membership2-help&tab=branding

    kind regards,
    Kasia

  • Arthur

    Hi Kasia,

    Thanks for the detailed response.

    1. Profile/BuddyPress
    My original intention was to have BuddyPress, I've been using it since the early (cool, but often painful!) days and wanted to create more of a community site. But, at least in my original test, the site became too slow, so I gave up. Once the site is live I will look into it again on my new theme, which in theory is fast (though I deliberately used Twenty Sixteen at the time to keep things simple and quick).

    I had assumed that since I enabled the Profile Fields add-on in Membership 2, there would be a profile page. If not, the add-on seems pointless - why have extra fields if they are not visible and you have to use BuddyPress (which has much better profile functionality) anyway?

    2. Redirect for registered users
    Yes, Adam has sorted me out with some great code for allowing an excerpt to be shown rather than hiding the whole page - I hope this will make it into the core plugin code so we can get it as an option - and also make the redirection work as normal.

    Meanwhile, I'll be grateful for anything the developers can do to work around it.

    3. Redirect for non-regiestered users/Thank you page
    Good suggestion, I'll probably do that.

    Thanks again!
    Arthur

  • Kasia Swiderska

    Hello Arthur,

    I had assumed that since I enabled the Profile Fields add-on in Membership 2, there would be a profile page. If not, the add-on seems pointless - why have extra fields if they are not visible and you have to use BuddyPress (which has much better profile functionality) anyway?

    Profile fields are actually used for controlling what profile fields (by default one from WordPress user profile) are displayed on registration form and account page. So its not for creating profile, but but reusing whats already in the system.
    It's used more for site owners to get the additional information about their users.

    Meanwhile, I'll be grateful for anything the developers can do to work around it.

    Please try this code:

    <?php
    add_filter( 'ms_url_after_login', function( $login_url ) {
        return $_SERVER["HTTP_REFERER"];
    }, 999 );

    You can use it as Must Use plugin https://codex.wordpress.org/Must_Use_Plugins - I did few initial tests and it allowed to redirect back to page protected by shortcode.

    kind regards,
    Kasia

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.