Closed (fixed)
Project:
Answers Userpoints
Version:
7.x-1.1
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
22 Sep 2012 at 10:42 UTC
Updated:
11 Mar 2013 at 06:20 UTC
I get multiple notices of the type
Notice: Trying to get property of non-object in aup_preprocess() line 38 of /home/hameer3/public_html/sites/all/modules/aup/aup.module).
In most pages related to the Answer module in general.
Comments
Comment #1
hameerabbasi commentedThe message went away after enabling Rules UI.
Comment #2
chipcleary commentedThanks for submitting this.
A quick update. I validated on a fresh install that I get the same notices. However, enabling Rules UI does not eliminate them for me.
I will investigate further.
Comment #3
chipcleary commentedOK. This should now be fixed.
How to fix an existing site
You do not need to change the code in the module.
Run this code in a php window:
Note: Even if you install the new dev version mentioned below, you will need to make sure that aup_install is run. You can do this by using the above code or the "Reinstall Module" function of the devel module. This is because hook_install functions are not run automatically when you simply disable/re-enable a module using the module UI.
How to avoid the problem in a new site
Please use the new 7.x-1.x-dev version.
What is happening?
For the curious ....
AUP relies on UserPoints. UserPoints employs its own vocabulary and a set of vocabulary terms to track points. It allows others to create their own terms if they want to track their specific categories of points. AUP employs such a custom term.
AUP previously assumed that UserPoints created its vocabulary on installation. This is wrong, the vocabulary is only created on demand. Because of this, AUP was failing to create its term. That led to the error message seen.
The fix was simply to trigger UserPoints to create its vocabulary before AUP creates its term.
Comment #4
hameerabbasi commentedI'm really sorry I cannot test this, as the problem is already fixed on my site.
Comment #5
hameerabbasi commentedTested on fresh install. Fixed.
Comment #6
chipcleary commented