1

I have a restaurant with a Drupal site and would like to post coupons for patrons to use. They would have to create a user account to view it. The coupon would be an image field and if a user wants to use it they would click use coupon and it would hide it from that user only. Is this possible?

Thanks

4
  • Are you displaying the coupons (I assume an image in a node) in a view?
    – dwcdev
    Commented Jul 8, 2018 at 15:49
  • More than likely it would be an image in a node.
    – Brad
    Commented Jul 8, 2018 at 16:01
  • Please confirm. Is this a "Coupon" node, where the entire node needs to be hidden? Or is the node still available but the image is not visible?
    – dwcdev
    Commented Jul 8, 2018 at 18:10
  • Entire node hidden would be ideal
    – Brad
    Commented Jul 8, 2018 at 20:25

2 Answers 2

1

You can with Flag + Rules

In /admin/structure/flags/add add flag of "Content" and call it something like "use coupon" flag.

I presume your Nodes teasers are listed in view. So in Views:

  • In Relationships add "Content flag"
    • Uncheck include only flagged content
    • Flag: Slect your flag
    • By: Current User

enter image description here

  • In Filter Criteria add "Flagging" and select not flagged.

To prevent from viewing node directly by typing the url, in Rules:

  • In /admin/config/workflow/rules create Rule with action of "Flagging is viewed".
  • Add Action of "Page redirect" and send them to some custom /url that says you already redeemed this coupon. (Create a basic page for this)
0

Another option is to use the statistics module to see if the user has view the content. Note the statistics module has some performance implications.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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