Add & Create Social Media Icons To Profiles

Started by hcfwesker, January 30, 2012, 10:06:52 AM

Previous topic - Next topic

vbgamer45

How so? What would make it better?
It checks if it is empty if it is empty then loads the member data?

Edit ok think I see a couple improvements: Running some tests now.
Community Suite for SMF - Grow your forum with SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com - Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Arantor

Actually... that's not right code I just posted. loadMemberData may have been loaded already for that user, but memberContext may not.

if (!empty($topicinfo['id_member_started']))
{
global $memberContext, $user_profile;
if (empty($user_profile[$topicinfo['id_member_started']]))
loadMemberData($topicinfo['id_member_started']);

loadMemberContext($topicinfo['id_member_started']);
$context['html_headers'] .= '
<link rel="author" href="' . $memberContext[$topicinfo['id_member_started']]['googleplus']['href'] . '" />';
}


Yay for interesting code flow.
Holder of controversial views, all of which my own.


vbgamer45

Ok. Just changed it to


if (!empty($topicinfo['id_member_started']))
{
    global $memberContext;
   
    if (!isset($memberContext[$topicinfo['id_member_started']]['googleplus']['href']))
    {
        loadMemberData($topicinfo['id_member_started']);
        loadMemberContext($topicinfo['id_member_started']);
    }
   
   if (!empty($memberContext[$topicinfo['id_member_started']]['googleplus']['href']))
        $context['html_headers'] .= '
<link rel="author" href="' .$memberContext[$topicinfo['id_member_started']]['googleplus']['href'].'" />';
}


But will make another change to get closer to yours
Community Suite for SMF - Grow your forum with SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com - Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

vbgamer45

Final version works thanks to Arantor for performance improvements.


SEO tip if using this mod and a user has google plus

Find in sources/display.php after aound line 401

// Censor the title...
censorText($topicinfo['subject']);
$context['page_title'] = $topicinfo['subject'];

Add after


if (!empty($topicinfo['id_member_started']))
{
    global $memberContext, $user_profile;

if (empty($user_profile[$topicinfo['id_member_started']]))
loadMemberData($topicinfo['id_member_started']);

loadMemberContext($topicinfo['id_member_started']);
   
   if (!empty($memberContext[$topicinfo['id_member_started']]['googleplus']['href']))
        $context['html_headers'] .= '
<link rel="author" href="' .$memberContext[$topicinfo['id_member_started']]['googleplus']['href'].'" />';
}




Community Suite for SMF - Grow your forum with SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com - Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

NekoJonez

At the mod dev. The additional added custom icons... Hidden for guests, is that fixed in the package you can download?

(I know how to fix it, I'm just curious if it's included in the latest version of the mod)
Retro video game blogger, writer, actor, podcaster and general amazing dude.

Twitter
My Blog

Arantor

SMF actually hides most of the normal icons from guests too (just not profile fields) since it's not particularly nice to share things with guests when you're giving out contact details...
Holder of controversial views, all of which my own.


NekoJonez

Here is a possible idea for a future update:

If there are many social networks to display, let the user choose which ones to display in the posts.
Retro video game blogger, writer, actor, podcaster and general amazing dude.

Twitter
My Blog

grimmoire

Hello!

First, thanks for great mod.

I have one small problem when i add custom profile field.

SMF 2.0.8, Add Social Media Icons To Profiles    1.1.0, Orange Crush theme by Mick G. No errors during installation.

For example, i added "vkontakte" field and this is only one field, that i filled in profile. And i get this (in Opera, Firefox and others):



