Buddies Block

Started by Mr. Pedram, June 06, 2013, 09:54:41 AM

Previous topic - Next topic

Mr. Pedram

Link to Mod

Buddies Block v1.0
Add a buddies block to users profile

Features

. Buddies block in users profile with counter
. Manage permissions for each group
. Set number of buddies for showing in block
. Show Add or remove buddy icon in posts

Compatibility

SMF 2.0.x with all themes
RTL Support
UTF-8 Support

Mod by

Mr. Pedram

*This MOD Made Exclusively For Horror Game*
**Using default Facebook's avatar and some inspired from [Tip/Trick]Add Buddy Button On Post by ahrasis and Kays for add or remove buddy icon in posts**


This mod is licensed under a CC BY-NC-ND 3.0
My Modifications:
» Loading For SMF
» Buddies Block
» Redirect Links
» Birthdate On Registration
» PM Warning
» Instagram
» Add Table,Td,Tr Button
» Search Topic & Board Button
Browse All...

FrizzleFried

Why does my permissions screen look nothing like yours?  I am running stock SMF theme.

I have two entries... both say "VIEW BUDDIES BLOCK" with three bubbles to choose from next to it representing A, X, D.   I do not have a drop down with OWN BUDDIES,  OTHERS BUDDIES, etc... my whole permissions screen doesn't have the "tabbed sub selections" shown in your screenshot?!


Shambles

Quote
Why does my permissions screen look nothing like yours?  I am running stock SMF theme.
Could it be that you're using "simple view"? Try changing yours to "classic view" (a tab feature within the permissions screen).

The "A, X, D" may be because you've not got "permissions denials" switched on (Manage Permissions > Settings >  Enable the option to deny permissions"

DeroZ

Hi, nice mode but i've a little problem, how i can hide noavatar.png when users already have one?

look:

FrizzleFried

Yeah... I noticed that too... avatars with transparent backgrounds run over the top of the "NO AVATAR" place holder...

Mr. Pedram

Actually i made this part with css, and there's no option to do this via css. i'll working with php for next update.
but for now, you can try this to hide:

In CSS:

Code (Find) Select
.buddy_avatar img {
    width: 35px;
    height: auto;
    position: relative;
}


Code (Replace) Select
.buddy_avatar img {
    width: 35px;
    height: 35px;
    position: relative;
}
My Modifications:
» Loading For SMF
» Buddies Block
» Redirect Links
» Birthdate On Registration
» PM Warning
» Instagram
» Add Table,Td,Tr Button
» Search Topic & Board Button
Browse All...

FrizzleFried

#6
Well... that stretches the avatars to cover the entire area... however transparent areas still show the "placeholder" below...

EDIT: Thanks for the efforts though... :)  Didn't mean for the above post to sound so ... terse.

;)


Hj Ahmad Rasyid Hj Ismail


Mr. Pedram

My Modifications:
» Loading For SMF
» Buddies Block
» Redirect Links
» Birthdate On Registration
» PM Warning
» Instagram
» Add Table,Td,Tr Button
» Search Topic & Board Button
Browse All...

Cat McFarlane

#9
Hi :-)

Unable to view buddies avatars in profile box. And have just let site testers in, and one of them has asked if there is a notification when you are buddied. Please let me know any screenshots you need re unable to view buddies avatars.

Thanks, Cat

Mr. Pedram

Quote from: Cat McFarlane on August 10, 2013, 03:25:16 PM
Hi :-)

Unable to view buddies avatars in profile box. And have just let site testers in, and one of them has asked if there is a notification when you are buddied. Please let me know any screenshots you need re unable to view buddies avatars.

Thanks, Cat

What theme you are using?
and please attach a screenshot for me.

for second question, it's good idea
maybe in future  ;)
My Modifications:
» Loading For SMF
» Buddies Block
» Redirect Links
» Birthdate On Registration
» PM Warning
» Instagram
» Add Table,Td,Tr Button
» Search Topic & Board Button
Browse All...

Padre gremista

How repair the error in image annexed? The image of members is much large.
www.gremioemfoco.info - A comunidade gremista na internet.

DSystem

