Hello,

I would like to make users earn points when one of his nodes is promoted to front page, instead of only earning points by creating the node.
For second one I am using workflow-ng event: Content has been created and then Grant points to a user.
I can also see action Promote/demote content to/from the front page but it will do this in the same time when node will be posted. I have setup node to promote to front page after 5 vote up selections so I need something like event: Content has been promoted, so I can select then Grant points to a user... but I can't find that option... Please, help!

Thank you.

Comments

amitaibu’s picture

Create a rule invoked on 'content has been updated' and in your condition check that the state has changed from demoted to promoted.

chazz’s picture

Thanks, but I can't find that condition to change from demoted to promoted. That option is only available in Action, not condition. I need condition as promoted/demoted and action as gained/losed points.
In Conditions menu for Node I can select only CONTENT HAS TYPE. DO I need additional module to enable demoted/promoted conditions ?

amitaibu’s picture

Status: Active » Fixed

You can use 'Textual comparison' and check the promoted token (i.e. [node:promote])

chazz’s picture

Status: Fixed » Postponed (maintainer needs more info)

Thank you for your replay again,
Sorry but I can't setup this to work as it should. Please, could you explain me step by step how to setup that workflow rules, conditions and action ? When I am making textual comparision I can put something to Two texts to compare: In the first one [node:promote] but what about the other one ?
Also why I can't see condition to demote/promote as you advised to do before ?
Thank you.

amitaibu’s picture

There is no condition to promote, there is the token replacement as I suggested in #3.
In the first text enter to [unchanged_node:promote] and in the second the [updated_node:promote] (dig a bit in the token replacement list).

chazz’s picture

Ok I have done it, but now point's are not added at all. Without that tokens, points are gained if node is promoted and demoted.

I don't know what to do.. ehhh.. sorry for that I need more informations, please.

This is exported code for promoted rule:

array (
  'cfg_14' => 
  array (
    '#label' => 'promoted',
    '#type' => 'configuration',
    '#event' => 'node_update',
    '#weight' => '0',
    '#active' => 1,
    '#id' => 1,
    '#module' => 'workflow-ng',
    '#altered' => false,
    0 => 
    array (
      '#name' => 'workflow_ng_condition_token_compare',
      '#label' => 'Textual comparison',
      '#type' => 'condition',
      '#id' => 2,
      '#settings' => 
      array (
        'text1' => '[unchanged_node:promote]',
        'text1_args' => 
        array (
        ),
        'text2' => '[updated_node:promote]',
        'text2_args' => 
        array (
        ),
        'regex' => 0,
      ),
    ),
    1 => 
    array (
      '#type' => 'action',
      '#name' => 'userpoints_action_grant_points',
      '#id' => 4,
      '#settings' => 
      array (
        'number' => '15',
        'number_args' => 
        array (
        ),
      ),
      '#argument map' => 
      array (
        'author' => 'user',
      ),
    ),
    '#name' => 'cfg_14',
  ),
)

Thank you.

amitaibu’s picture

You aren't looking in pattern replacement, so it doesn't work for you.
[node:promote] should be in one text and [node_unchanged:promote] in the other.

I don't know user points enough to help you with that.

chazz’s picture

Doesn't work.. nothing is happened.

I have found that token before [node:promote] Whether the node is promoted to the front page. (yes/no)

Now my code looks like this:

array (
  'cfg_14' => 
  array (
    '#event' => 'node_update',
    '#weight' => '0',
    '#module' => 'workflow-ng',
    '#active' => 1,
    '#altered' => false,
    '#type' => 'configuration',
    '#label' => 'promoted',
    '#id' => 1,
    0 => 
    array (
      '#label' => 'Textual comparison',
      '#id' => 2,
      '#type' => 'condition',
      '#name' => 'workflow_ng_condition_token_compare',
      '#settings' => 
      array (
        'text1' => '[node:promote][unchanged_node:promote]',
        'text1_args' => 
        array (
          0 => 'node',
        ),
        'text2' => '[node_unchanged:promote][updated_node:promote]',
        'text2_args' => 
        array (
          0 => 'node_unchanged',
        ),
        'regex' => 0,
      ),
    ),
    1 => 
    array (
      '#type' => 'action',
      '#name' => 'userpoints_action_grant_points',
      '#id' => 3,
      '#settings' => 
      array (
        'number' => '15',
        'number_args' => 
        array (
        ),
      ),
      '#argument map' => 
      array (
        'author' => 'user',
      ),
    ),
    '#name' => 'cfg_14',
  ),
)

Edit:

I also tried: [node:promote] in one text and [node_unchanged:promote] in the other... still doesn't work

Edit2: HOLD ON I THINK I HAVE FOUND A SOLUTION... brb :)

chazz’s picture

Status: Postponed (maintainer needs more info) » Fixed

Ok I have ticked negate and evaluate for promoted and evaluate only for demoted and it's working fine now :)
Thank you for your help!

amitaibu’s picture

Cool! Maybe now that you now how 'painful' it is to be a newbie, you can add some documentation about your workflow?

chazz’s picture

I will, it will be my first one :)

chazz’s picture

Status: Fixed » Postponed (maintainer needs more info)

Ok I have found another problem. When user want to edit node, and node is not promoted he will gain points again. If node is promoted and user want to edit own node, he's going to lost the points so I decided to remove demote event for a while...

Edit:

Ok I have left only event to promote node with conditions for Textual comparison and action for Grant points to a user.

Now, when node is not yet promoted and I would like to EDIT node, I will gain points (because of update). -
After node is promoted I will gain points (as it should be) +
And now, if I like to edit promoted node I will NOT gain any more points (as it should be) +
And now, if node is demoted I am not loosing points (as it should be, because I deleted demote event as I said before) +
And now... we can do a circle :P Back to point 1. After node will be edited I will gain again points.

So how I can stop earning points from editing not promoted nodes ?