Create an action to flag a referenced node -- How?

Events happening in the community are now at Drupal community events on www.drupal.org.
m_i_c_h_a_e_l's picture

I have a content-type called "assignment" and another called "worksheet". When a user creates a worksheet, the assignment node is node-referenced to display on top (using Node Reference URL).

I also have a flag called "completed".

After the user creates/saves his worksheet, I would like to automatically flag the referenced assignment node.

I want to use the flags to keep track of which assignments have been completed (i.e. which assignments resulted in a completed worksheet).

My problem is, there is an action for "flag created content" and another for "load referenced node", but there is no action for "flag referenced node".

As I understand it, if I want to write a new action, I have to create a module. I understand the basics of writing a module (I made a very simple one before, with a lot of help), but I have no idea how to write the code for this specific action.

If anyone can help I would really appreciate it. Thanks in advance.

Comments

Any Progress

javdich's picture

Have you had any luck with this yet? Did you end up creating a module for this?

I am also looking for this functionality. In my case, I have a two content types, Page & Story. A user creates a Page (Page 1). Then creates multiple stories with a node reference back to Page 1.

What I need is a rule that when a user Flags Page 1, all Stories that reference Page 1 are also Flagged by the user.

MichaelBrown, I don't have a

owntheweb's picture

MichaelBrown,
I don't have a full answer, but I had an challenge where I needed to save a node that referenced another node, which would load the other node and reference the node I just saved (references+rules solution needed). I couldn't do much with the referenced node in rules on its own, but was able to build a pretty simple action module that did the dirty work (in your case, I'm thinking flagging a node pragmatically wouldn't be all that difficult).

I recommend watching the two videos and checking out the module on my post here to get started:
http://groups.drupal.org/node/220069

Best regards,

Chris

Worlds to explore. Worlds to create.
Blog: http://www.christopherstevens.cc/blog
Twitter: http://www.twitter.com/owntheweb

Drupal 7?

itangalo's picture

It sounds like you are running Drupal 6. If so, solving this task will be pretty complex.

Let me know if you're running D7, and I'll sketch a solution.

//Johan Falk, Sweden

help, help

zastapmnie's picture

hello
Is anybody find solution this problem?
i'm looking for help in similar situation:
i have two content type - 1 is 'auction', 2 is 'offer'
and flag - 'choose offer'.
I wondering how do this:
- when author 'auction' choose 'offer', link to 'offer' dissapeared/hidden?

And something else - how break duration in special field - timeout (from module auction timeout) ?

I will indebdet for any help
Best regards!

I

help, help

zastapmnie's picture

hello
Is anybody find solution this problem?
i'm looking for help in similar situation:
i have two content type - 1 is 'auction', 2 is 'offer'
and flag - 'choose offer'.
I wondering how do this:
- when author 'auction' choose 'offer', link to 'offer' dissapeared/hidden?

And something else - how break duration in special field - timeout (from module auction timeout) ?

I will indebdet for any help
Best regards!

I

Rules

Group organizers

Group categories

Categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: