Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] Add second role to exclusion from members-loop.php?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Avatar of shanebp
    shanebp
    Moderator

    @shanebp

    Try:
    `
    if ( ( $user->roles[0] != ‘subscriber’ ) && ( $user->roles[0] != ‘customer’ ) ) : ?>
    `

    Avatar of @modemlooper
    @modemlooper
    Moderator

    @modemlooper

    `if ( $user->roles[0] != ‘subscriber’ || $user-roles[0] != ‘customer’ ) `

    Try something like that

    Avatar of @modemlooper
    @modemlooper
    Moderator

    @modemlooper

    You need || not &&

    Avatar of @satori83
    @satori83
    Participant

    @satori83

    I get a syntax error…
    Parse error: syntax error, unexpected ‘[‘ in /home/amerifit/public_html/wp-content/themes/DynamiX/members/members-loop.php on line 39

    Avatar of @satori83
    @satori83
    Participant

    @satori83

    @shanebp
    That code did the trick! Thanks.

    @modemlooper
    Thanks for helping! The first code seemed to work, when I used || i got a error for some reason. Im a newb to php so I dont understand it too much..lol.

    Avatar of @modemlooper
    @modemlooper
    Moderator

    @modemlooper

    I didn’t wrap code in brackets correctly. :D typing on iPhone

    Avatar of @satori83
    @satori83
    Participant

    @satori83

    @modemlooper
    Ok no problem. If it seems to be working though is there a reason I should change it to ||? As I said I don’t know what the difference is yet so if there is something I am missing I am all ears! :)

    Avatar of @modemlooper
    @modemlooper
    Moderator

    @modemlooper

    && means both statements must be true || means either one can be true. Even though both may work I like using || when evaluating either/or statements. If both were needed to be true then && is more appropriate.

Viewing 8 replies - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.