4

There are two Roles:

  • Authenticated
  • Artist

I have created a flag with flag type "USER".
The flag is used so that the Authenticated Users can follow the Artists.

As the flag is type of user, an authenticated user can even follow another authenticated user.

How do I restrict the flagging to be applied only to the Artist? i.e the authenticated user can only follow an Artist and no user of any other role.

5

You can achieve your requirement by following below steps.

  1. Create a view of type User.

    enter image description here

  2. Add a relationship to Flag.

    enter image description here

  3. Now add Flags: Flag link field + extra field you want to display

  4. Finally add a FILTER CRITERIA i.e. User: Roles and select Artist user role.
  • 1
    5. If you are putting this view on the Artist user profile page, you will want to add a contextual filter of user: uid. Then select provide default value and select User ID from url. see this picture Note: the view preview will become blank, don't worry, it will show up when you view your artist user page. – No Sssweat Feb 2 '16 at 0:40
  • 1
    +1 for the solution. However, it does not cover the issue completely. How do you restrict flagging of users of having roles other than Artist? I believe that it could be done by not showing the flag in links area or anywhere else and show it using a view on the artist profile page. In that case there needs to be an extra step which @NoSssweat has mentioned already. – AjitS Feb 2 '16 at 1:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.