Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Aiheen aloitti: Gandrel - tammikuu 12, 2020, 03:34:57 AP

Otsikko: Specify avatar by URL text
Kirjoitti: Gandrel - tammikuu 12, 2020, 03:34:57 AP
When you select "Specify avatar by URL" I found where to change the text "http://www.mypage.com/mypic.gif" to "https://www.mypage.com/mypic.gif" in themes/default/languages/Profile.english.php but where do I find where to change the "http://" that appears in the text field?:
Otsikko: Re: Specify avatar by URL text
Kirjoitti: Looking - tammikuu 12, 2020, 09:59:51 AP
Try Profile-Modify.php in Sources:

(see below)
Otsikko: Re: Specify avatar by URL text
Kirjoitti: Shambles - tammikuu 12, 2020, 10:08:41 AP
Lainaus käyttäjältä: Gandrel... where do I find where to change the "http://" that appears in the text field?:

As per the file above, but it's here that I believe you need to make your desired change:

if ($cur_profile['avatar'] == '' && $cur_profile['id_attach'] > 0 && $context['member']['avatar']['allow_upload'])
{
$context['member']['avatar'] += array(
'choice' => 'upload',
'server_pic' => 'blank.gif',
====> 'external' => 'http://'
);
Otsikko: Re: Specify avatar by URL text
Kirjoitti: Looking - tammikuu 12, 2020, 10:37:53 AP
Thanks for that Shambles.
Otsikko: Re: Specify avatar by URL text
Kirjoitti: Gandrel - tammikuu 12, 2020, 09:39:39 IP
K, so I changed the three "http://" to "https://" in the following code to get it to finally display "https://":
if ($cur_profile['avatar'] == '' && $cur_profile['id_attach'] > 0 && $context['member']['avatar']['allow_upload'])
{
$context['member']['avatar'] += array(
'choice' => 'upload',
'server_pic' => 'blank.gif',
'external' => 'https://'
);
$context['member']['avatar']['href'] = empty($cur_profile['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $cur_profile['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $cur_profile['filename'];
}
elseif ((stristr($cur_profile['avatar'], 'http://') || stristr($cur_profile['avatar'], 'https://')) && $context['member']['avatar']['allow_external'])
{
$context['member']['avatar'] += array(
'choice' => 'external',
'server_pic' => 'blank.gif',
'external' => $cur_profile['avatar'],
'external_original' => $cur_profile['avatar']
);

// If we have a proxied imaged, show the original url, not the proxy url.
if ($image_proxy_enabled && !empty($cur_profile['avatar_original']) && $cur_profile['avatar_original'] != $cur_profile['avatar'] && stristr($cur_profile['avatar'], $boardurl . '/proxy.php'))
$context['member']['avatar']['external_original'] = $cur_profile['avatar_original'];
}
elseif ($cur_profile['avatar'] != '' && file_exists($modSettings['avatar_directory'] . '/' . $cur_profile['avatar']) && $context['member']['avatar']['allow_server_stored'])
$context['member']['avatar'] += array(
'choice' => 'server_stored',
'server_pic' => $cur_profile['avatar'] == '' ? 'blank.gif' : $cur_profile['avatar'],
'external' => 'https://'
);
else
$context['member']['avatar'] += array(
'choice' => 'none',
'server_pic' => 'blank.gif',
'external' => 'https://'
);


Before I changed any of the "http://" to "https://", I did a search to see how many "http://" there were in Profile-Modify.php and there was a total of 18... Is it safe to change them all to  "https://"? I'm trying to push as much possible on my forum to use "https://" exclusively, ideally.
Otsikko: Re: Specify avatar by URL text
Kirjoitti: Looking - tammikuu 12, 2020, 09:45:09 IP
Personally, I would only change what is absolutely necessary and leave the rest. The less you modify the easier it is to do upgrades when the time comes.