Simple rule to show a hidden field after a comment is posted

thiokol - May 7, 2009 - 23:04
Project:Rules
Version:6.x-1.x-dev
Component:Documentation
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed
Description

I have a node with a filefield containing an MP3 file, I want this field to be hidden to the user and then if a they post a comment on the node, the node is displayed again with the hidden field now displayed allowing the user to download.

I've played about with rules for a while now but i cant work out how to achieve this.

any ideas?

#1

opensanta - May 8, 2009 - 00:07
Status:active» postponed (maintainer needs more info)

I don't believe any of the node access modules I have used (content access & nodeaccess_userreference) provide field specific permissions, so you should look into cck's included content_permissions module. Unfortunately, I think the current implementation is solely based on roles, however it would seem you need something more granular.

You can find that many other people are discussing this:
http://drupal.org/project/issues/cck?text=&status=Open&priorities=All&ca...

#2

thiokol - May 8, 2009 - 13:33

yeah, i don't want to base it on roles, i just want a field to be hidden until the user posts a comment on the node at which point the field will then become visible.

I suppose there's a way to do it by adding a bit of code to node-specific.tpl.php, like IF user has commented on node display this field, otherwise don't display the field. I have no idea what variables are used for user comment or how to output particular fields instead of using $content though :(

#3

opensanta - July 20, 2009 - 20:57
Component:Rules Engine» Documentation
Status:postponed (maintainer needs more info)» fixed

I haven't tested this, but I think it'll work:

- Set the file field to hidden in the cck display settings
- Create a non-global flag 'commented'
- Create a view with the file field, nid argument with default value from url, and relationship flag: 'commented' by current user & limit to only flagged nodes
- Use a block view and display it on nodes of that type
- Create a rule: when comment is published, flag the submitter to the commented node

After they are redirected back the commented node, they should be able to see the hidden filefield.

#4

System Message - August 3, 2009 - 21:00
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.