• Resolved elliscrowther

    (@elliscrowther)


    Hi,

    I wondered if there was a way to use different groups as conditions with IF statements in our templates, the issue being that they’re within an Advanced Custom Fields repeater, so they would be PHP variables. Something like this:

    if(group = $group) {
    // displays if the user is in the group
    } else {
    // displays if the usr is not in the group
    }

    Could you help me achieve this using your plugin?

    Thanks!

Viewing 1 replies (of 1 total)
  • Plugin Author Kento

    (@proaktion)

    Hi,

    You can do that but the approach is slightly different as you would check whether the current user belongs to a particular group.

    You can find an example of checking that in the Examples of the documentation under “Does the current user belong to the Foobar group?”.

    You can then follow with

    if ( $is_a_member ) {
        // do this ...
    } else {
        // do that ...
    }

    Cheers!

Viewing 1 replies (of 1 total)
  • The topic ‘Using Groups as IF statements in ACF’ is closed to new replies.