• Resolved toologic

    (@toologic)


    After user authorization, the login link is replaced (redirected) with an account link.
    I want the link to be replaced(redirected) with a profile link.
    How to do it?
    I think the plugin should have a setting to define what to change the login link to.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hi,

    Are you log in from the popup? If yes then it will just reload the page so you don’t get redirected anywhere for login. If you are using the page then it will redirect to the URL based on the setting UsersWP->General->Login->Login Redirect Page. You can change the setting as per your requirement.

    Regards,
    Patrik

    Thread Starter toologic

    (@toologic)

    No, I’m not talking about that.

    I have a link to a login page in a menu (for example href=/login/ ). If the user is not logged in, then he goes to this page. But if he is already authorized, then when clicking on this link, he is redirected to the account page. And I want to be redirected to the profile page.

    Hi,

    You can do it by adding menu items from our UsersWP Endpoints in the menu. You can add login, register, account and profile links from our endpoints. Those menu items will display based on the user login state. If user is logged in then he will not see the login and register link and if not logged in then he will not see the account and profile link. See our recent support ticket if it can help: https://www.ads-software.com/support/topic/can-i-add-wordpress-a-menu-item-according-to-user-authentication-state/

    Regards,
    Patrik

    Thread Starter toologic

    (@toologic)

    Now I do not use any endpoints, I just have a link to the login page, from which the user goes to different URLs depending on the state of his authorization. I want to know how it works and is it possible to change the target?

    Perhaps having multiple endpoints in the menu is the correct and simple solution. But I want to get by with one link – “personal room”. It will open either the login page or the profile page (not the account) if the user is already logged in.

    Plugin Contributor Paolo

    (@paoltaia)

    You can do that easily with endpoints.

    Add both the login menu item and the profile menu item and change the Navigation Label to be the same for both.

    The login link will only be visible to logged-out users and the profile link will only be visible to logged-in users.

    Thanks

    Thread Starter toologic

    (@toologic)

    I had to look for it myself.
    In the UserWP_Template class, lines 82 and 88 are what I was asking about.

    if (is_user_logged_in()) {
         $redirect_page_id = uwp_get_page_id('account_page', false);

    and later
    $redirect_to = apply_filters('uwp_logged_in_redirect', $redirect_to);

    Thanks and this is good idea to include redirect page as settings in next versions.

    Plugin Contributor Paolo

    (@paoltaia)

    In UsersWP > Login > Login Redirect Page you can select where to redirect users after login.

    Hi,

    That code is for checking if logged in user tries to access the login/register page then it will redirect to the account page. If this is what you are looking for changing then you can use the filter ‘uwp_logged_in_redirect’ and modify the URL. We follow the general scenario and that’s why we provided filter if someone wants to change.

    Regards,
    Patrik

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘How to change login link target for logged-in users’ is closed to new replies.