Great mod.

Translation to Portuguese Brazil.

<file name="$languagedir/Modifications.portuguese_brazilian.php">
<operation>
<search position="end" />
<add><![CDATA[
//Buddies Block MOD

$txt['bb_enable'] = '<b>Ativar lista de amigos</b> <p><i>(Além disso, verifique as configurações das permissões)</i></p>';
$txt['bb_number'] = 'Número de amigos na lista <p><i>(deixe em branco para default)</i></p>';
$txt['empty_bb'] = ' sua lista de amigos está vazia!';
$txt['empty_bb_owner'] = 'Sua lista de amigos está vazia, ';
$txt['empty_bb_owner_link'] = 'Adicionar como amigo!';
$txt['permissionname_bb_view'] = 'Ver lista de amigos';
$txt['permissionhelp_bb_view'] = 'Essa permissão permite que os usuários exibir lista de amigos no seu perfil.';
$txt['permissionname_bb_view_own'] = 'Meus amigos';
$txt['permissionname_bb_view_any'] = 'Outros amigos';
$txt['bb_icon'] = 'Mostrar ícone Adicionar / Remover amigo em mensagens';
$txt['buddy_add'] = 'Adicionar à lista de amigos';
$txt['buddy_remove'] = 'Remover da Lista de Amigos';
    ]]></add>
</operation>
</file>

<file name="$languagedir/Modifications.portuguese_brazilian-utf8.php" error="skip">
<operation>
<search position="end" />
<add><![CDATA[
//Buddies Block MOD

$txt['bb_enable'] = '<b>Ativar lista de amigos</b> <p><i>(Al&eacute;m disso, verifique as configura&ccedil;&otilde;es das permiss&otilde;es)</i></p>';
$txt['bb_number'] = 'N&uacute;mero de amigos na lista <p><i>(deixe em branco para default)</i></p>';
$txt['empty_bb'] = ' sua lista de amigos est&aacute; vazia!';
$txt['empty_bb_owner'] = 'Sua lista de amigos est&aacute; vazia, ';
$txt['empty_bb_owner_link'] = 'Adicionar como amigo!';
$txt['permissionname_bb_view'] = 'Ver lista de amigos';
$txt['permissionhelp_bb_view'] = 'Essa permiss&atilde;o permite que os usu&aacute;rios exibir lista de amigos no seu perfil.';
$txt['permissionname_bb_view_own'] = 'Meus amigos';
$txt['permissionname_bb_view_any'] = 'Outros amigos';
$txt['bb_icon'] = 'Mostrar í&iacute;cone Adicionar / Remover amigo em mensagens';
$txt['buddy_add'] = 'Adicionar &agrave; lista de amigos';
$txt['buddy_remove'] = 'Remover da Lista de Amigos';
    ]]></add>
</operation>
</file>


DSystem

Quote from: Padre gremista on July 07, 2014, 11:52:48 PM
How repair the error in image annexed? The image of members is much large.

The size of the work perfectly here.

You get errors during installation?

Press F5 in your browser. Maybe you haven't updated the index.css

Os tamanho dos funcionaram perfeitamente aqui.
Você obteve erros durante a instalação?
Pressione F5 no seu navegador. Talvez não tenha atualizado o index.css

Padre gremista

Quote from: DSystem on July 09, 2014, 09:15:04 AM
Quote from: Padre gremista on July 07, 2014, 11:52:48 PM
How repair the error in image annexed? The image of members is much large.

The size of the work perfectly here.

You get errors during installation?

Press F5 in your browser. Maybe you haven't updated the index.css

Os tamanho dos funcionaram perfeitamente aqui.
Você obteve erros durante a instalação?
Pressione F5 no seu navegador. Talvez não tenha atualizado o index.css

Yes, it works. Thanks. Nice mod.
www.gremioemfoco.info - A comunidade gremista na internet.

gaurav09

