Skip to content

Commit

Permalink
Move gravatar specific settings out of core config
Browse files Browse the repository at this point in the history
Remove gravatar specific configs from config_defaults_inc.php

Fixes #20642
  • Loading branch information
vboctor authored and dregad committed Mar 19, 2016
1 parent 23bca9a commit 7c33226
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 61 deletions.
15 changes: 2 additions & 13 deletions config_defaults_inc.php
Expand Up @@ -1067,19 +1067,8 @@
$g_sort_by_last_name = OFF;

/**
* Show user avatar
*
* The config can be either set to OFF (avatars disabled) or set to a string
* defining the default avatar to be used when none is associated with the
* user's email. Valid values:
* - OFF (default)
* - ON (equivalent to 'identicon')
* - One of Gravatar's defaults (mm, identicon, monsterid, wavatar, retro)
* @link http://en.gravatar.com/site/implement/images/
* - An URL to the default image to be used (for example,
* "http:/path/to/unknown.jpg" or "%path%images/no_avatar.png")
*
* @global integer|string $g_show_avatar
* Show user avatars
* @global integer $g_show_avatar
* @see $g_show_avatar_threshold
*/
$g_show_avatar = OFF;
Expand Down
44 changes: 10 additions & 34 deletions docbook/Admin_Guide/en-US/config/display.xml
Expand Up @@ -190,46 +190,22 @@
<varlistentry>
<term>$g_show_avatar</term>
<listitem>
<para>Show the user's avatar
</para>
<para>The current implementation is based on
<ulink url="http://www.gravatar.com">Gravatar</ulink>;
Users will need to register there the same email address
used in this MantisBT installation to have their avatar
shown.
Please note: upon registration or avatar change, it may
take some time for the updated gravatar images to show
on sites
</para>
<para>The config can be either set to OFF (avatars disabled),
or to a string defining the default avatar to be used
when none is associated with the user's email.
Valid values are:
<itemizedlist>
<listitem><para>OFF (default)</para>
</listitem>
<listitem><para>ON (equivalent to 'identicon')
</para></listitem>
<listitem><para>One of Gravatar's defaults
(mm, identicon, monsterid, wavatar, retro);
refer to
<ulink url="http://en.gravatar.com/site/implement/images/">
Image Requests documentation
</ulink>
for further details.
</para></listitem>
<listitem><para>An URL to the default image to be used
(for example, &quot;http:/path/to/unknown.jpg&quot;
or &quot;%path%images/no_avatar.png&quot;).
</para></listitem>
</itemizedlist>
<para>Show the users' avatar</para>
<para>In addition to enabling this configuration option it is
necessary to install an avatar plugin like the
<ulink url="http://www.gravatar.com">Gravatar</ulink>
plugin which is bundled out of the box.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>$g_show_avatar_threshold</term>
<listitem>
<para>The threshold of users for which MantisBT should attempt to show the avatar (default DEVELOPER). Note that the threshold is related to the user for whom the avatar is being shown, rather than the user who is currently logged in.</para>
<para>
The threshold of users for which MantisBT should show the avatar (default DEVELOPER).
Note that the threshold is related to the user for whom the avatar is being shown,
rather than the user who is currently logged in.
</para>
</listitem>
</varlistentry>
</variablelist>
Expand Down
16 changes: 2 additions & 14 deletions plugins/Gravatar/Gravatar.php
Expand Up @@ -81,13 +81,6 @@ function register() {
* @return array
*/
function config() {
$t_default_avatar = config_get( 'show_avatar' );

# Set default avatar for legacy configuration
if( ON === $t_default_avatar || OFF === $t_default_avatar) {
$t_default_avatar = self::GRAVATAR_DEFAULT_IDENTICON;
}

return array(
/**
* The rating of the avatar to show: 'G', 'PG', 'R', 'X'
Expand All @@ -103,7 +96,7 @@ function config() {
* - An URL to the default image to be used (for example,
* "http:/path/to/unknown.jpg" or "%path%images/avatar.png")
*/
'default_avatar' => $t_default_avatar,
'default_avatar' => self::GRAVATAR_DEFAULT_IDENTICON
);
}

Expand Down Expand Up @@ -144,12 +137,7 @@ function csp_headers() {
* @return object An instance of class Avatar or null.
*/
function user_get_avatar( $p_event, $p_user_id, $p_size = 80 ) {
$t_default_avatar = config_get( 'show_avatar' );

# Set default avatar for legacy configuration
if( ON === $t_default_avatar || OFF === $t_default_avatar ) {
$t_default_avatar = 'identicon';
}
$t_default_avatar = plugin_config_get( 'default_avatar' );

# Default avatar is either one of Gravatar's options, or
# assumed to be an URL to a default avatar image
Expand Down

0 comments on commit 7c33226

Please sign in to comment.