<ul class="reset smalltext" id="msg_4_extra_info">
<li class="membergroup">Дипломат | Администратор</li>
<li class="postgroup">Разговорчивый</li>
<li class="stars"><img src="http://board.crownoforion.com/Themes/OrangeCrush/images/diplomat.png" alt="*" /></li>
<li class="avatar">
<a href="http://board.crownoforion.com/index.php?action=profile;u=1">
<img class="avatar" src="http://board.crownoforion.com/index.php?action=dlattach;attach=2;type=avatar" alt="" />
</a>
</li>
<li class="postcount">Сообщений: 53</li>
<li><a href="http://vk.com/grimmoire" title="ВКонтакте - http://vk.com/grimmoire" /><img src="http://board.crownoforion.com/Themes/OrangeCrush/images/smivk.png" /></a></li>
</ul>
</li>
<li class="profile">
<ul>
<li><a href="http://board.crownoforion.com/index.php?action=profile;u=1"><img src="http://board.crownoforion.com/Themes/OrangeCrush/images/icons/profile_sm.gif" alt="Просмотр профиля" title="Просмотр профиля" /></a></li>
<li><a href="http://board.crownoforion.com/index.php?action=pm;sa=send;u=1" title="Личное сообщение (Онлайн)"><img src="http://board.crownoforion.com/Themes/OrangeCrush/images/im_on.gif" alt="Личное сообщение (Онлайн)" /></a></li>
</ul>
</li>
</ul>


But if i filled one of predefined fields (facebook, for example) all displayed fine:



<ul class="reset smalltext" id="msg_4_extra_info">
<li class="membergroup">Дипломат | Администратор</li>
<li class="postgroup">Разговорчивый</li>
<li class="stars"><img src="http://board.crownoforion.com/Themes/OrangeCrush/images/diplomat.png" alt="*" /></li>
<li class="avatar">
<a href="http://board.crownoforion.com/index.php?action=profile;u=1">
<img class="avatar" src="http://board.crownoforion.com/index.php?action=dlattach;attach=2;type=avatar" alt="" />
</a>
</li>
<li class="postcount">Сообщений: 53</li>
<li class="im_icons">
<ul>




</ul>
</li>
<li class="im_icons">
<ul>
<li><a href="http://www.facebook.com/grimuars" target="_blank" title="Facebook - grimuars"><img src="http://board.crownoforion.com/Themes/OrangeCrush/images/smifacebook.png" alt="Facebook" border="0" /></a></li>







<li><a href="http://vk.com/grimmoire" title="ВКонтакте - http://vk.com/grimmoire" /><img src="http://board.crownoforion.com/Themes/OrangeCrush/images/smivk.png" /></a></li>
</ul>
</li>
<li class="profile">
<ul>
<li><a href="http://board.crownoforion.com/index.php?action=profile;u=1"><img src="http://board.crownoforion.com/Themes/OrangeCrush/images/icons/profile_sm.gif" alt="Просмотр профиля" title="Просмотр профиля" /></a></li>
<li><a href="http://board.crownoforion.com/index.php?action=pm;sa=send;u=1" title="Личное сообщение (Онлайн)"><img src="http://board.crownoforion.com/Themes/OrangeCrush/images/im_on.gif" alt="Личное сообщение (Онлайн)" /></a></li>
</ul>
</li>
</ul>


How i can fix this? Thank you!

hcfwesker

The edits are based off the SMF Default theme, if you're using a custom theme that may use another css for the "instant messenger icons", you'll need to change the one for the smi icons to match.

<li class="im_icons">

If it already uses those, then try this edit after the mod is installed ...

Display.template.php

Find
// This shows the social media icons.
if ($message['member']['has_messenger'] && $message['member']['can_view_profile'])
echo '
<li class="im_icons">
<ul>


Replace with
// This shows the social media icons.
if ($message['member']['has_messenger'] && $message['member']['can_view_profile'])
echo '
<li class="im_icons">
<ul class="reset nolist">


Basically just the bottom line needs to be changed.




grimmoire

