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

User Group questions

Jeremy

Well-known member
#2
1) XenForo_DataWriter_UserGroup
2) Use a user group promotion, it'll be the easiest. Here's a snippet from my license validation code:
PHP:
<?php
        $userModel = XenForo_Model::create('XenForo_Model_User');
        $userModel->removeUserGroupChange($userId, 'xiLicenseValidationValidated'); // remove the record so that if they aren't in the group, they'll be promoted.
        $userModel->addUserGroupChange($userId, 'xiLicenseValidationValidated', XenForo_Application::get('options')->xilicensevalidationGroup);
3. Where are you checking user group membership?
 
#3
1) Could you post a little example snippet? If it's too much I'll just try to figure it out myself.
3) Either inside a ControllerPublic action or View's renderHtml.
 

Jeremy

Well-known member
#4
If you are checking it inside of a view, you should just use the xen helper ismemberof. See Brogan's resource, he explains how to use it. As for creating it, you should look into how XenForo_ControllerAdmin_UserGroup::actionSave() uses XenForo_DataWriter_UserGroup.