It's always seemed a bit odd to me that points are awarded even when nodes/comments go into moderation.

I understand there's a points moderation system, but would it not be a simple matter to add the publication condition to the awarding of points?

Comments

Dialer3’s picture

This is really needed bugfix! It will really increase the degree of automation of ppl's work and save lots of time. I was shocked not finding this fix here and now going to write it by myself.

Dialer3’s picture

Well, the hack issued simple:

Edit userpoints_nc.module

function userpoints_nodeapi
after

    case 'insert':

add

	  if($node->status=='1'){

put closing braket } below after

		  userpoints_userpointsapi($params);

after

    case 'update':

add

	  if($node->status=='1'){

after

      $last_owner = db_fetch_object(db_query($sql, $node->nid, 'node', 'insert', 'Ownership gain'));

add

	  if(!is_numeric($last_owner->uid)){
		  $params = array(
			'points' => $points,
			'uid' => $node->uid,
			'operation' => 'insert',
			'entity_id' => $node->nid,
			'entity_type' => 'node'
		  );
		  userpoints_userpointsapi($params);
	  }else

put closing braket } below before

      break;

Enjoy.

esllou’s picture

dialer, thanks for this. Could you post a patch that the module maintainer might consider for inclusion?

thanks again...this module has been screaming out for this from day one.

fourmi4x’s picture

I agree it would be awesome to have this directly in the module as an option. And many thanks for the solution !

FireBoss’s picture

I accomplished this for my site today by changing a function within userpoints_nc module.
See the post I made for the code:

http://drupal.org/node/416358

My code covers quite a bit more areas than the code mentioned above - insert, delete, update code has all been coded to work properly to award and delete points upon changes to the publication status. I wasn't able to find a good solution for my site so I made one for myself and decided to post it here for others.

The only problem I could see with adding this code to the module code is that it eliminates the possibility for someone to have the points awarded as normal, although I'm sure this change could be done with ease by the maintainer of the module.

biolizard89’s picture

Will the fixes posted in this issue also work for comments, or just nodes? I would like unpublished comments to not generate userpoints; I can't tell whether the fixes posted here will accomplish this.

Thanks.