Forum

Thread tagged as: Question, Members

Test Against Multiple Member Tags

Hi,

Can you have content unlocked with tags in an "either or" scenario? That is, to have two members with two different tags access the same content? How would you write it out?

This is what I have:

if (perch_member_has_tag('guitar-beginner')) {

                    perch_content('Beginning Guitar -Unlocked');
                }

                else {
                    perch_content('Beginning Guitar -Locked');
                }

I'd like to an administrator to always have access with an 'admin' tag.

if (perch_member_has_tag('guitar-beginner, admin')) { /* Not sure what to do */

                    perch_content('Beginning Guitar -Unlocked');
                }

                else {
                    perch_content('Beginning Guitar -Locked');
                }

Thanks!

Greg Stone

Greg Stone 0 points

  • 5 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

You should just be able to use || 'or' in PHP.

if (perch_member_has_tag('guitar-beginner') || perch_member_has_tag('admin') ) { /* Not sure what to do */
  perch_content('Beginning Guitar -Unlocked
} else {
  perch_content('Beginning Guitar -Locked');
 }