I'd like to award my happy little users when they select an avatar.

Anyone know of a module that melds User Points and Avatar Selection?

Both modules are awesome, but I can't find a way to combine them into thanks-for-making-your-profile-pretty goodness.


I don't think there already exists a module for this.

What you need to do is implement hook_user_update() and check if the user now has a picture assigned but didn't before. If so, use userpoints_userpointsapi() to grant the user the number of points you want.

Something like this:

function yourmodule_user_update(&$edit, $account, $category) {
  if (!empty($edit['picture'] && empty($account->picture)) {
    $params = array(
      'uid' => $account->uid,
      'points' => 10,
      // You probably want to provide additional arguments, 
      // refer to the API documentation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.