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

Change user group script.

Discussion in 'XenForo Development Discussions' started by Zwirc, Feb 11, 2012.

  1. Zwirc

    Zwirc Member

    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/ ? )
  2. Brogan

    Brogan XenForo Moderator Staff Member


    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. Zwirc

    Zwirc Member

    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?
  4. Zwirc

    Zwirc Member

  5. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Two approaches:

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


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


    - 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)
  6. Zwirc

    Zwirc Member

    Thank you Jake :)
    I will look into it ;)

Share This Page