2

I have a site where members (with different roles) can post projects.

My goal : To show to "recruiters" (role) a view of all the users who have flagged their nodes. In other words, the flag accessibility / visibility is dependant of the author's role and node type.

I need :

  1. to show a flag to every user if the author of the node has the role "recruiter"
  2. to let the "recruiter" unflag a user from his view of applicants.

I can't / I can:

  1. I cannot figure out how to control the visibility / accessibility of the flag based on the author's role. I've checked a few modules, but did not find anything relevent yet.

  2. I'm ok with Views: I guess I could make a second flag only for "recruiters" (available in the view) and set a double condition : if user has flagged node AND if "recruiter" has flagged the user in the list, then remove user from the view. By doing this, the user would not be able to flag again the node (job post) if the 'recruiter" has (un)flagged the user.

My hope : to be able to combine available modules (no coding).

I guess a custom module could look for a boolean field (checkbox) only available to some roles and show (or not) the flag. But I'm no coder unfortunately.

Let's start with available modules : is there anything that I missed?

1

I have the impression that what you're asking for requires more then just (only) the Flag module. I.e. you should get it to work if you also use the Rules Link module.

If you're not familiar with Rules Link, then have a look at "How to show authorized users a link for relevant Views results using the Rules Link module?". The scenario explained in that question is about users that are "blocked" or "active", and which you could consider as a variation of what this question here is about, i.e.:

  • think of "active" users as "users who have flagged their nodes" (as in your question).
  • think of "blocked" users as "unflag a user from his view of applicants" (as in your question).

Of course, you don't want to block or activate users for your case. But instead you could use 2 separate flags:

  • a 1st flag to be used by all the users, to indicate something like "I want to apply for this node" (adapt the label to whatever fits).
  • a 2nd flag to be used by the recruiter to indicate something like "reject a user as an applicant".

Obviously, you could show to "recruiters" (role) a view of all the users who have flagged their nodes (with the "1st flag"). And using Rules Link you could improve that view to trigger some additional Rules magic to simply flag an applicant (with the "2nd flag").

Note: no custom coding needed, only 2 flags to be configured, and some rules magic (combined with Rules Link).

0

Ok. So far, so good...

I was able to control the access to the flag with 2 conditions:

  1. when creating the Flag link, I have specified a bundle (content type)
  2. in "Configure rules", I have set 2 "Access conditions":

a) NOT Data comparison — Parameter: Data to compare: [site:current-user], Data value: [node:author] "AND" b) Data comparison — Parameter: Data to compare: [node:author:roles:1], Data value: name of role.

In other words, every user can see the Flag Link (except the author of the node) and the Flag Link shows up only on specific nodes : the ones where the author has a specific role. And it seems to work! Of course, the permission was set.

I'm not sure about the meaning of "[node:author:roles:1]". But it seems to do the trick.

Also : I have tried to add a third "AND" to limit the visibility of the Flag link even more : I want it to be visible on nodes where the author has a specific role and a specific taxonomy term. But for now, this failed to work.

Is there a way to hide the Rules link once the user has clicked in it?

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.