Expand settings for the Guest group

Add settings for displaying avatars, signatures, emoticons and images in messages/signatures.
This commit is contained in:
Visman 2021-12-06 22:57:38 +07:00
parent 95613e85e6
commit bd5c24076b
3 changed files with 75 additions and 13 deletions

View file

@ -24,6 +24,7 @@ class Groups extends Admin
$this->c->Lang->load('validator');
$this->c->Lang->load('admin_groups');
$this->c->Lang->load('profile');
$groupsList = [];
$groupsNew = [];
@ -271,7 +272,15 @@ class Groups extends Admin
]);
}
if (! $group->groupGuest) {
if ($group->groupGuest) {
$v->addRules([
'a_guest_set.show_smilies' => 'required|integer|in:0,1',
'a_guest_set.show_sig' => 'required|integer|in:0,1',
'a_guest_set.show_avatars' => 'required|integer|in:0,1',
'a_guest_set.show_img' => 'required|integer|in:0,1',
'a_guest_set.show_img_sig' => 'required|integer|in:0,1',
]);
} else {
$v->addRules([
'g_promote_next_group' => 'required|integer|min:0|not_in:' . $notNext,
'g_promote_min_posts' => 'required|integer|min:0|max:9999999999',
@ -330,7 +339,13 @@ class Groups extends Admin
}
foreach ($data as $attr => $value) {
$group->$attr = $value;
if ('a_guest_set' === $attr) {
$this->c->config->a_guest_set = $value;
$this->c->config->save();
} else {
$group->$attr = $value;
}
}
if (null === $group->g_id) {
@ -577,7 +592,43 @@ class Groups extends Admin
'help' => 'User list search help',
];
if (! $group->groupGuest) {
if ($group->groupGuest) {
$fieldset['a_guest_set[show_smilies]'] = [
'type' => 'radio',
'value' => $this->c->config->a_guest_set['show_smilies'] ?? 0,
'values' => $yn,
'caption' => 'Smilies label',
'help' => 'Smilies info',
];
$fieldset['a_guest_set[show_sig]'] = [
'type' => 'radio',
'value' => $this->c->config->a_guest_set['show_sig'] ?? 0,
'values' => $yn,
'caption' => 'Sigs label',
'help' => 'Sigs info',
];
$fieldset['a_guest_set[show_avatars]'] = [
'type' => 'radio',
'value' => $this->c->config->a_guest_set['show_avatars'] ?? 0,
'values' => $yn,
'caption' => 'Avatars label',
'help' => 'Avatars info',
];
$fieldset['a_guest_set[show_img]'] = [
'type' => 'radio',
'value' => $this->c->config->a_guest_set['show_img'] ?? 0,
'values' => $yn,
'caption' => 'Images label',
'help' => 'Images info',
];
$fieldset['a_guest_set[show_img_sig]'] = [
'type' => 'radio',
'value' => $this->c->config->a_guest_set['show_img_sig'] ?? 0,
'values' => $yn,
'caption' => 'Images sigs label',
'help' => 'Images sigs info',
];
} else {
$fieldset['g_send_email'] = [
'type' => 'radio',
'value' => $group->g_send_email,

View file

@ -1204,6 +1204,15 @@ class Install extends Admin
'a_bb_white_sig' => \json_encode(['b', 'i', 'u', 'color', 'colour', 'email', 'url'], self::JSON_OPTIONS),
'a_bb_black_mes' => \json_encode([], self::JSON_OPTIONS),
'a_bb_black_sig' => \json_encode([], self::JSON_OPTIONS),
'a_guest_set' => \json_encode(
[
'show_smilies' => 1,
'show_sig' => 1,
'show_avatars' => 1,
'show_img' => 1,
'show_img_sig' => 1,
], self::JSON_OPTIONS
),
];
foreach ($pun_config as $conf_name => $conf_value) {

View file

@ -150,16 +150,18 @@ class Users extends Manager
}
}
return $this->create(
[
'id' => 0,
'group_id' => FORK_GROUP_GUEST,
'time_format' => 0,
'date_format' => 0,
]
+ $attrs
+ $cache
);
$set = [
'id' => 0,
'group_id' => FORK_GROUP_GUEST,
'time_format' => 0,
'date_format' => 0,
] + $attrs;
if (isset($this->c->config->a_guest_set)) {
$set += $this->c->config->a_guest_set;
}
return $this->create($set + $cache);
}
/**