User Points To Users For Node View

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

I'd like to give user points to users for node views like userpoints_pageviews.module gives points to node creators when a user views a node.

What is the best way? Rules integration? Or should I modify the userpoints_pageviews.module?

What if I just go through the userpoints_pageviews.info, userpoints_pageviews.install, and userpoints_pageviews.module and replace 'pageviews' with "pageviews_to_user" to create userpoints_pageviews_to_user.info, userpoints_pageviews_to_user.install, and userpoints_pageviews_to_user.module?

I'm a PHP/Drupal neophyte, but I'm hooked on Drupal. (plant tongue in cheek) It is amazing what this community has built.

If it works, what is the process for adding it to the userpoints_contrib? I've been grateful for the community documentation and projects, and I'd like to give something back if it's of value.

Comments

update_6001

noderunner's picture

Where does the 6001 come from in "userpoints_pageviews_update_6001()"?

function userpoints_pageviews_update_6001() {
drupal_install_schema('userpoints_pageviews');
return array();
}

I'm trying to understand how to modify the module, and this is the last part of the userpoints_pageviews.install .

Thanks

It appears to work. Just

noderunner's picture

It appears to work. Just made the above changes with a change of "'uid' => $node->uid" to "'uid' => $user->uid", and a cosmetic change to differentiate it from the other module.

Beware

kbahey's picture

Such as system is open to abuse. Users can just refresh the page to gain points. So take care of that aspect.

To contribute it, just open a new issue for userpoints_contrib and attach a tar.gz of the module and the info file.

Drupal performance tuning, development, customization and consulting: 2bits.com, Inc..
Personal blog: Baheyeldin.com.

checks node history table

noderunner's picture

Thanks for the info.

I think the module checks the history table so that you can't refresh to gain points.

User Points

Group organizers

Group notifications

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