Skip to content

Commit

Permalink
Removed use of using '(none)' to indicate no user photo
Browse files Browse the repository at this point in the history
Now pass just an empty string.
  • Loading branch information
eSilverStrike committed Mar 20, 2020
1 parent 1ce3d32 commit 7d29216
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
3 changes: 0 additions & 3 deletions system/lib-article.php
Expand Up @@ -295,9 +295,6 @@ function STORY_renderArticle($story, $index = '', $storyTpl = 'articletext.thtml
$photo = '';
if ($_CONF['allow_user_photo'] == 1) {
$authphoto = $story->DisplayElements('photo');
if (empty($authphoto)) {
$authphoto = '(none)'; // user does not have a photo
}
$photo = USER_getPhoto($story->DisplayElements('uid'), $authphoto,
$story->DisplayElements('email'));
}
Expand Down
3 changes: 0 additions & 3 deletions system/lib-comment.php
Expand Up @@ -382,9 +382,6 @@ function CMT_getComment(&$comments, $mode, $type, $order, $delete_option = false
$altText = $fullname;
$photo = '';
if ($_CONF['allow_user_photo']) {
if (isset($A['photo']) && empty($A['photo'])) {
$A['photo'] = '(none)';
}
$photo = USER_getPhoto($A['uid'], $A['photo'], $A['email'], PLG_getThemeItem('comment-width-user-avatar', 'comment'), PLG_getThemeItem('comment-css-user-avatar', 'comment'));
}
$profile_link = $_CONF['site_url'] . '/users.php?mode=profile&uid=' . $A['uid'];
Expand Down
17 changes: 10 additions & 7 deletions system/lib-user.php
Expand Up @@ -424,6 +424,12 @@ function USER_getPhoto($uid = 0, $photo = '', $email = '', $width = 0, $cssClass

$userPhoto = '';

// Older versions of Geeklog and plugins may pass $photo = '(none)'
// Lets get away from passing this to indicate no user photo. Use an empty string instead
if ($photo === '(none)') {
$photo = '';
}

if ($_CONF['allow_user_photo'] == 1) {
if (($width == 0) && !empty($_CONF['force_photo_width'])) {
$width = $_CONF['force_photo_width'];
Expand All @@ -443,22 +449,22 @@ function USER_getPhoto($uid = 0, $photo = '', $email = '', $width = 0, $cssClass
if (empty($email)) {
$email = $_USER['email'];
}
if (!empty($_USER['photo']) && (empty($photo) || ($photo === '(none)'))) {
if (!empty($_USER['photo']) && (empty($photo))) {
$photo = $_USER['photo'];
}
}
if ((empty($photo) || ($photo === '(none)')) || (empty($email) && $_CONF['use_gravatar'])) {
if ((empty($photo) || (empty($email) && $_CONF['use_gravatar'])) {
$result = DB_query("SELECT email,photo FROM {$_TABLES['users']} WHERE uid = '{$uid}'");
list($newEmail, $newPhoto) = DB_fetchArray($result);
if (empty($photo) || ($photo === '(none)')) {
if (empty($photo)) {
$photo = $newPhoto;
}
if (empty($email)) {
$email = $newEmail;
}
}

if (empty($photo) || ($photo == 'none')) {
if (empty($photo)) {
// no photo - try gravatar.com, if allowed
if ($_CONF['use_gravatar']) {
$img = 'https://www.gravatar.com/avatar/' . md5($email);
Expand Down Expand Up @@ -1209,9 +1215,6 @@ function USER_showProfile($uid, $preview = false, $msg = 0, $plugin = '')
$user_templates->set_var('user_edit', $edit_link_url);
}

if (isset($A['photo']) && empty($A['photo'])) {
$A['photo'] = '(none)'; // user does not have a photo
}
$photo = USER_getPhoto($uid, $A['photo'], $A['email'], -1);
$user_templates->set_var('user_photo', $photo);

Expand Down

0 comments on commit 7d29216

Please sign in to comment.