Resource icon

How to extend user criteria (for use in trophies, upgrades and notices/notifications) 1.0

No permission to download
Hey !

When I create the Code Event Listener I have this error :
Code:
The server responded with an error. The error message is in the JavaScript console.
Help :(
 
That's not the error. It says there will be an error in the console.

There's also likely an error in your server error log.
 
Chris,
Great tutorial, I am writing my first addOn for XenForo and this was a great help. I do have one question, if I wanted to save a new user criteria (say instead of something calculated like has_avatar, I wanted has_degree where the checkbox would save a value of TRUE or FALSE), what is the correct way to go about adding additional values?
Thanks
 
Hi Chris
I bought Gritternotificattion and install it, it is very handy!

I saw this UserCriteriaExample and install it, do I need to do anything with the code?

So, how can the members get the trophy when they put the avatar?

I setup a new Trophy in User > Trophies then in the Awarder Trophy If.. I checked User has an Avatar.

Should this get the member Trophy point in the Alert?
I did try setup myself a new user and add the Trophy but doesn't seem to get any alert regarding the Trophy..
 
Hey Chris!
First of all thanks for the great tutorial!
Followed your tutorial and managed to get it working for what I needed at first but I need something a little different now.
I have the AD Credits addon installed and wanted to make it easy for others to use custom milestones, so I wanted to create an criteria that allowed you to change the amount needed freely. I got it to show just fine but I'm a little confused about where the $data array comes from and how I can add a new key, value to that. This is what I have right now:

PHP:
$userCriteria = $template->getParam('userCriteria');
            $checked = $userCriteria['has_x_currency'] ? 'checked' : '';
            $contents .= '<li>
                            <label>
                                <input type="checkbox" id="ucrit_adcredit" class="Disabler" value="has_x_currency" name="user_criteria[has_x_currency][rule]" ' . $checked .'>
                                User has at least X Yuan:
                            </label>
                            <div id="ucrit_adcredit_Disabler" class="criteriaQualifier disabled">
                                <input type="text" id="ctrl_user_criteriaadcredit" class="textCtrl number SpinBox disabled" min="0" step="7" size="5" value="0" name="user_criteria[has_x_currency][data][has_x_currency]" autocomplete="off" disabled="">
                            </div>
                           </li>';

And the rule part:

PHP:
case 'has_x_currency':
                if ($user['adcredit'] > $data['adcredit'])
                {
                    $returnValue = true;
                }
            break;

In the attachement you can see that it is shown at the right position and how I want it to be shown.
The problem now is that the value of the field isn't saved (it always resets to 0 when I reopen the trophy) and that the comparison seems to compare it 0.

I'm still pretty new to this so my mistakes may be a little clumsy.
Thanks to whoever tries to help me in advance! :)
 

Attachments

  • 2015-10-07 14_55_24-Edit Trophy_ Rich Guy Level 10 _ Admin CP - XenForoTest.webp
    2015-10-07 14_55_24-Edit Trophy_ Rich Guy Level 10 _ Admin CP - XenForoTest.webp
    6.5 KB · Views: 9
Back
Top Bottom