Userpoints Node Action

Last updated on
30 April 2025

Userpoints Node Action, http://drupal.org/project/userpoints_node_action, lets you use points to create, publish, and perform other actions on nodes. I am testing it to charge for node creation, something recently added in issue http://drupal.org/node/1200012.

The Userpoints Node Action package also includes Userpoints Poll Action. Both modules work with rules.

Userpoints Node Action

name = Userpoints Node Action
description = "Provides a customizable configuration to detract points from users for setting nodes to have certain options (published, sticky, promoted)."
core = 7.x
package = Userpoints
dependencies[] = node
dependencies[] = userpoints

Database table

The module creates a table named userpoints_node_action indexed by a serial number named id. The table contains the following columns. You can see from the fields that you can have rules by role and you can use points by category.

  • role_id ID of the role for the rule
  • pubtype Node type of the rule
  • action Publishing action of the rule
  • category Category of points for the rule
  • points Amount of points for the rule

Configuration

This module allows admins to configure rules for user roles to have to pay !points to change the status options of certain node types.
Example: All users with a given role such as "advertiser" could have to pay 10 !points to publish their ad, and an additional 20 to make it sticky. It does not cost users to unset these actions though (seems like a very unnecessary use case), so it's free to unpublish or unsticky a node. Nodes that are published with another user as the author will use the author's points for costing.

Go to Administration » Configuration » People » Credits Node Action, admin/config/people/userpoints_node_action.

Look for Add Node Action Rule.

  1. Select the Role for people who will use the points, in our example it is Employer.
  2. Select the Publication type of the content type, in our case Advertisement.
  3. Select the Action of the content type, in our case <Create>. The options are create, publish, sticky, promote.
  4. Select the Category of the points to be used, in our case One month.
  5. Select the number of Points to be used, in our case 1.
  6. Add

Custom message

Enter a custom message here that will only get displayed once per form submission. This is useful for things like notifying the user of how to purchase more points. You may use "!points" to refer to the correct term, and may use the custom schema to include links in your message that will open in a new window: <link_text>path<end_link>desc<end_text> (the message needs all three key character sets, exactly as shown). For example, the following message: "<link_text>/store/item<end_link>click here to buy more<end_text>" will effectively call the l() function with the text being "click here to buy more" and being a link to the appropriate /store/item location. This message will get displayed once upon form validation, regardless of how many rules are conflicted with. If you do not wish to have a custom message, simply leave this field blank.

Override default message
You do not have enough !category !points to !action this item

This message displays for each rule that has failed (leave blank for no message). The schema used in the above message can be used, as well as the following variables:
!points - correct term for points
!cur_points - current number of points the user has for the relevant category
!num_points - number of points needed (this includes previous action costing)
!category - category of points (may be a blank string)
!action - action the user is trying to take
The default value of this is "You do not have enough !category !points to !action this item". Note that if you don't display default messages and don't provide any custom messages, it will probably be very confusing for the user as the node will be invalid without giving a reason.

Userpoints Poll Action

name = Userpoints Poll Action
description = "Provides a customizable configuration to detract points from users for voting on polls."
core = 7.x
package = Userpoints
dependencies[] = node
dependencies[] = userpoints
dependencies[] = poll

Help improve this page

Page status: Not set

You can: