• Resolved ninsan

    (@jennyrigsjo)


    Good morning!

    I would like to display the UM login form in one of the posts on my website’s blog. I thought this could be achieved by copying the form’s shortcode into the Gutenberg editor, like this:

    [ultimatemember form_id=”871″]

    However, doing this makes the entire post inaccessible to logged-out users. If a logged-out user tries to click on the post with the login form inside it, they are instead redirected to the website’s front page (if they are logged in the issue doesn’t occur). I guess this happens for security reasons because the login form isn’t meant to be accessed that way(?). So my question is: is it at all possible to display the login form in places other than the dedicated Login page?

    Thanks. ??

    /jen

    Edit: I also tried enabling the option ‘Activate Gutenberg blocks’ in the plugin settings and then tried embedding the login form in the post that way, but the issue still remains.

    • This topic was modified 3 years, 6 months ago by ninsan.
Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Support Aswin Giri

    (@aswingiri)

    Hello @jennyrigsjo,

    You should be able to add login should code to any page or post with no issue and by default that should be visible to both logged in and logged out users. Logged out users will see a login form and logged in users will see a user card with an account and a logout link.

    Can you make sure you do not have any content restrictions enabled to the post and make sure “Apply custom settings to this form” is set to “No” in login form settings?

    Thread Starter ninsan

    (@jennyrigsjo)

    Hi @aswingiri

    Thank you for helping. ?? I did as you suggested and checked that the post doesn’t have any content restrictions applied to it and that ‘apply custom settings’ is set to ‘no’ for the login form – this is indeed the case.

    I also deactivated all other plugins (except UM), removed my mu-plugins directory and switched to the default Twenty Twenty-One theme – the problem still remains.

    As of right now, I am stumped as to why this occurs. Have you tried replicating the issue on your end?

    Thanks.

    /jenny

    Thread Starter ninsan

    (@jennyrigsjo)

    UPDATE.

    It occurred to me that aside from the default Login form I also use the UM Gutenberg blocks to display the default Profile form in the post. When I remove the profile form and display only the login form, the problem goes away. So it would seem there is some kind of conflict happening if you try to embed both forms within a single post. This makes sense as, when the user is logged out, obviously there is no profile to display for the current user. Ideally, though, I would like to be able to display both forms in the same post, perhaps by tweaking the code for the profile form so that it is not displayed or displays a “dummy profile” when the user is logged out. Is there any way this can be done?

    /jenny

    • This reply was modified 3 years, 6 months ago by ninsan.
    Plugin Support Aswin Giri

    (@aswingiri)

    @jennyrigsjo Do you have this page selected as UM user page in the setting?

    Plugin Support Aswin Giri

    (@aswingiri)

    @jennyrigsjo If you have not selected the page as UM user page, you might want to try codes in this link https://codeshare.io/vwo7PL

    These codes add a new shortcode, which will show the user profile if a user is logged in and shows the login form if a user is not logged in. You should just pass the correct profile form id and login form id.

    Shortcode:
    [um_custom_profile_shortcode profile_form=”1″ login_form=”2″]

    and please remember to replace profile_form and login_form values with correct ids.

    This solution will not work if you are doing it on UM user page as this page contains its own logic, actions and filters.

    Thread Starter ninsan

    (@jennyrigsjo)

    @aswingiri You mean the post in which the login and profile forms are embedded? No, it’s a regular blog post, it is not set as the current User Page.

    Thread Starter ninsan

    (@jennyrigsjo)

    @aswingiri The shortcode worked! Thanks so much! ??

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Thanks for letting us know how it resolves the issue.

    Regards,

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Embed login form in post?’ is closed to new replies.