We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38844
    • 2 Posts
    Hi all,

    Sorry if this has been covered but I am yet to find a suitable solution.

    I am using WebloginPE 1.3.1 in MODX 1.0.5

    I am attempting to:

    Have a series of protected pages which require a login, user clicks a 'Read More' button , if user is not logged in then a login form appears , once logged in the user is then redirected to the page he or she originally requested.

    Seems simple enough however WebloginPE does not accept any kind of TV or Snippet code being passed to the &liHomeId parameter allowing me to capture a referring link and passing it into WebloginPE once the user has logged in.

    I have tried $_REQUEST['refurl'] being passed via a snippet and also within an @EVAL inside a TV and none work.

    Hard coding a variable from a TV or a Snippet does work.

    Can anyone shed some light on this problem?
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      You should be able to use a plugin; I would store the requested ID in the SESSION using the OnPageUnauthorized event to load the page ID into the SESSION, and redirect to that page once the user is logged in using the onWebLogin event.

      The WLPE onWebLogin event provides a "User" array, it's possible you can access this and reset the user's default login resource ID to the desired ID.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 38844
        • 2 Posts
        Great, thanks so much.

        I understand how the plugin would work now , but a little unsure how to access the WLPE User array. I have read as much as I can find on the WLPE API but still in the dark a bit there.

        Still curious why &liHomeid accepts a variable thats hard coded being passed but doesn't accept one created dynamically from the same snippet or TV variable.

        Thanks most kindly for the assistance.
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Probably has something to do with the order in which the nested snippet/TV elements are processed. It might work better if the pages involved were not cached, then you could have the WebLoginPE snippet uncached and the inner snippet to set the liHomeId value cached.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org