i installed : http://www.simplemachines.org/community/index.php?topic=505334.0
and it is awesome mod but a problem in it :(
in profile buddies images are showing so big that it's coming in full page..And big images are not resizing itself into small.
Moreover buddies block is coming in between description of a user.
=========================
http://i.imgur.com/ogV4i7u.jpg
http://i.imgur.com/8V85WwR.jpg
=============================
i am using 2.0.8 smf version.

please fix the error.

ittiphol

from this mod

http://custom.simplemachines.org/mods/index.php?mod=3681

how to

1 resize avatar
2 display name
3 show to index page

thank you  ;)

samborabora

Just install Buddy's Block, works so far on the profile page as it should. Tried to add it to a SimplePortal block, which should just take Custom PHP, and works for other scripts in there, how can I get this to display in SimplePortal? I'm just showing the block on the Board Index.

margarett

Which code are you using in SP?
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

samborabora

Quote from: margarett on July 23, 2014, 04:15:35 PM
Which code are you using in SP?

Sorry, I forgot to post that bit!  :-\


   // Start Buddies Block!

if (!empty($modSettings['bb_enable']) && $context['can_bb_view'])
   {
     echo'
<div class="cat_bar">
<h3 class="catbg">
<span class="ie6_header floatleft"><img src="', $settings['images_url'], '/icons/online.gif" alt="" class="icon" />
', $txt['buddies'], ' <span>(', count($context['member']['buddies']), ')</span></span></h3></div>
<div class="windowbg">
<span class="topslice"><span></span></span>
<div class="buddy_block">';

   // Show Buddies!

     global $memberContext;
if (empty($modSettings['bb_number']))
          $modSettings['bb_number'] = 20;
          $i=0;
foreach($context['member']['buddies'] as $buddy)
   {
if (++$i > $modSettings['bb_number'])
break;
          $buddy = $memberContext[$buddy];
     echo '
<a title="', $buddy['name'], '" href="', $scripturl, '?action=profile;u=', $buddy['id'], '">
<div id="basicavatar" class="buddy_avatar">', $buddy['avatar']['image'], '</div></a>';
   }

   // If don't have buddy!
if (empty($buddy) && (!$context['user']['is_owner']))
     echo '
<span class="buddy">', $context['member']['name'], '', $txt['empty_bb'], '</span>';

if (empty($buddy) && ($context['user']['is_owner']))
     echo'
<span class="buddy">', $txt['empty_bb_owner'], '<a href="', $scripturl, '?action=profile;area=lists;u=', $context['id_member'], '">', $txt['empty_bb_owner_link'], '</a></span>';

   // End Buddies Block!
     echo'

</div>
<span class="botslice"><span></span></span>
</div>';
   }
     echo'
</div>

margarett

