• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.4 User promotion

kankan

Active member
#1
Hello
I am having two groups :
Members
Donators

I have created a user promotion rules based on a donation rule : promote user belonging to Member group to Donator group if a donation is made.
The rule behaves ok except that the system does not change the primary group but add the user to the Donator secondary group.
Due to this the user does not benefits from the advantages of donator group.

Anyway to change the primary group on user promotion?

Thank you
 

Chris D

XenForo developer
Staff member
#2
No, generally the primary group wouldn't (and shouldn't) need to be changed.

If you do the permissions correctly, then this shouldn't be an issue.
 

kankan

Active member
#3
Thanks Chris D

i have created AD display exception based on group
Donator is group 9

If user is promoted from Members to Donator, then he stills see the ads.
If i set the user to Donator group as a primary group, the ad disapear.

I don't know how to manage to move user to Donator group and grant him the advantage of the group.
He takes only the advantage of the primary group.

Don't know if i am clear
 

kankan

Active member
#4
Just did a batch update to change primary group for those users to Donator group
but this is not a solution :/
 

Chris D

XenForo developer
Staff member
#6
If that is some sort of add-on that is doing the ad exceptions, I would suggest its logic is rather at odds with the best practices that should be taken when setting up user groups and permissions, and the author may want to review that.
 

kankan

Active member
#7
As Chris has said, the primary user group shouldn't be changed. Everyone should have the Registered group as their primary user group. See this guide for details on how permissions work in XenForo:

Implementing permissions across multiple user groups

As for not showing ads to the Donator group, see point 5 of this resource:

Conditional Statements
I have set this condition on pages and it is working OK if users belongs to Donator (as primary group), but not if user belongs to Registered and Donator as a second group.
I understand the logic of permission. Registered has the minimum permission. When i promote a user, it add the user to Donator group (secondary group) but then the Ad is still visible (as if it user does not belongs to group 9 but 1) : user does not inherit to group Donator permissions.
 

Chris D

XenForo developer
Staff member
#8
What are you using to conditionally show ads?

Some sort of add-on? Template conditionals? If you can share some code or more details about how you're doing this we may be able to identify the problem.
 

kankan

Active member
#9
I am using conditionnals.

Ex :

Code:
<xen:if is="!{xen:helper ismemberof, $visitor, 3, 4, 5,9}"><div class="sectionMain"> <center><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Asus Horizontal Haut -->
<ins class="adsbygoogle"
     style="display:inline-block;width:728px;height:90px"
     data-ad-client="ca-pub-xxxxxxxxx"
     data-ad-slot="xxxxxxxx"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script></center></div></xen:if>
 

kankan

Active member
#10
Just realised i got error while editing user promotion :

Template Errors: user_group_promotion_edit
  1. Invalid argument supplied for foreach() in /home/e-smith/files/ibays/forumasus/html/forums/library/XenForo/Template/Abstract.php(265) : eval()'d code, line 177:
    176: $__compilerVar51 = array();
    177: foreach ($nodeCriteriaData['nodes'] AS $_criteriaNode)
    178: {
 

Martok

Well-known member
#11
Are you editing a template called user_group_promotion_edit? Or is this just showing in the error?

It would be helpful to see the whole error message.

Also, I can't find a template called user_group_promotion_edit, so that might be from an add-on. Are you using any user group promotion add-ons?