WordPress.org

Ready to get started?Download WordPress

Forums

User Access Manager
[resolved] Redirect user not working. (15 posts)

  1. dave9621
    Member
    Posted 1 year ago #

    I’m using your plugin and I’m having one problem. When I change the setting “Redirect user” to a custom page OR a custom URL the page that is protected no longer loads. When I switch back to “None” it works perfectly. Any ideas of how to fix this? It’s key to my usage.
    Thanks for any help you can lend.

    http://wordpress.org/extend/plugins/user-access-manager/

  2. cartu73
    Member
    Posted 1 year ago #

    I have the same problem, redirect doesn't work :-(

  3. Marco
    Member
    Posted 1 year ago #

    I have the same problem, redirect doesn't work!!!

  4. Downpour93
    Member
    Posted 1 year ago #

    I am having the same problem. My browser give me an error saying it is trying to redirect too many times in a row

  5. GM_Alex
    Member
    Plugin Author

    Posted 1 year ago #

    Should be solved with the current version.

  6. Nicko Che
    Member
    Posted 1 year ago #

    Sorry, dear GM_Alex, redirect user does not work with UAM 1.2.4.3

  7. GM_Alex
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    could you provide some more detailed information?

    Greetings,
    Alex

  8. Nicko Che
    Member
    Posted 1 year ago #

    OK, but sorry my google english )

    There is a page designed for a group of users - http://expertbaby.ru/nashi-kursyi/sekretyi-vospitaniya-otvetstvennogo-rebenka/
    (By the way, here is protected only by the main text, but not the sidebar, and it may be unique for this page.)
    Here, the page where I need to redirect unauthorized user - http://expertbaby.ru/blockedpage/.
    Now everything is set up that way, but as you can see, nothing works.

    And no matter what the settings are set to Redirect User. Does not work redirect to the home page or a custom page or a custom URL.

    I read somewhere and tried to fix for an experiment - line 298 of user-access-manager.php:
    add_action ('template_redirect', array ($oUserAccessManager, 'redirect'), 10);
    the redirection works, but found a problem with a page templates - always use a basic template, regardless of the selected template of the page.

    In all other respects your plugin works fine, thank you very much!

  9. Nicko Che
    Member
    Posted 1 year ago #

    Dear Alex, do you have any thoughts on this?
    Do you need any more information?
    Perhaps if we think about it all together, the right solution will come faster? )

  10. GM_Alex
    Member
    Plugin Author

    Posted 1 year ago #

    At the moment I'm busy at my work, I will check it at the weekend.

  11. eldenroot
    Member
    Posted 1 year ago #

    Same problem, it only shows the text - You have no permissions to view this page...

    but it doesnt redirect the user to the page which I set...

    thank you for the fix

  12. Nicko Che
    Member
    Posted 1 year ago #

    I found something like that:
    Redirect works with a default URL of post/page like "site/?p=123" and does not work with a permanent link like "site/link_of_page".

  13. frene7ik
    Member
    Posted 1 year ago #

    I was having the same issue (redirect works with default URL, not with permalinks).

    I found this older post describing a code change, but couldn't apply it as-is because it refers to an older version of UAM.

    However, below change in UserAccessManager.class.php, public function redirect does solve the issue for me:

    } elseif (isset($oPageParams->query_vars['name'])) {
    		// frene7ik 20130516
                    //$oObject = get_page_by_title($oPageParams->query_vars['name'], OBJECT, 'post');
    		$oObject = get_page_by_path($oPageParams->query_vars['name'], OBJECT, 'post');	
    
                    if ($oObject !== null) {
                        $oObjectType = $oObject->post_type;
                        $iObjectId = $oObject->ID;
                    }
  14. Nicko Che
    Member
    Posted 1 year ago #

    Thank you very much, frene7ik!
    Your solve really works. But for page redirecting need correct the next ELSEIF, by analogy of your code:

    ...
                } elseif (isset($oPageParams->query_vars['pagename'])) {
                    //change by Che 17-05-13
                    //$oObject = get_page_by_title($oPageParams->query_vars['pagename']);
                    $oObject = get_page_by_path($oPageParams->query_vars['pagename']);
    ...

    And it perfect works with permalinks and with home page (do not check with default URLs)
    This solution completely satisfied me. New bugs not found for now. So,
    http://expertbaby.ru/nashi-kursyi/sekretyi-vospitaniya-otvetstvennogo-rebenka/ is redirecting to http://expertbaby.ru/blockedpage/

  15. GM_Alex
    Member
    Plugin Author

    Posted 1 year ago #

    I will check that fix again and if it works for me I will add this to the new version.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags