• Resolved KeithDream

    (@keitheldridge)


    Hi,
    I’m trying to add the UM login form to the global restricted access message.
    By default, the shortcode shows up as text:
    [ultimatemember form_id=”2209″]

    I’ve used the following code suggested in other tickets. With this in my child theme functions.php file, the shortcode no longer shows up, but the code doesn’t render either. It is just blank.

    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 issue I’m trying to solve is:
    Members that are trying to access restricted content get this message. Currently they are directed to login via the default WordPress login page. But this doesn’t redirect them back to the page they were trying to access.

    I was able to make this work on a standard page and added it to my 404 template, which works great.

    I’d appreciate your guidance in adding the same functionality to the Restricted Access message.

    Thank you

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

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

    (@aswingiri)

    Hello @keitheldridge

    By default, Shortcodes are not allowed in the restricted content messages. You will need to override the filter used in the plugin. Please try the code snippet in this link.

    Thread Starter KeithDream

    (@keitheldridge)

    This worked perfectly, thank you!

    Thread Starter KeithDream

    (@keitheldridge)

    Actually, it was working until I upgraded Ultimate Member to Version 2.5.0. The site crashed with a critical error. Removing the above code brought the site back up.
    We ended up purchasing the plugin to get support and got an alternative solution that is now working.

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to add Login Form shortcode to Restrict Access Message’ is closed to new replies.