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

Change user group script.

#1
Hi!
I just installed XenForo (AWZOME) to my webspace and I am setting up a script that allow my mods to change user group ingame and on the forum.

I am making own groups for what I call RANKS in game, and my question is:

Can I just change user_group_id for username in xf_user table for changes to affect?

To describe what Il try to achive:
On my game server it is already coded, but I want my users to have the same rank on my XenForo forum, so when i hit a button that says "promote" the user will get a new "user_group_id" so he is promoted from Group1 to Group2.

Is this possible? Thanks for all answears :)

( Maby this sould be in http://xenforo.com/community/forums/xenforo-development-discussions.34/ ? )
//Zw
 

Brogan

XenForo moderator
Staff member
#2
Can I just change user_group_id for username in xf_user table for changes to affect?
No.

Doing so won't correctly update the permission_combination_id field in the xf_user table.

You will need to use the data writer and replicate the code functionality which is involved when adding or moving a member to a user group in the ACP.

There is already an add-on which does this: http://xenforo.com/community/resources/join-user-group.225/

In addition, you shouldn't be changing the primary user group: http://xenforo.com/community/threads/understanding-permissions.5830/page-6#post-323084
 
#3
Thank you for your time and anwear.

What I am looking for (that i created in Wordpress Il used before):
A "moderator" tab that has a subpage (that is already coded, so I can paste it to a php file) where moderators can click "promote" on a user, then the script for promoting him ingame will be sent.
I also want him to be promoted to a new group at the same time in XenForo forum.

So i need to create a TAB in the navigation bar that only mod can access and see the pages in it.

Is this possible?
 

Jake Bunce

XenForo moderator
Staff member
#5
So i need to create a TAB in the navigation bar that only mod can access and see the pages in it.
Two approaches:

1) Create an addon that has its own nav tab and permissions. Here is a basic skeleton:

http://xenforo.com/community/threads/guide-custom-pages-with-navigation-tabs.5406/

2) You may be able to save yourself some coding by using a page node with this addon:

http://xenforo.com/community/resources/nodes-as-tabs.9/

- create a page node
- specify a php callback for the page node to handle the actual content of the page and promotion requests (the actual coding of the page)
- use the Nodes As Tabs addon to display the page node as a nav tab with permissions (all handled by the addon, saving you some coding)