Hi
I am creating a site where participation is required. Members will get a limited profile if they fall below a certain number of points. So far, so good. However, when a new user registers they have no points. Actually they don't even have 0. Seems like no record is created in SQL until after they are awarded points for an action. So in theory, if they do not ever post, their role will never be changed since they don't "exist" in the user module.
My question is, how do I set a default point value for new users, e.g. 100 points?

Also, on a side note. What is the lowest the points will get when I subtract periodically. Is it 0 or does it go into the negatives?

Thanks.

Comments

jredding’s picture

This ability is not built into core but it would be easy to add in with your own custom module. I'd use hook_user on the register $op and then call the userpoints_userpointsapi to add the correct points.

Don't quote me on this code as I'm writing it WITHOUT testing it or even spellchecking it ;)
but.

function mymodule_user($op, &$edit, &$account, $category = NULL) {
  if ($op == 'register') {
    userpoints_userpointsapi('points', 100, $account->uid, 'Register', 'New account registration')
  }
}

put that code in your own custom module and changing "mymodule" to whatever you want to name it and you should be good.

Don't forget to read the README in the userpoints directory for more API information and also the hook_user function call on api.drupal.org
http://api.drupal.org/api/function/hook_user/5

Also this code is against userpoints 2.14 and Drupal 5 and, again, it hasn't been tested ;)

jredding’s picture

Category: support » feature

Changing to a feature request. Hopefully you'll submit a contrib module or some-kind soul out there will.

berdir’s picture

Component: Code: userpoints » Code: userpoints API
Status: Active » Closed (won't fix)

Sorry for spamming the participants in this issue. Due to the release of Drupal 7 and the lack of time from the maintainers, I'm closing all remaining 5.x issues for Userpoints.

Feel free to re-open this issue or create a new one for 6.x or even better 7.x if this bug is still open or feature is missing for these versions.