Yeah, I don't know the mod's code (and I'm on the mobile now) but the content is probably loaded in profile context, so it will have nothing to display.
You probably need to reproduce the Sources code also...
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

samborabora

Quote from: margarett on July 23, 2014, 04:50:25 PM
Yeah, I don't know the mod's code (and I'm on the mobile now) but the content is probably loaded in profile context, so it will have nothing to display.
You probably need to reproduce the Sources code also...

Found this in profile.php:

   // Buddies Source!

foreach($context['member']['buddies'] as $buddy)
    {
   loadMemberData($buddy);
   loadMemberContext($buddy);
    }
   $context['can_bb_view'] = allowedTo('bb_view_any') && !$context['user']['is_owner'] || (allowedTo('bb_view_own') && $context['user']['is_owner']);
   
    //End Buddy Source!


Also found this in ManageSettings:
// Enable Buddies Block?
array('check', 'bb_enable'),
array('check', 'bb_icon'),
array('int', 'bb_number'),
array('check', 'cbhbi'),
array('check', 'cbhmi'),
array('check', 'enable_default_avatar'),
array('text', 'default_male_avatar_url'),
array('text', 'default_female_avatar_url'),
array('text', 'default_avatar_url', 'subtext' => $txt['default_avatar_path']),
array('check', 'default_avatar_opacity'),
);


This looked promising in ManagePermissions:
$permissionList = array(
'membergroup' => array(
'smfgallery_view' => array(false, 'smfgallery', 'smfgallery'),
'smfgallery_add' => array(false, 'smfgallery', 'smfgallery'),
'smfgallery_edit' => array(false, 'smfgallery', 'smfgallery'),
'smfgallery_delete' => array(false, 'smfgallery', 'smfgallery'),
'smfgallery_comment' => array(false, 'smfgallery', 'smfgallery'),
'smfgallery_report' => array(false, 'smfgallery', 'smfgallery'),
'smfgallery_autoapprove' => array(false, 'smfgallery', 'smfgallery'),
'smfgallery_manage' => array(false, 'smfgallery', 'smfgallery'),
'view_stats' => array(false, 'general', 'view_basic_info'),
'view_mlist' => array(false, 'general', 'view_basic_info'),
'who_view' => array(false, 'general', 'view_basic_info'),
'search_posts' => array(false, 'general', 'view_basic_info'),
'karma_edit' => array(false, 'general', 'moderate_general'),
'pm_read' => array(false, 'pm', 'use_pm_system'),
'sp_admin' => array(false, 'sp', 'sp'),
'sp_manage_settings' => array(false, 'sp', 'sp'),
'sp_manage_blocks' => array(false, 'sp', 'sp'),
'sp_manage_articles' => array(false, 'sp', 'sp'),
'sp_manage_pages' => array(false, 'sp', 'sp'),
'sp_manage_shoutbox' => array(false, 'sp', 'sp'),
'sp_add_article' => array(false, 'sp', 'sp'),
'sp_auto_article_approval' => array(false, 'sp', 'sp'),
'sp_remove_article' => array(false, 'sp', 'sp'),
'pm_send' => array(false, 'pm', 'use_pm_system'),
'calendar_view' => array(false, 'calendar', 'view_basic_info'),
'calendar_post' => array(false, 'calendar', 'post_calendar'),
'calendar_edit' => array(true, 'calendar', 'post_calendar', 'moderate_general'),
'admin_forum' => array(false, 'maintenance', 'administrate'),
'manage_boards' => array(false, 'maintenance', 'administrate'),
'manage_attachments' => array(false, 'maintenance', 'administrate'),
'manage_smileys' => array(false, 'maintenance', 'administrate'),
'edit_news' => array(false, 'maintenance', 'administrate'),
'access_mod_center' => array(false, 'maintenance', 'moderate_general'),
'moderate_forum' => array(false, 'member_admin', 'moderate_general'),
'manage_membergroups' => array(false, 'member_admin', 'administrate'),
'manage_permissions' => array(false, 'member_admin', 'administrate'),
'manage_bans' => array(false, 'member_admin', 'administrate'),
'send_mail' => array(false, 'member_admin', 'administrate'),
'issue_warning' => array(false, 'member_admin', 'moderate_general'),
'profile_view' => array(true, 'profile', 'view_basic_info', 'view_basic_info'),
'profile_identity' => array(true, 'profile', 'edit_profile', 'moderate_general'),
'profile_extra' => array(true, 'profile', 'edit_profile', 'moderate_general'),
'profile_title' => array(true, 'profile', 'edit_profile', 'moderate_general'),
'profile_remove' => array(true, 'profile', 'delete_account', 'moderate_general'),
'profile_server_avatar' => array(false, 'profile', 'use_avatar'),
'profile_upload_avatar' => array(false, 'profile', 'use_avatar'),
'profile_remote_avatar' => array(false, 'profile', 'use_avatar'),'bb_view' => array(true, 'profile', 'view_basic_info', 'view_basic_info'),


I think that's about all that I could see that would pertain to this issue in the Sources.

margarett

Nop, just the Profile.php part. The rest is for permissions (that are loaded everywhere IIRC) and for the admin settings. But even the profile code misses something. The part of getting each user's buddies.

I would need to check that on the computer. Anyway that seems quite a heavy code to run... If you have, say, 100 friends, you'll run 100 loadMemberData and 100 loadMemberContext. Ouch! :o
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Arantor

Indeed, that's a killer. I would instead suggest:

$loaded = loadMemberData($context['member']['buddies']);
foreach($loaded as $buddy)
    {
   loadMemberContext($buddy);
    }


instead of:
foreach($context['member']['buddies'] as $buddy)
    {
   loadMemberData($buddy);
   loadMemberContext($buddy);
    }


Not only does this reduce the database query count considerably from 2-3 per user to 2-3 flat (and possibly, depending on what you're trying to do, you could even get that down to 1), it even protects you against loading member data for a member that doesn't exist, e.g. deleted account that wasn't purged from buddies properly.
Holder of controversial views, all of which my own.


samborabora

Quote from: ‽ on July 23, 2014, 05:40:01 PM
Indeed, that's a killer. I would instead suggest:

$loaded = loadMemberData($context['member']['buddies']);
foreach($loaded as $buddy)
    {
   loadMemberContext($buddy);
    }


instead of:
foreach($context['member']['buddies'] as $buddy)
    {
   loadMemberData($buddy);
   loadMemberContext($buddy);
    }


Not only does this reduce the database query count considerably from 2-3 per user to 2-3 flat (and possibly, depending on what you're trying to do, you could even get that down to 1), it even protects you against loading member data for a member that doesn't exist, e.g. deleted account that wasn't purged from buddies properly.

Nice, I'll try switching this out with your replacement to see how things improve, maybe the mod author could take a look too if it severely reduces load.

What is buddy block doing exactly that would be preventing this from displaying on the front page? Isn't it just accessing info taht you can see on your own buddies list anyways? This is the hard part, finding which aprt of the chain is preventing it from displaying in an SP block (which I beleive is exactly the same as showing it on Board Index, in this case)

margarett

You are right. But the code in Profile.php doesn't run out of the Profile area. That's why the content is empty in BoardIndex (or in your SP block)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

samborabora

Quote from: margarett on July 23, 2014, 06:06:42 PM
You are right. But the code in Profile.php doesn't run out of the Profile area. That's why the content is empty in BoardIndex (or in your SP block)

What controls where it does run? Can it be copied into another template so it runs in there?

margarett

Yup. In your case it should probably go into your SP block

What controls where it runs is SMF's core. That's why you have so many Sources and so many templates. So that you run only what needs to be ran.
This mod was intended to show its content in the Profile area. So there would be no reason for that computation to be "wasted" in places where the content isn't needed ;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

samborabora

Quote from: margarett on July 23, 2014, 06:37:03 PM
Yup. In your case it should probably go into your SP block

What controls where it runs is SMF's core. That's why you have so many Sources and so many templates. So that you run only what needs to be ran.
This mod was intended to show its content in the Profile area. So there would be no reason for that computation to be "wasted" in places where the content isn't needed ;)

Right, I placed it above, like so:
   // Buddies Source!

foreach($context['member']['buddies'] as $buddy)
    {
   loadMemberData($buddy);
   loadMemberContext($buddy);
    }
   $context['can_bb_view'] = allowedTo('bb_view_any') && !$context['user']['is_owner'] || (allowedTo('bb_view_own') && $context['user']['is_owner']);
   
    //End Buddy Source!

// Start Buddies Block!

if (!empty($modSettings['bb_enable']) && $context['can_bb_view'])
   {
     echo'
<div class="cat_bar">
<h3 class="catbg">
<span class="ie6_header floatleft"><img src="', $settings['images_url'], '/icons/online.gif" alt="" class="icon" />
', $txt['buddies'], ' <span>(', count($context['member']['buddies']), ')</span></span></h3></div>
<div class="windowbg">
<span class="topslice"><span></span></span>
<div class="buddy_block">';

   // Show Buddies!

     global $memberContext;
if (empty($modSettings['bb_number']))
          $modSettings['bb_number'] = 20;
          $i=0;
foreach($context['member']['buddies'] as $buddy)
   {
if (++$i > $modSettings['bb_number'])
break;
          $buddy = $memberContext[$buddy];
     echo '
<a title="', $buddy['name'], '" href="', $scripturl, '?action=profile;u=', $buddy['id'], '">
<div id="basicavatar" class="buddy_avatar">', $buddy['avatar']['image'], '</div></a>';
   }

   // If don't have buddy!
if (empty($buddy) && (!$context['user']['is_owner']))
     echo '
<span class="buddy">', $context['member']['name'], '', $txt['empty_bb'], '</span>';

if (empty($buddy) && ($context['user']['is_owner']))
     echo'
<span class="buddy">', $txt['empty_bb_owner'], '<a href="', $scripturl, '?action=profile;area=lists;u=', $context['id_member'], '">', $txt['empty_bb_owner_link'], '</a></span>';

   // End Buddies Block!


But it still no worky, and it isn't giving any sort of errors or anything so it's difficult to tell what it doesn't like about this?

margarett

Because context -> member -> buddies isn't probably loaded. I'm pretty sure you are missing a database query somewhere before that. Again, I'd need to check the code :(
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Arantor

Well, $context['member'] is the member whose profile you're looking at. If you're elsewhere, e.g. boardindex, you're not looking at someone's profile, so $context['member'] doesn't exist. Whose buddies should you be considering displaying then?
Holder of controversial views, all of which my own.


samborabora

Quote from: ‽ on July 23, 2014, 06:46:45 PM
Well, $context['member'] is the member whose profile you're looking at. If you're elsewhere, e.g. boardindex, you're not looking at someone's profile, so $context['member'] doesn't exist. Whose buddies should you be considering displaying then?

On the block I plan on only displaying my own, the current user's buddies.

Arantor

In which case you want $user_info['buddies'] and you will want to rewrite some of the other code where it tries to compare it to the current user.
Holder of controversial views, all of which my own.


ittiphol

how to show on index page  ???

gaurav09

Quote from: gaurav09 on July 22, 2014, 09:52:48 PM
i installed : http://www.simplemachines.org/community/index.php?topic=505334.0
and it is awesome mod but a problem in it :(
in profile buddies images are showing so big that it's coming in full page..And big images are not resizing itself into small.
Moreover buddies block is coming in between description of a user.
=========================
http://i.imgur.com/ogV4i7u.jpg
http://i.imgur.com/8V85WwR.jpg
=============================
i am using 2.0.8 smf version.

please fix the error.
please help me also   :'( :'(

Mr. Pedram

Quote from: gaurav09 on July 24, 2014, 04:17:49 AM
Quote from: gaurav09 on July 22, 2014, 09:52:48 PM
i installed : http://www.simplemachines.org/community/index.php?topic=505334.0
and it is awesome mod but a problem in it :(
in profile buddies images are showing so big that it's coming in full page..And big images are not resizing itself into small.
Moreover buddies block is coming in between description of a user.
=========================
http://i.imgur.com/ogV4i7u.jpg
http://i.imgur.com/8V85WwR.jpg
=============================
i am using 2.0.8 smf version.

please fix the error.
please help me also   :'( :'(

It's css issue probably, check index.css, make sure about mod's css:


.buddy_block
{
overflow: auto;
padding-left: 15px;
}
.buddy
{
font-family: Tahoma;
font-size: 11px;
font-weight: bold;
text-align: center;
}
.buddy_avatar {
display: inline-block;
float: left;
margin-right: 4px;
margin-bottom: 4px;
    width: 35px;
    height: 35px;
    border: 1px solid white;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    background:url(../../../avatars/noavatar.png);
}
.buddy_avatar img {
    width: 35px;
    height: auto;
    position: relative;
}
#basicavatar img.avatar
{
    display: block;
    margin: 0px 0 0 0;
}
My Modifications:
» Loading For SMF
» Buddies Block
» Redirect Links
» Birthdate On Registration
» PM Warning
» Instagram
» Add Table,Td,Tr Button
» Search Topic & Board Button
Browse All...

gaurav09

Quote from: Mr. Pedram on July 25, 2014, 04:57:01 AM
Quote from: gaurav09 on July 24, 2014, 04:17:49 AM
Quote from: gaurav09 on July 22, 2014, 09:52:48 PM
i installed : http://www.simplemachines.org/community/index.php?topic=505334.0
and it is awesome mod but a problem in it :(
in profile buddies images are showing so big that it's coming in full page..And big images are not resizing itself into small.
Moreover buddies block is coming in between description of a user.
=========================
http://i.imgur.com/ogV4i7u.jpg
http://i.imgur.com/8V85WwR.jpg
=============================
i am using 2.0.8 smf version.

please fix the error.
please help me also   :'( :'(

It's css issue probably, check index.css, make sure about mod's css:


.buddy_block
{
overflow: auto;
padding-left: 15px;
}
.buddy
{
font-family: Tahoma;
font-size: 11px;
font-weight: bold;
text-align: center;
}
.buddy_avatar {
display: inline-block;
float: left;
margin-right: 4px;
margin-bottom: 4px;
    width: 35px;
    height: 35px;
    border: 1px solid white;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    background:url(../../../avatars/noavatar.png);
}
.buddy_avatar img {
    width: 35px;
    height: auto;
    position: relative;
}
#basicavatar img.avatar
{
    display: block;
    margin: 0px 0 0 0;
}

No it has same code,..i previously desabled this mod,..but when i enable it,..it become corrected it self  ::) ::)
But it's location, that means block is showing between member details..
http://i.imgur.com/ogV4i7u.jpg

please fix it !!

samborabora

Quote from: ‽ on July 23, 2014, 07:08:54 PM
In which case you want $user_info['buddies'] and you will want to rewrite some of the other code where it tries to compare it to the current user.

Okay, I've replaced the occurrences, no idea where to start rewriting next, which parts does it try to compare?

samborabora

Just realized, I was thinking this buddies block showed you only your currently online buddies, rather than all buddies avatrs, both online and offline. Can it be easily adjusted to only include those of currently online buddies?

samborabora

This doesn't relate to Buddies Block, but if anyone wants to know how to doe exactly what I wanted:

<?php

global $smcFunc$sourcedir$scripturl$modSettings;

require_once(
$sourcedir '/Subs-MembersOnline.php');

$options = array(
'show_hidden' => allowedTo('moderate_forum'),
'sort' => 'log_time',
'reverse_sort' => true,
);
$return getMembersOnlineStats($options);

if (empty(
$return['users_online']))
return;

$buddies = array();
foreach (
$return['users_online'] as $user)
{
if ($user['is_buddy'])
$buddies[$user['id']] = $user['href'];
}

if (empty(
$buddies))
return;

$request $smcFunc['db_query']('''
SELECT
m.id_member, m.avatar, a.id_attach,
a.attachment_type, a.filename
FROM {db_prefix}members AS m
LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = m.id_member)
WHERE m.id_member = {array_int:members}'
,
array(
'members' => array_keys($buddies),
)
);
$avatars = array();
while (
$row $smcFunc['db_fetch_assoc']($request))
$avatars[$row['id_member']] = $row['avatar'] == '' ? ($row['id_attach'] > ? (empty($row['attachment_type']) ? $scripturl '?action=dlattach;attach=' $row['id_attach'] . ';type=avatar' $modSettings['custom_avatar_url'] . '/' $row['filename']) : '') : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' $row['avatar']);
$smcFunc['db_free_result']($request);

foreach (
$buddies as $id => $href)
echo '<a href="'$href'"><img src="'$avatars[$id], '" alt="" style="width: 30px; height: 30px;" /></a>';


Thanks to the SP forums for this ;)

Hj Ahmad Rasyid Hj Ismail

Nice... Thank you for sharing...

samborabora

Quote from: ahrasis on July 28, 2014, 03:21:21 AM
Nice... Thank you for sharing...

No problem, sorry Mr Pedran for hijacking this thread with the unrelated code, but it should be useful to anyone attempting what I initially was attempting with Buddies Block. @ahrasis I also modified that code to add a header that only displays if there are some on-line friends, if not, the whole block is invisible:

<?php

global $smcFunc$sourcedir$scripturl$modSettings;

require_once(
$sourcedir '/Subs-MembersOnline.php');

$options = array(
'show_hidden' => allowedTo('moderate_forum'),
'sort' => 'log_time',
'reverse_sort' => true,
);
$return getMembersOnlineStats($options);

if (empty(
$return['users_online']))
return;

$buddies = array();
foreach (
$return['users_online'] as $user)
{
if ($user['is_buddy'])
$buddies[$user['id']] = $user['href'];
}

if (empty(
$buddies))
return;

$request $smcFunc['db_query']('''
SELECT
m.id_member, m.avatar, a.id_attach,
a.attachment_type, a.filename
FROM {db_prefix}members AS m
LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = m.id_member)
WHERE m.id_member = {array_int:members}'
,
array(
'members' => array_keys($buddies),
)
);
$avatars = array();
while (
$row $smcFunc['db_fetch_assoc']($request))
$avatars[$row['id_member']] = $row['avatar'] == '' ? ($row['id_attach'] > ? (empty($row['attachment_type']) ? $scripturl '?action=dlattach;attach=' $row['id_attach'] . ';type=avatar' $modSettings['custom_avatar_url'] . '/' $row['filename']) : '') : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' $row['avatar']);
$smcFunc['db_free_result']($request);

if (!empty(
$buddies))
echo 
'
<div id="onlinefriendstitle"></div>

'
;

foreach (
$buddies as $id => $href)
echo '<a href="'$href'"><img src="'$avatars[$id], '" alt="" style="width: 30px; height: 30px;" /></a>';


Ok, last time you'll hear from me, sorry again for getting OT :D

ittiphol

Quote from: samborabora on July 28, 2014, 06:21:34 AM
Quote from: ahrasis on July 28, 2014, 03:21:21 AM
Nice... Thank you for sharing...

No problem, sorry Mr Pedran for hijacking this thread with the unrelated code, but it should be useful to anyone attempting what I initially was attempting with Buddies Block. @ahrasis I also modified that code to add a header that only displays if there are some on-line friends, if not, the whole block is invisible:

<?php

global $smcFunc$sourcedir$scripturl$modSettings;

require_once(
$sourcedir '/Subs-MembersOnline.php');

$options = array(
'show_hidden' => allowedTo('moderate_forum'),
'sort' => 'log_time',
'reverse_sort' => true,
);
$return getMembersOnlineStats($options);

if (empty(
$return['users_online']))
return;

$buddies = array();
foreach (
$return['users_online'] as $user)
{
if ($user['is_buddy'])
$buddies[$user['id']] = $user['href'];
}

if (empty(
$buddies))
return;

$request $smcFunc['db_query']('''
SELECT
m.id_member, m.avatar, a.id_attach,
a.attachment_type, a.filename
FROM {db_prefix}members AS m
LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = m.id_member)
WHERE m.id_member = {array_int:members}'
,
array(
'members' => array_keys($buddies),
)
);
$avatars = array();
while (
$row $smcFunc['db_fetch_assoc']($request))
$avatars[$row['id_member']] = $row['avatar'] == '' ? ($row['id_attach'] > ? (empty($row['attachment_type']) ? $scripturl '?action=dlattach;attach=' $row['id_attach'] . ';type=avatar' $modSettings['custom_avatar_url'] . '/' $row['filename']) : '') : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' $row['avatar']);
$smcFunc['db_free_result']($request);

if (!empty(
$buddies))
echo 
'
<div id="onlinefriendstitle"></div>

'
;

foreach (
$buddies as $id => $href)
echo '<a href="'$href'"><img src="'$avatars[$id], '" alt="" style="width: 30px; height: 30px;" /></a>';


Ok, last time you'll hear from me, sorry again for getting OT :D

Thank you

What file to edit  ???

Hj Ahmad Rasyid Hj Ismail

I guess that is made in a block (portal block)... If you wish to add not using a block, you will need to decide whether it shall appear in all pages or on certain pages. For all pages, definitely you add it in index template. Boardindex for index page and so on...

ittiphol

Quote from: ahrasis on August 06, 2014, 09:38:05 AM
I guess that is made in a block (portal block)... If you wish to add not using a block, you will need to decide whether it shall appear in all pages or on certain pages. For all pages, definitely you add it in index template. Boardindex for index page and so on...

Thank you
that so hard for me  :'(

aegersz

my mod is on and sort of working but when you add a buddy, it does not tell you that the target member is being notified and the buddies do not get added.

is this a bug or did make a mistake ? i had to reapply the code mods to Display.template.php but the rest looks fine.
The configuration of my Linux VPS (SMF 2.0 with 160+ mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

Advertisement: