Support » Plugin: Ultimate Member – User Profile, User Registration, Login & Membership Plugin » Inserting register/login form shortcode into the restricted access message

  • Hi,

    I want to edit the global and/or custom restricted access messages to insert the register/login form below the message.

    The custom snippet below has been advised by the plugin authors before but it is not a solution to the above problem, or I am not how to make it right.

    Thanks

    add_filter("um_get_option_filter__restricted_access_message",function( $value ){
    
        if( is_admin() ) return $value;
    
        if ( version_compare( get_bloginfo('version'),'5.4', '<' ) ) {
            return do_shortcode( $value );
        } else {
            return apply_shortcodes( $value );
        }
    
        return $value;
    });

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Aswin Giri

    (@aswingiri)

    Hello @drhaldun

    Please try code snippets from this link.

    Thread Starter drhaldun

    (@drhaldun)

    Hello @aswingiri, thanks for the snippet and prompt response.

    The snippet didn’t work as it expected, I may have done something wrong. I restricted this page to logged in users, https://acilci.net/ikincibasamak/
    and added a login/register form shortcode to the restricted access message. But it does not recognize the shortcode, shows it as a text and redirects to 404 page.

    Plugin Support Aswin Giri

    (@aswingiri)

    @drhaldun Can you please tell me where did you add the code, this is a tested solution and couple of other users have used this snippet. So, it should be working. I tried to navigate to the url you provided but it redirects to private-area/welcome/. Do you have any redirection setup for this page?

    Thread Starter drhaldun

    (@drhaldun)

    Hi Aswin,

    I pasted the code into Code Snippets and activated it:
    https://imgur.com/7Acnutc
    This is the text area of UM I am trying to embed the shortcode:
    https://imgur.com/HZHB4PL
    But before the redirect, I have time to see that the shortcode is not working:
    https://imgur.com/g72FgBD
    The redirect is injected by the code snippet you have provided, I guess the following part is responsible for it:

          $content .= '<script type="text/javascript">
       var userLang = window.navigator.language || window.navigator.userLanguage; 
       if(userLang.toLowerCase().indexOf("it")>-1) location.href = "/area-riservata/benvenuto/";
    	else location.href = "/en/private-area/welcome/";</script>';

    Thanks

    • This reply was modified 1 week, 6 days ago by drhaldun. Reason: included the code
    Plugin Support Ultimate Member Support

    (@ultimatemembersupport)

    Hi @drhaldun

    Sorry for the late response. Just checking if you’re still having issues? Did you try removing the javascript that cause the redirection issue and see if @aswingiri ‘s code works?

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.