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

    I am using the addon Login to manage my modx profiles in discuss. When a user clicks on edit their, it succesfuly points them towards the edit profile page. But then I want I want them to be redirected back to the view profile page.

    I have a Custom snippet as below, which is called as a posthook to redirect the user after updating their profile page.

    <?php
    $url = $modx->makeUrl(12);
    $modx->sendRedirect($url);


    But unsure of which resource ID to add of what else to use to redirect back to view profile page. Or previous page if possible.
      • 3749
      • 24,544 Posts
      Can't you just use the URL of the update profile page and skip the call to makeUrl()?

      If not, you might need a snippet on the Update Profile page that sets a $_SESSION['ProfileUrl'] variable from the current URL.

      Then, in your code:

      $url = $_SESSIOn['ProfileUrl'];


      BTW, you want this to make the forwarding more reliable:

      $modx->sendRedirect($url, "", "", "full");
      [ed. note: BobRay last edited this post 10 years, 8 months ago.]
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 41583
        • 29 Posts
        thanks Bobray, so if I wanted to redirect directly to the following page (Discuss Profile View)
         http://www.******.co.uk/forums/u/charlie


        How could I use the following
        [[!+modx.user.username]]
        ?

        thanks [ed. note: ankh2054 last edited this post 10 years, 8 months ago.]
          • 3749
          • 24,544 Posts

          ?You shouldn't need to do that.

          In your custom snippet:

          $url = 'http://www.******.co.uk/forums/u/' . $modx->user->get('username');
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 41583
            • 29 Posts
            thanks very much Bobray smiley