Support

Home Forums Event Espresso Premium Enabling Ulitmate Member content restriction on pages, not grid

Enabling Ulitmate Member content restriction on pages, not grid

Posted: April 18, 2019 at 12:10 pm


Providence Art Club

April 18, 2019 at 12:10 pm

Hi, I searched the forums but couldn’t find an answer to this. I’m attempting to show all events in the grid format, but when a visitor clicks on a members only event, they will get a log-in message. We do have some events open to the public so don’t want that restriction on all events. I checked off
‘Restricted Access to Posts – expresso_events’ in the Ultimate Member plug-in but I don’t see the dialog box for restricting access show up in my ee event editor.

Thanks for any help!
Kathy

PS I know we can restrict tickets sales to members only, but we want to restrict the entire page for some events to members only.


Josh

  • Support Staff

April 18, 2019 at 2:28 pm

Hi,

I downloaded a copy of the Ultimate Member plugin and checked the code where it adds the box to restrict access, and it looks like it’s loading in too early, so the current screen information isn’t set up yet.

Here’s a code snippet that loads the box in later when it’s an Event Espresso event editor page:

add_action(
    'add_meta_boxes',
    'add_um_boxes_to_ee',
    1
);
function add_um_boxes_to_ee(){
    $screen = get_current_screen();
    if(!isset($screen)){
        return;
    }
    if($screen->post_type != 'espresso_events') {
        return;
    }
    add_action(
        'add_meta_boxes',
        array(
            new um\admin\core\Admin_Metabox(),
            'add_metabox_restrict_content'
        ),
        2
    );
    add_action(
        'save_post',
        array(
            new um\admin\core\Admin_Metabox(),
            'save_metabox_restrict_content'
        ),
        10,
        2
    );
}

You can add the above to a functions plugin or, if available, into your WordPress child theme’s functions.php file.


Providence Art Club

April 19, 2019 at 7:31 am

Thanks, I’ll give that a try!


Providence Art Club

April 19, 2019 at 9:45 am

Worked like a charm, thank you so much!


Providence Art Club

April 25, 2019 at 7:12 am

Hi, me again.

Do you think adding that code to my child theme’s functions.php file could have disabled the search on this page? https://providenceartclub.org/about/artist_portfolios It’s suddenly not working and I don’t know of any other changes I’ve made that could have affected that.

Thanks!


Josh

  • Support Staff

April 25, 2019 at 10:11 am

I do not think adding that code would have any effect to the search on the page. If you don’t want to take my word for it, you could try temporarily removing that code to see what happens there.


Providence Art Club

April 25, 2019 at 10:43 am

Thanks, that’s a good idea, I’ll try taking it out, but glad if it’s not the problem since it worked well. It might have happened when I updated a plug in.
Once again, thanks for your help.

The support post ‘Enabling Ulitmate Member content restriction on pages, not grid’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso