2

I am building a website in Drupal 7 where the requirement is for users to sign up, create profile2 where they must select from a list of checkboxes pulled in from my interests taxonomy terms. For example: jobs, research collaboration, media interviews.

Once another user posts an opportunity (content type) I need to send all users a notification based on the interest categories selected when creating the opportunity (compared to each user's interest selections in profile2).

Probably the Rules module? Has anyone done anything like this before? I can't seem to wrap my head around the problem.

  • Thanks for your response. Yes I think I would be able to, then just need to pass the termid to the view. I want to send email notification with link to the node. – louis_coetzee Jan 16 '17 at 15:15
  • Okay I see where you're going... looks like this module will do the trick: drupal.org/project/views_rules Thanks! – louis_coetzee Jan 16 '17 at 16:08
  • That might work too, though I would use another approach (see my answer I posted just now). – Pierre.Vriens Jan 16 '17 at 16:16
2

You may want to give it a try to process the results of a VBO enabled view via Rules, as detailed below.

Step 1 - make it work for a single (1st) term

Remark: this is an intermediate step to prepare a prototype for Step 2 (if you have enough Rules experience, just start straight from Step 2).

Create a rule like so:

  • Rules Event: After saving a node of type "Opportunity"
  • Rules Condition: Check if the node was tagged with your 1st term, using "List contains item" (and the list to be checked being the field of the node that contains the interest categories).
  • Rules Actions:

    • Load the VBO list of users that you want to be processed.
    • Add a loop to perform a Rules Action, for each row contained in your Views results. Within this Rules Action, you then send a notification to the user being processed.

Some more details about the VBO-view you'd have to create for this:

  • The view should list all users who have some specific term selected (which corresponds to the 1st term).
  • It should include an appropriate filter for the term ID to be processed.
  • It should have exactly 1 result (row) for each user to be notified.
  • One of the columns should be the eMail Id (I don't see other columns needed for this to work).

For more details, have a look at the tutorial "How to process the results of a VBO enabled view via Rules?".

Step 2 - make it work for all terms (not just the 1st term)

Since the Opportunity may have been tagged with multiple terms, you need to improve the solution from Step 1 to handle all the terms (not just the 1st one). To do so, these are the steps to improve the rule from Step 1:

  • Add a "Rules Loop" as your very first Rules Action, to iterate over each term that the Opportunity was tagged with.
  • For each term in this iteration, perform these sub-items:
    • check which term you're actually processing. This check is similar to the Rules Condition from Step 1, but you should use the Conditional Rules module to be able to include such Rules Condition as part of a Rules Action. BTW you can either use IF/THEN constructs, or CASE/WHEN constructs.
    • If the check succeeds, then perform a Rules Action similar to the Rules Action from Step 1.
  • Remove the Rules Condition from Step 1 (it is now included via the previous check using Conditional Rules).
  • Thank you for your detailed explanation, I will give this a try and give feedback. Thanks again! – louis_coetzee Jan 16 '17 at 16:31
  • @louis_coetzee did you ever get a chance to give this a try? If so, what was the result? – Pierre.Vriens Sep 5 '17 at 8:23

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.