Skip to content

Commit

Permalink
Merge pull request SimpleMachines#7638 from BrickOzp/gravatar_permission
Browse files Browse the repository at this point in the history
Add permission for using Gravatars
  • Loading branch information
Sesquipedalian committed May 10, 2024
2 parents 7a757ab + d378d10 commit 18e24e9
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
9 changes: 8 additions & 1 deletion Sources/ManagePermissions.php
Expand Up @@ -1157,6 +1157,7 @@ function setPermissionLevel($level, $group, $profile = 'null')
'profile_displayed_name',
'profile_upload_avatar',
'profile_remote_avatar',
'profile_gravatar',
'profile_remove_own',
'report_user',
));
Expand Down Expand Up @@ -1506,6 +1507,7 @@ function loadAllPermissions()
'profile_server_avatar' => array(false, 'profile'),
'profile_upload_avatar' => array(false, 'profile'),
'profile_remote_avatar' => array(false, 'profile'),
'profile_gravatar' => array(false, 'profile'),
'report_user' => array(false, 'profile'),
'profile_identity' => array(true, 'profile_account'),
'profile_displayed_name' => array(true, 'profile_account'),
Expand Down Expand Up @@ -1620,7 +1622,7 @@ function loadAllPermissions()
$hiddenPermissions[] = 'post_attachment';
}

// Hide Likes/Mentions permissions...
// Hide Likes/Mentions/Gravatar permissions...
if (empty($modSettings['enable_likes']))
{
$hiddenPermissions[] = 'likes_like';
Expand All @@ -1629,6 +1631,10 @@ function loadAllPermissions()
{
$hiddenPermissions[] = 'mention';
}
if (empty($modSettings['gravatarEnabled']))
{
$hiddenPermissions[] = 'profile_gravatar';
}

// Provide a practical way to modify permissions.
call_integration_hook('integrate_load_permissions', array(&$permissionGroups, &$permissionList, &$leftPermissionGroups, &$hiddenPermissions, &$relabelPermissions));
Expand Down Expand Up @@ -2348,6 +2354,7 @@ function loadIllegalGuestPermissions()
'profile_remove',
'profile_remote_avatar',
'profile_server_avatar',
'profile_gravatar',
'profile_signature',
'profile_title',
'profile_upload_avatar',
Expand Down
2 changes: 1 addition & 1 deletion Sources/Profile-Modify.php
Expand Up @@ -3278,7 +3278,7 @@ function profileLoadAvatarData()
'allow_server_stored' => (empty($modSettings['gravatarEnabled']) || empty($modSettings['gravatarOverride'])) && (allowedTo('profile_server_avatar') || (!$context['user']['is_owner'] && allowedTo('profile_extra_any'))),
'allow_upload' => (empty($modSettings['gravatarEnabled']) || empty($modSettings['gravatarOverride'])) && (allowedTo('profile_upload_avatar') || (!$context['user']['is_owner'] && allowedTo('profile_extra_any'))),
'allow_external' => (empty($modSettings['gravatarEnabled']) || empty($modSettings['gravatarOverride'])) && (allowedTo('profile_remote_avatar') || (!$context['user']['is_owner'] && allowedTo('profile_extra_any'))),
'allow_gravatar' => !empty($modSettings['gravatarEnabled']),
'allow_gravatar' => !empty($modSettings['gravatarEnabled']) && allowedTo('profile_gravatar'),
);

if ($context['member']['avatar']['allow_gravatar'] && (stristr($cur_profile['avatar'], 'gravatar://') || !empty($modSettings['gravatarOverride'])))
Expand Down
2 changes: 2 additions & 0 deletions Themes/default/languages/ManagePermissions.english.php
Expand Up @@ -162,6 +162,8 @@
$txt['permissionhelp_profile_upload_avatar'] = 'This permission will allow a user to upload their personal avatar to the server.';
$txt['permissionname_profile_remote_avatar'] = 'Choose a remotely stored avatar';
$txt['permissionhelp_profile_remote_avatar'] = 'Because avatars might influence the page creation time negatively, it is possible to disallow certain membergroups to use avatars from external servers.';
$txt['permissionname_profile_gravatar'] = 'Choose a Gravatar';
$txt['permissionhelp_profile_gravatar'] = 'Because Gravatars might influence the page creation time negatively, it is possible to disallow certain membergroups to use Gravatars.';

$txt['permissiongroup_profile_account'] = 'Member Accounts';
$txt['permissionname_profile_identity'] = 'Edit account settings';
Expand Down
1 change: 1 addition & 0 deletions Themes/default/languages/Reports.english.php
Expand Up @@ -119,6 +119,7 @@
$txt['group_perms_name_profile_server_avatar'] = 'Select a server avatar';
$txt['group_perms_name_profile_upload_avatar'] = 'Upload an avatar';
$txt['group_perms_name_profile_remote_avatar'] = 'Choose a remote avatar';
$txt['group_perms_name_profile_gravatar'] = 'Use a Gravatar';
$txt['group_perms_name_profile_remove_any'] = 'Delete any account';
$txt['group_perms_name_profile_remove_own'] = 'Delete own account';
$txt['group_perms_name_profile_title_any'] = 'Edit any custom title';
Expand Down

0 comments on commit 18e24e9

Please sign in to comment.