When I enable the userpoints module (latest dev) I get 30+ instances of the following notices and warnings:
Notice: Undefined index: userpoints in _token_build_tree() (line 736 of /var/www/sites/all/modules/token/token.module).
Warning: Invalid argument supplied for foreach() in _token_build_tree() (line 736 of /var/www/sites/all/modules/token/token.module).
As well as a single instance of:
Notice: Undefined index: maxuserpoints in _token_build_tree() (line 736 of /var/www/sites/all/modules/token/token.module).
Warning: Invalid argument supplied for foreach() in _token_build_tree() (line 736 of /var/www/sites/all/modules/token/token.module).
I have the latest dev of token enabled. I suspect this is more a problem in token than userpoints, but thought I would check.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | userpoints-tokens-1115984-9.patch | 1.35 KB | dgynn |
Comments
Comment #1
Sborsody commentedsubscribe
Comment #2
shadowmihai commented+1
Comment #3
BenK commentedHmmm... let's see what Berdir thinks about this. I don't have this problem at all, but I'm also not quite up to date with the latest -dev of Token.
Can you downgrade Token to an earlier version and see if problems persist? I'm using a -dev version of Token from Jan 12, 2011, and don't have any problems.
--Ben
Comment #4
berdirI can confirm that this issue exists, I'm seeing it too sometimes, although only 2-3 times and not 30+. I am also not sure yet when exactly it happens. Will investigate.
Comment #5
shadowmihai commentedI get it 30+ times - once for each user and it started with the last update of userpoints. I therefore think it is a userpoints issue, not a tokens issue, but the userpoints people closed it and said it was being dealt with here.
>> it would seem obvious that if it doesn't happen with userpoints beta 1 and does with beta 2 - and tokens didn't change in the meaintime, it is a userpoints issue and not a tokens issue. But then I'm not a coder...
Comment #6
Sborsody commentedI get these messages most of the time when viewing the module list page.
Comment #7
berdirActually, I think I saw some other errors that are now gone after I updated some modules.
Are you sure that you are using the most recent version of both userpoints and token? The dev versions, I mean. token-7.x-1.0-beta1 is from january, which is rather old.
Comment #8
orendain commentedI had this same issue when updating to the latest userpoints release. Updating tokens to the latest dev version cleared it up.
Edit: Scratch that - errors still appear.
Comment #9
dgynn commentedI see this error when no userpoints categories have been defined. I've attached a patch that resolves the issue and seems to generate the right replacement values, even when no categories are used.
Comment #10
orendain commentedThanks for the patch - seems to be working fine.
Comment #11
berdirRemember to set issues to needs review when you post patches.
Other than that, looks good, will verify and commit soon!
Comment #12
berdirThanks, committed.
Comment #13
Adam S commentedWhat about the case when there isn't any Userpoints terms yet? The
if (count($categories) > 1){statement is not met and there will be no userpoint tokens and this error will occur. Can we have a default term to go with the default vocabulary?Comment #14
berdirThat's exactly what this patch fixed by moving the all token out of that if condition so that there is always at least that.
Comment #15
Adam S commentedYep, #9 works just great.