• Resolved nievesa2colores

    (@nievesa2colores)


    Hi.
    I have tested the plugin and it works perfectly with the example you give to hide elements from non-logged in users. But I need it to hide elements to certain user roles and I don’t know anything about php. Can you please provide me with more php expressions that can be applied in the plugin to get more out of it? Thank you!!

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

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Jonathan Horowitz

    (@jhorowitz)

    Hi @nievesa2colores,

    To hide from a specific role:
    !current_user_can('role_name')

    Thread Starter nievesa2colores

    (@nievesa2colores)

    Hi Jonathan!
    Thanks
    And if I want to hide the content from more than one role? how would the expression be?
    I have tried different ways but it doesn’t work :(.

    I would appreciate your help.
    Thanks in advance!

    Plugin Author Jonathan Horowitz

    (@jhorowitz)

    Simply list them all separated by &&, like this:

    !current_user_can('role_name') && !current_user_can('other_role_name')

    That will hide for either role. ??

    hi, i have a lot of roles on my website, wanted to know if we can say like : all roles cant see it except “that role”

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘PHP boolean expression for hide user roll’ is closed to new replies.