// This shows the social media icons.
if ($message['member']['has_messenger'] && $message['member']['can_view_profile'])
echo '
<li class="im_icons">
<ul class="reset nolist">
', !isset($context['disabled_fields']['facebook']) && !empty($message['member']['facebook']['link']) ? '<li>' . $message['member']['facebook']['link'] . '</li>' : '', '
', !isset($context['disabled_fields']['myspace']) && !empty($message['member']['myspace']['link']) ? '<li>' . $message['member']['myspace']['link'] . '</li>' : '', '
', !isset($context['disabled_fields']['twitter']) && !empty($message['member']['twitter']['link']) ? '<li>' . $message['member']['twitter']['link'] . '</li>' : '', '
', !isset($context['disabled_fields']['googleplus']) && !empty($message['member']['googleplus']['link']) ? '<li>' . $message['member']['googleplus']['link'] . '</li>' : '', '
', !isset($context['disabled_fields']['linkedin']) && !empty($message['member']['linkedin']['link']) ? '<li>' . $message['member']['linkedin']['link'] . '</li>' : '', '
', !isset($context['disabled_fields']['youtube']) && !empty($message['member']['youtube']['link']) ? '<li>' . $message['member']['youtube']['link'] . '</li>' : '', '
', !isset($context['disabled_fields']['deviantart']) && !empty($message['member']['deviantart']['link']) ? '<li>' . $message['member']['deviantart']['link'] . '</li>' : '', '
', !isset($context['disabled_fields']['pinterest']) && !empty($message['member']['pinterest']['link']) ? '<li>' . $message['member']['pinterest']['link'] . '</li>' : '', '';

// Any custom fields with Social Media?
if (!empty($message['member']['custom_fields']))
{
$shown = false;
foreach ($message['member']['custom_fields'] as $custom)
{
if ($custom['placement'] != 3 || empty($custom['value']))
continue;
if (empty($shown))
{
$shown = true;
}
echo '
<li><a href="', $custom['value'], '" title="', $custom['title'], ' - ', $custom['value'], '" /><img src="', $settings['images_url'], '/', $custom['customsmiicon'], '" /></a></li>';
}
if ($shown)
echo '
</ul>
</li>';
}


I replace  <ul> with <ul class="reset nolist">, but nothing changed, i have the same problem...

hcfwesker

Sorry, custom themes always give issues with MODs, so gonna do the best I can since I can't test myself.  Since you're not using the default installed ones, try making this change ( the reset nolist is being skipped since you're not using the default ones) ...

// This shows the social media icons.
if ($message['member']['has_messenger'] && $message['member']['can_view_profile'])
echo '
<li class="im_icons">
<ul>


// This shows the social media icons.
echo '<li class="im_icons">
     <ul class="reset nolist">';
if ($message['member']['has_messenger'] && $message['member']['can_view_profile'])
echo '


Steelio

hello, i'm trying to install your mod, but im getting an error instead: "You cannot download or install new packages because the Packages directory or one of the files in it are not writable" the full detail of this can be found here: http://www.simplemachines.org/community/index.php?topic=525033.0

i was wondering if theres a way to install this without need to FTP anything to the server? is there something i should tweak before uploading the mod? please help i've been wanting to install this for a while now.  :-\

Arantor

No, because that's a fundamental problem in how SMF actually works - you need to make the files writable and FTP is only one method to doing that.
Holder of controversial views, all of which my own.


Kindred

That is not a problem with this mod... That is an issue on your server... And will be an issue for ANY mod that you try to install.

You need to make the directories and files writeable.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

discjocke

I downloaded the Mod for all social networks and nothing shows under members. I do have a separate Twitter on the bottom of post. Do I have to remove that for the all social network options to show?

Kindred

did you set the options to use/display the social icons?
Did you install it into your custom theme?
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

discjocke

I haven't done this before, but I did checked the "Show view profile button under post" in "Current themes".

I went to "Packages" and chose download and downloaded the saved file from SMF. Not sure if there's anywhere else to go to change settings or download from another section.


Kindred

yup - go to the advanced profile fields settings and set the fields to on/off
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

discjocke

I can't seem to find that option. Under what category on the left is it? Or do I have to set it in "permissions"?

Advertisement: