Hide a event cat to user role

Home Forums Calendar Products Events Calendar PRO Hide a event cat to user role

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1514657
    Arnaud
    Participant

    Hi,

    I’m trying to hide an event category in month view to a user role with css.

    I add this snippet to my function.php file :

    // Hide administration category to members
    add_action(‘init’, ‘get_current_user_role’);
    function get_current_user_role() {
    global $current_user;
    $user_role = array_shift($current_user->roles);
    }
    if ($user_role=”um_membres”){
    echo “<style>.tribe-events-category-administration {display: none;}</style>”;
    } if ($umrole=”um_administration”){
    echo “<style>.tribe-events-category-administration {display: inline-block;}</style>”;
    }

    This working well when I load my calendar (month view) but when I’m using links to next or previous month the page remains stuck on loader animation.

    If anyone have an idea to help… Thank you !

    #1514671
    Arnaud
    Participant

    ok

    #1516149

    Glad you were able to figure things out, you are welcome back in our support forums any time!

    Since you marked this thread as Resolved, I am going to close this thread.

    Have a great week!

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Hide a event cat to user role’ is closed to new replies.