Hello @Xon
I used PHP callback to get user groups with
As you can see below, there is no problem at this stage.
I've
How can I set in this php file if secondary user group is
I know this service as below but I do not want to add new user group I want to use the group specified in the option.
I 've not reached to success result yet with the my codes but I have to try, and I think I need to learn that.
Thank you for your help.
I used PHP callback to get user groups with
XF\Option\UserGroup::renderSelect
.As you can see below, there is no problem at this stage.
I've
Templater.php
file, base class name: XF\Template\TemplaterHow can I set in this php file if secondary user group is
xUserGroup
via PHP Could you please anyone let me learn or see sample?
Code:
namespace Validator\XF\Template;
class Templater extends XFCP_Templater
{
public function fnUsernameLink($templater, &$escape, $user, $rich = false, $attributes = [])
{
$isAddonEnabledGlobally =! \XF::options()->offsetGet('enableXAddon');
if(!$isAddonEnabledGlobally)
{
/**if secondary group_id == xUserGroup*/
{ My codes......
}
}
return $response;
}
}
I know this service as below but I do not want to add new user group I want to use the group specified in the option.
PHP:
/** @var \XF\Service\User\UserGroupChange $userGroupChange */
$userGroupChange = \XF::service('XF:UserGroupChange');
$userGroupChange->addUserGroupChange($user->user_id, '<a key describing the change>', [<array of user group ids to add to>]);
I 've not reached to success result yet with the my codes but I have to try, and I think I need to learn that.
Thank you for your help.