Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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);
}
Comment | File | Size | Author |
---|---|---|---|
#4 | userpoints-display_message-1317820-4.patch | 613 bytes | dafeder |
Comments
Comment #1
gumol CreditAttribution: gumol commentedHmm.
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:
What do you think about it?
Comment #2
dafederI 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.
Comment #3
dafederHmmm... the problem with both versions is that it treats ($params['display'] === NULL) and ($params['display'] == false) the same. Working on a better alternative.
Comment #4
dafederI think this gets it right.
Comment #5
dafederComment #7
zazinteractive CreditAttribution: zazinteractive commentedThanks dafeder, that worked for me
Comment #8
crea CreditAttribution: crea commented#4 looks good
Comment #9
crea CreditAttribution: crea commentedComment #10
manuel.adanClosing this as outdated, 6.x version is no longer maintained.