What is permission_combination_id?

I'm working on an external script to sync user's ranks from Minecraft to their XenForo account. I've set their secondary_group_ids and display_style_group_id with a MySQL query, but the permission_combination_id is definitely concerning.

How do I calculate the permission_combination_id? or is there a way to force XenForo to calculate it?
 
If you can, I'd highly recommend using the XF framework to make these sorts of changes instead of interfacing with MySQL directly. Updating things via DataWriters should make sure the changes cascade and everything else gets updated accordingly.
 
If you can, I'd highly recommend using the XF framework to make these sorts of changes instead of interfacing with MySQL directly. Updating things via DataWriters should make sure the changes cascade and everything else gets updated accordingly.
How do you suggest I begin to learn more about this?
 
How do you suggest I begin to learn more about this?
The developer documentation is lacking, so the only good suggestion I can make isn't a satisfying one... read through existing code. Try to find a place in the core that's doing what you need to do, and see how it does it. For this case, I'd recommend XenForo_ControllerAdmin_User::actionSave().

You will need to bootstrap the XF framework in your custom script:
PHP:
<?php

$startTime = microtime(true);
$fileDir = dirname(__FILE__); // may need to adjust this to point to XF root

require($fileDir . '/library/XenForo/Autoloader.php');
XenForo_Autoloader::getInstance()->setupAutoloader($fileDir . '/library');

XenForo_Application::initialize($fileDir . '/library', $fileDir);
XenForo_Application::set('page_start_time', $startTime);

From there you can use objects and methods from XF. I've taken some of the following from the method I named above. To get the existing secondary group IDs, you might need to first query the user using XenForo_Model_User.
PHP:
$writer = XenForo_DataWriter::create('XenForo_DataWriter_User');

$writer->setExistingData($userId);
$writer->setSecondaryGroups($secondaryGroupIds); // this needs to contain any existing secondary group ids too

$writer->save();
 
Back
Top Bottom