Forum Discussion

Drew_C's avatar
Drew_C
Boss
3 years ago

Simple redirect to "my profile" page

Here's how you can create a simple redirect to land your users on their profile page via an easy to share URL.

  1. Create an endpoint called myprofileredirect with the following content:

    <#if user.anonymous >

     ${http.response.setRedirectUrl(webUi.getUserLoginPageUrl("/plugins/custom/YourID/YourID/myprofileredirect"))}
    <#else>
     ${http.response.setRedirectUrl("${user.webUi.url}")}
    </#if>

    (If you don't know the ID to use in the anonymous redirect, just save it and you'll see a link to "open the endpoint" where you can get the URL path).
  2. Ask support to create two new vanity URLs, both pointing to the endpoint.
    /myprofile
    /me

Seriously, it's that easy (once published, of course).

The user.webUi.url FreeMarker object returns the user's profile ID and if a user isn't logged in, they'll be taken to the login page first, by way of webUi.getUserLoginPageUrl.

Enjoy!

No RepliesBe the first to reply