After updating we got the error of

Notice: Constant USERPOINTS_INVITE_REGISTER_INVITER already defined in /home/oursite/html/sites/all/modules/userpoints_contrib/userpoints_invite/userpoints_invite.install on line 5

Notice: Constant USERPOINTS_INVITE_REGISTER_INVITEE already defined in /home/oursite/html/sites/all/modules/userpoints_contrib/userpoints_invite/userpoints_invite.install on line 6
Can someone please advise

CommentFileSizeAuthor
#6 userpoints_contrib-1166590.patch759 bytesgilgabar

Comments

dave reid’s picture

Project: Token » User Points Contributed modules
Version: 6.x-1.16 » 6.x-1.0-beta1

The error message is coming from userpoints_contrib, not token module. Please confirm which version of userpoints_contrib you are using (6.x-1.0-beta1 or 6.x-1.x-dev).

venusrising’s picture

Hey Dave-
Thanks for the reply. Using User Points Contributed modules 6.x-1.0-beta1

venusrising’s picture

When trying to update another module this error now appears again.

venusrising’s picture

This error appears again on module update it is generating after module updates. Can someone please give me an idea of where to look, I have no idea what is causing this.
Notice: Constant USERPOINTS_INVITE_REGISTER_INVITER already defined in /home/oursite/html/sites/all/modules/userpoints_contrib/userpoints_invite/userpoints_invite.install on line 5

Notice: Constant USERPOINTS_INVITE_REGISTER_INVITEE already defined in /home/oursite/html/sites/all/modules/userpoints_contrib/userpoints_invite/userpoints_invite.install on line 6
Can someone please advise

venusrising’s picture

This error is now popping up when I try to clear the cache form time to time.

gilgabar’s picture

Version: 6.x-1.0-beta1 » 6.x-1.x-dev
Status: Active » Needs review
StatusFileSize
new759 bytes

I'm seeing this too. The error message describes the problem fairly well. A couple of constants are defined twice. Once in userpoints_invite.module and once in userpoints_invite.install. It seems like a pretty gratuitous use of constants anyway, so the best solution might be to not use constants for variable names at all. A simpler solution for now is to just remove the constants from the install file and make the install file load the module file when it runs the function that requires the constants. A patch is attached.

venusrising’s picture

@gilgabar I am not sure how it is under Dev we are actually using 6.x-1.0-beta1 as per #2. Will this work with that too? Is this safe for production as it is our production site that we are seeing this on. Shows up intermittently and on cron run. We do not want this to cause any conflicts with user points and other tie ins like Userpoint badges etc so wanted to clarify.
Thanks for the help!

gilgabar’s picture

It isn't any different on the dev version. It should be fine on a production site. That particular piece of code should only ever be run once and then ignored anyway as it is an update. You have most likely already run that update, so it should be of little concern.

venusrising’s picture

@gilgabar Thanks for the help. I will get it applied and report back.

berdir’s picture

I agree that constants shouldn't be used for this, we tried to remove most of them during the port to 7.x.

Will commit this as soon as someone confirms that this works correctly.

venusrising’s picture

Patched to production site and updated, all seems well so far. Ran cron too and do not see the error any longer but not to sure how to re-create it as it did happen intermittently.

berdir’s picture

Status: Needs review » Fixed

Remove the whole file, that is a 5.x update function, there is no need for it to exist in 6.x-1.x and that was the only function in that file.

venusrising’s picture

@Berdir I applied patch #6 are you saying this issue should not be handled that way, can you please confirm when you say remove file, can you clarify which file.
Thanks all

venusrising’s picture

Status: Fixed » Active
craigritchie’s picture

I just got this for the 7.x-1.0-beta1 version.

simon georges’s picture

Project: User Points Contributed modules » Userpoints Invite
Version: 6.x-1.x-dev » 6.x-1.0-beta1
Status: Active » Patch (to be ported)

Moved to the right issue queue.

simon georges’s picture

tobiberlin’s picture

Still an issue with current D7 version

dojorob76’s picture

subscribe. Just got the same error messages with D7.

jay.lee.bio’s picture

So far I got this notice message just once when I installed the module for D7.

jetwodru’s picture

encountered the same in D7