Hi.

I have code:

		$pointsParams = array(
		  'uid' => $high_user->uid,
		  'points' => $pointsHowMuch,
		  'display' => FALSE,
		  'tid' => 9,
		  );
		  
		userpoints_userpointsapi($pointsParams);

So I don't want to show message to the user (display => FALSE).

Here is a bug IMHO in module, which displays the message when I set display => FALSE.
userpoints.module line 709:

  if ($mesg && (!empty($params['display']) || (empty($params['display']) && variable_get(USERPOINTS_DISPLAY_MESSAGE, 1) == 1))) {
    drupal_set_message($mesg);
  }

It should be replaced with:

  if ($mesg && (!empty($params['display']) || (!empty($params['display']) && variable_get(USERPOINTS_DISPLAY_MESSAGE, 1) == 1))) {
    drupal_set_message($mesg);
  }
CommentFileSizeAuthor
#4 userpoints-display_message-1317820-4.patch613 bytesdafeder
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

gumol’s picture

Hmm.

On the other hand, when someone sets display => TRUE and have settings USERPOINTS_DISPLAY_MESSAGE set to 0, he don't want to see the message so correct is:

  if ($mesg && (!empty($params['display']) || (variable_get(USERPOINTS_DISPLAY_MESSAGE, 1) == 1)) {
    drupal_set_message($mesg);
  }

What do you think about it?

dafeder’s picture

I think you had it right the first time, gumol. USERPOINTS_DISPLAY_MESSAGE should be thought of as the default setting. So, if I have set $params['display'] in my code, I would want the module to follow what $params['display'] says to do no matter what the default is.

dafeder’s picture

Hmmm... the problem with both versions is that it treats ($params['display'] === NULL) and ($params['display'] == false) the same. Working on a better alternative.

dafeder’s picture

I think this gets it right.

dafeder’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, userpoints-display_message-1317820-4.patch, failed testing.

zazinteractive’s picture

Thanks dafeder, that worked for me

crea’s picture

#4 looks good

crea’s picture

Status: Needs work » Needs review
manuel.adan’s picture

Issue summary: View changes
Status: Needs review » Closed (outdated)

Closing this as outdated, 6.x version is no longer maintained.