¡Hola, amigos! I’m Señor FAQ, the mustached maestro of questions and answers! With my trusty glasses and a book of endless wisdom, I turn dudas into solutions. Soy el héroe de los curiosos and the champion of clarity.
admin_usergroup_save
The admin_usergroup_save
hook allows plugins to handle custom data processing
after a user group is saved in the admin interface.
DynamicHooks::executeHook('admin_usergroup_save', false, $jkp["ugid"], $jkp);
// Example Implementation
DynamicHooks::addHook('admin_usergroup_save', function ($userGroupId, $data) use ($jakdb) {
$pluginId = $jakdb->get('plugins', 'id', ['name' => 'Your_Plugin_Name']);
$comment_access = isset($data["comment_access"]) && $data["comment_access"] == 1 ? 1 : 0;
if (is_numeric($userGroupId)) {
$existing = $jakdb->get('plugin_data', 'id', [
'plugin_item_id' => $userGroupId,
'plugin_id' => $pluginId,
'meta_key' => 'comment_access',
]);
if ($existing) {
$jakdb->update('plugin_data', [
'meta_value' => $comment_access,
], [
'id' => $existing,
]);
} else {
$jakdb->insert('plugin_data', [
'plugin_id' => $pluginId,
'plugin_item_id' => $userGroupId,
'meta_key' => 'comment_access',
'meta_value' => $comment_access,
]);
}
}
}, 'your_plugin');