Advertisement:

Author Topic: Buddies in main profile template  (Read 11939 times)

Offline jackregan

  • Jr. Member
  • **
  • Posts: 167
  • Gender: Male
Buddies in main profile template
« on: January 11, 2008, 08:02:37 PM »
I would like to put each users buddy list in the main page of their profile, but I am having problems.

What code do I need to move out of the editbuddies() function?

N.B. I have already removed the limitation that only owners can view buddies.
Bible Study, Catholic News, Youth Group Stuff (my humble attempt at an SMF site... I'm grateful to the amazing people who have made SMF what it is!!

Offline jackregan

  • Jr. Member
  • **
  • Posts: 167
  • Gender: Male
Re: Buddies in main profile template
« Reply #1 on: January 12, 2008, 08:59:45 AM »
I have been looking at the whole of the profile page and I would like to put a few things from the random associated functions (sub pages, if you call them that) on the main front of the profile.

for instance, I would like to put a little box on with just the subejcts of the users last posts. Now I know how to do that, I think, but I just can't work out how to remove bits of code from their own separate functions on just put them in the main bit!
Bible Study, Catholic News, Youth Group Stuff (my humble attempt at an SMF site... I'm grateful to the amazing people who have made SMF what it is!!

Offline myaicons

  • Jr. Member
  • **
  • Posts: 228
  • Gender: Female
Re: Buddies in main profile template
« Reply #2 on: January 12, 2008, 11:34:17 AM »
I would like to put each users buddy list in the main page of their profile,

im with you on this... how can i do this?? ;)
i scratch your back you scratch my back...
funny thing about my back is its located on my...

Offline jackregan

  • Jr. Member
  • **
  • Posts: 167
  • Gender: Male
Re: Buddies in main profile template
« Reply #3 on: January 12, 2008, 03:29:27 PM »
I would like to put each users buddy list in the main page of their profile,

im with you on this... how can i do this?? ;)

Anyone?
Bible Study, Catholic News, Youth Group Stuff (my humble attempt at an SMF site... I'm grateful to the amazing people who have made SMF what it is!!

Offline myaicons

  • Jr. Member
  • **
  • Posts: 228
  • Gender: Female
Re: Buddies in main profile template
« Reply #4 on: January 12, 2008, 05:59:02 PM »
yes... anybody? anybody? :D
i scratch your back you scratch my back...
funny thing about my back is its located on my...

Offline jackregan

  • Jr. Member
  • **
  • Posts: 167
  • Gender: Male
Re: Buddies in main profile template
« Reply #5 on: January 13, 2008, 08:38:01 AM »
I have been messing around with this most of  the day and it seems to be a question of getting the settings and things that are defined in the editBuddies() function to be present in the template_profile_above function... but it's damn tricky!
Bible Study, Catholic News, Youth Group Stuff (my humble attempt at an SMF site... I'm grateful to the amazing people who have made SMF what it is!!

Offline myaicons

  • Jr. Member
  • **
  • Posts: 228
  • Gender: Female
Re: Buddies in main profile template
« Reply #6 on: January 13, 2008, 10:10:42 AM »
ah.... im not even close to getting that figured out :( 
i scratch your back you scratch my back...
funny thing about my back is its located on my...

Offline Jalkson

  • Jr. Member
  • **
  • Posts: 173
  • Gender: Male
Re: Buddies in main profile template
« Reply #7 on: January 13, 2008, 10:31:22 AM »
I've seen this done, and it doesn't appear to be that difficult.  Give me some time and I'll mess with it, shouldn't take me too long. 


If anybody else sees this and has an answer, feel free to share. :P

Offline jackregan

  • Jr. Member
  • **
  • Posts: 167
  • Gender: Male
Re: Buddies in main profile template
« Reply #8 on: January 13, 2008, 10:52:01 AM »
Right. I have figures it out ;D :D ;) :) :P and am a very happy boy!

I am not sure I can remember 100% how I did it, but here is what I can remember. THis should at least give you a guide.

Also, I offer no guarentees that this won't throw up unexpected problems later on... and I'm not sure this is the best way, but hey...

FIRSTLY IN sources/profile.php

You need to replace the whole of the editBuddies() function with the following. There are only a few tweaks to let everyone view the buddies page, but here is the new editBuddies() function
Code: [Select]
function editBuddies($memID)
{
global $txt, $scripturl, $modSettings, $db_prefix;
global $context, $user_profile, $memberContext, $func;

// Do a quick check to ensure people aren't getting here illegally! NOTE BY JACK: I've added a little line here so that this check doesn't apply to admins.

if ($context['user']['is_guest'] || empty($modSettings['enable_buddylist']))
fatal_lang_error(1, false);

// !!! No page_title.

// For making changes!
$buddiesArray = explode(',', $user_profile[$memID]['buddy_list']);
foreach ($buddiesArray as $k => $dummy)
if ($dummy == '')
unset($buddiesArray[$k]);

if ($context['user']['is_owner'] || $context['user']['is_admin']) {

// Removing a buddy?
if (isset($_GET['remove']))
{
// Heh, I'm lazy, do it the easy way...
foreach ($buddiesArray as $key => $buddy)
if ($buddy == (int) $_GET['remove'])
unset($buddiesArray[$key]);

// Make the changes.
$user_profile[$memID]['buddy_list'] = implode(',', $buddiesArray);
updateMemberData($memID, array('buddy_list' => "'" . $user_profile[$memID]['buddy_list'] . "'"));

// Redirect off the page because we don't like all this ugly query stuff to stick in the history.
redirectexit('action=profile;u=' . $memID . ';sa=editBuddies');
}
elseif (isset($_POST['new_buddy']))
{
// Prepare the string for extraction...
$_POST['new_buddy'] = strtr(addslashes($func['htmlspecialchars'](stripslashes($_POST['new_buddy']), ENT_QUOTES)), array('"' => '"'));
preg_match_all('~"([^"]+)"~', $_POST['new_buddy'], $matches);
$new_buddies = array_unique(array_merge($matches[1], explode(',', preg_replace('~"([^"]+)"~', '', $_POST['new_buddy']))));

foreach ($new_buddies as $k => $dummy)
{
$new_buddies[$k] = strtr(trim($new_buddies[$k]), array('\\\'' => '''));

if (strlen($new_buddies[$k]) == 0)
unset($new_buddies[$k]);
}

if (!empty($new_buddies))
{
// Now find out the ID_MEMBER of the buddy.
$request = db_query("
SELECT ID_MEMBER
FROM {$db_prefix}members
WHERE memberName IN ('" . implode("','", $new_buddies) . "') OR realName IN ('" . implode("','", $new_buddies) . "')
LIMIT " . count($new_buddies), __FILE__, __LINE__);

// Add the new member to the buddies array.
while ($row = mysql_fetch_assoc($request))
$buddiesArray[] = (int) $row['ID_MEMBER'];
mysql_free_result($request);

// Now update the current users buddy list.
$user_profile[$memID]['buddy_list'] = implode(',', $buddiesArray);
updateMemberData($memID, array('buddy_list' => "'" . $user_profile[$memID]['buddy_list'] . "'"));
}

// Back to the buddy list!
redirectexit('action=profile;u=' . $memID . ';sa=editBuddies');
}
}

// Here (above) we close the bracket which contains the fact that only admins and owners can add or remove buddies

// Get all the users "buddies"...
$buddies = array();

if (!empty($buddiesArray))
{
$result = db_query("
SELECT ID_MEMBER
FROM {$db_prefix}members
WHERE ID_MEMBER IN (" . implode(', ', $buddiesArray) . ")
ORDER BY realName
LIMIT " . (substr_count($user_profile[$memID]['buddy_list'], ',') + 1), __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($result))
$buddies[] = $row['ID_MEMBER'];
mysql_free_result($result);
}

$context['buddy_count'] = count($buddies);

// Load all the members up.
loadMemberData($buddies, false, 'profile');

// Setup the context for each buddy.
$context['buddies'] = array();
foreach ($buddies as $buddy)
{
loadMemberContext($buddy);
$context['buddies'][$buddy] = $memberContext[$buddy];
}


Then find this:
Code: [Select]
$context['profile_areas']['edit_profile']['areas']['editBuddies'] = '<a href="' . $scripturl . '?action=profile;u=' . $memID . ';sa=editBuddies">' . $txt['editBuddies'] . '</a>';
}
..and add this after it, so that Buddies data can be viewed outside of the buddy page
Code: [Select]
// Do a quick check to ensure people aren't getting here illegally! NOTE BY JACK: I've added a little line here so that this check doesn't apply to admins.

if (empty($modSettings['enable_buddylist']))
fatal_lang_error(1, false);

// !!! No page_title.

// For making changes!
$buddiesArray = explode(',', $user_profile[$memID]['buddy_list']);
foreach ($buddiesArray as $k => $dummy)
if ($dummy == '')
unset($buddiesArray[$k]);

if ($context['user']['is_owner'] || $context['user']['is_admin']) {

// Removing a buddy?
if (isset($_GET['remove']))
{
// Heh, I'm lazy, do it the easy way...
foreach ($buddiesArray as $key => $buddy)
if ($buddy == (int) $_GET['remove'])
unset($buddiesArray[$key]);

// Make the changes.
$user_profile[$memID]['buddy_list'] = implode(',', $buddiesArray);
updateMemberData($memID, array('buddy_list' => "'" . $user_profile[$memID]['buddy_list'] . "'"));

// Redirect off the page because we don't like all this ugly query stuff to stick in the history.
redirectexit('action=profile;u=' . $memID . ';sa=editBuddies');
}
elseif (isset($_POST['new_buddy']))
{
// Prepare the string for extraction...
$_POST['new_buddy'] = strtr(addslashes($func['htmlspecialchars'](stripslashes($_POST['new_buddy']), ENT_QUOTES)), array('"' => '"'));
preg_match_all('~"([^"]+)"~', $_POST['new_buddy'], $matches);
$new_buddies = array_unique(array_merge($matches[1], explode(',', preg_replace('~"([^"]+)"~', '', $_POST['new_buddy']))));

foreach ($new_buddies as $k => $dummy)
{
$new_buddies[$k] = strtr(trim($new_buddies[$k]), array('\\\'' => '&#039;'));

if (strlen($new_buddies[$k]) == 0)
unset($new_buddies[$k]);
}

if (!empty($new_buddies))
{
// Now find out the ID_MEMBER of the buddy.
$request = db_query("
SELECT ID_MEMBER
FROM {$db_prefix}members
WHERE memberName IN ('" . implode("','", $new_buddies) . "') OR realName IN ('" . implode("','", $new_buddies) . "')
LIMIT " . count($new_buddies), __FILE__, __LINE__);

// Add the new member to the buddies array.
while ($row = mysql_fetch_assoc($request))
$buddiesArray[] = (int) $row['ID_MEMBER'];
mysql_free_result($request);

// Now update the current users buddy list.
$user_profile[$memID]['buddy_list'] = implode(',', $buddiesArray);
updateMemberData($memID, array('buddy_list' => "'" . $user_profile[$memID]['buddy_list'] . "'"));
}

// Back to the buddy list!
redirectexit('action=profile;u=' . $memID . ';sa=editBuddies');
}
}

// Here (above) we close the bracket which contains the fact that only admins and owners can add or remove buddies

// Get all the users "buddies"...
$buddies = array();

if (!empty($buddiesArray))
{
$result = db_query("
SELECT ID_MEMBER
FROM {$db_prefix}members
WHERE ID_MEMBER IN (" . implode(', ', $buddiesArray) . ")
ORDER BY realName
LIMIT " . (substr_count($user_profile[$memID]['buddy_list'], ',') + 1), __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($result))
$buddies[] = $row['ID_MEMBER'];
mysql_free_result($result);
}

$context['buddy_count'] = count($buddies);

// Load all the members up.
loadMemberData($buddies, false, 'profile');

// Setup the context for each buddy.
$context['buddies'] = array();
foreach ($buddies as $buddy)
{
loadMemberContext($buddy);
$context['buddies'][$buddy] = $memberContext[$buddy];
}
Then make sure that that the line near the top which calls all the global stuff looks like this
Code: [Select]
global $txt, $scripturl, $user_info, $context, $ID_MEMBER, $sourcedir, $user_profile, $modSettings, $db_prefix, $memberContext, $func;
Then go to Themes/default/Profile.template.php

Firstly, replace the whole of the editBuddies() function with the following code which (I think) adds avatars to the buddy page, makes it so everyone can see the buddy page and removes the ability to add or remove buddies for those who are not admins or owners
Code: [Select]
function template_editBuddies()



{



global $context, $settings, $options, $scripturl, $modSettings, $txt;







echo '



<table border="0" width="95%" cellspacing="1" cellpadding="4" class="bordercolor" align="center">



<tr class="titlebg">



<td colspan="100%" height="26"><center>', $context['member']['name'], '\'s Buddies</center>



</td>



</tr>



<tr class="catbg3">



<td width="20%">', $txt[68], '</td>



<td>Online?</td>



<td>', $txt[69], '</td>



<td align="center">', $txt[513], '</td>



<td align="center">', $txt[603], '</td>



<td align="center">', $txt[604], '</td>



<td align="center">', $txt['MSN'], '</td>';



if ($context['user']['is_admin'] || $context['user']['is_owner']){



echo'<td></td>';



}







echo '</tr>';







// If they don't have any buddies don't list them!



if (empty($context['buddies']))



echo '



<tr class="windowbg">



<td colspan="100%" align="center"><b>', $txt['no_buddies'], '</b></td>



</tr>';







// Now loop through each buddy showing info on each.



$alternate = false;



foreach ($context['buddies'] as $buddy)



{



echo '



<tr class="', $alternate ? 'windowbg' : 'windowbg2', '">



<td><center>',$buddy['avatar']['image'],'<br />', $buddy['link'], '</center></td>



<td align="center"><a href="', $buddy['online']['href'], '"><img src="', $buddy['online']['image_href'], '" alt="', $buddy['online']['label'], '" title="', $buddy['online']['label'], '" /></a></td>



<td align="center">', ($buddy['hide_email'] ? '' : '<a href="mailto:' . $buddy['email'] . '"><img src="' . $settings['images_url'] . '/email_sm.gif" alt="' . $txt[69] . '" title="' . $txt[69] . ' ' . $buddy['name'] . '" /></a>'), '</td>



<td align="center">', $buddy['icq']['link'], '</td>



<td align="center">', $buddy['aim']['link'], '</td>



<td align="center">', $buddy['yim']['link'], '</td>







<td align="center">', $buddy['msn']['link'], '</td>';



if ($context['user']['is_admin'] || $context['user']['is_owner']) {



echo '<td align="center"><a href="', $scripturl, '?action=profile;u=', $context['member']['id'], ';sa=editBuddies;remove=', $buddy['id'], '"><img src="', $settings['images_url'], '/icons/delete.gif" alt="', $txt['buddy_remove'], '" title="', $txt['buddy_remove'], '" /></a></td>';



}







echo '</tr>';







$alternate = !$alternate;



}







echo '



<tr class="', $alternate ? 'windowbg' : 'windowbg2', '">



<td colspan="100%" align="center">



<font size="1">[Remember that on this forum buddies are not paired. In other words people can add others without their consent or knowledge...]</font>



</td>



</tr>



</table>';











if ($context['user']['is_admin'] || $context['user']['is_owner']) {







// Add a new buddy? Only if admin or owner



echo '



<br />



<form action="', $scripturl, '?action=profile;u=', $context['member']['id'], ';sa=editBuddies" method="post" accept-charset="', $context['character_set'], '">



<table width="65%" cellpadding="4" cellspacing="0" class="tborder" align="center">



<tr class="titlebg">



<td colspan="2">', $txt['buddy_add'], '</td>



</tr>



<tr class="windowbg">



<td width="45%">



<b>', $txt['who_member'], ':</b>



</td>



<td width="55%">



<input type="text" name="new_buddy" id="new_buddy" size="25" />



<a href="', $scripturl, '?action=findmember;input=new_buddy;quote=1;sesc=', $context['session_id'], '" onclick="return reqWin(this.href, 350, 400);"><img src="', $settings['images_url'], '/icons/assist.gif" alt="', $txt['find_members'], '" align="top" /></a>



</td>



</tr>



<tr class="windowbg">



<td colspan="2" align="right">



<input type="submit" value="', $txt['buddy_add_button'], '" />



</td>



</tr>



</table>



</form>';



}



}
Then just add the following code to wherever you want the buddies to display (complete with avatars)
Code: [Select]

if ($context['user']['is_guest']){echo '<br />Sorry, you need to be <a href="', $scripturl, '?action=register">registered</a> and logged in to see this stuff...';}

else {

if (empty($context['buddies'])) {

echo '<br />', $txt['no_buddies'], '<br /><br />';

if ($context['user']['is_owner']){

echo 'You can add some by using your <a href="', $scripturl, '?action=profile;sa=editBuddies">buddy page</a> or by clicking \'Add to Buddy List\' in a person\'s profile';
}
}

$alternate = false;

foreach ($context['buddies'] as $buddy)

{
echo ' ',$buddy['avatar']['image'], '<br />', $buddy['link'], '<br /><hr align="center" width="75%"/>';
}
}
You will note that this also stops guests from viewing buddies and tells them to register. It also includes a line if the person viewing is owner, and has no buddies, telling them how to add some.

One little extra thing is that I have put the buddies within a <td> which I have scrolling, so the the buddies don't take over the page. Just wrap all of the above in this if you like this idea (inside of the <td>):
Code: [Select]
<div style="overflow:auto; height:200px; width:100%">



</div>
Most people will want the height more than 200px I guess
« Last Edit: January 13, 2008, 02:28:46 PM by jackregan »
Bible Study, Catholic News, Youth Group Stuff (my humble attempt at an SMF site... I'm grateful to the amazing people who have made SMF what it is!!

Offline myaicons

  • Jr. Member
  • **
  • Posts: 228
  • Gender: Female
Re: Buddies in main profile template
« Reply #9 on: January 13, 2008, 11:52:41 AM »
I've seen this done, and it doesn't appear to be that difficult.  Give me some time and I'll mess with it, shouldn't take me too long. 


If anybody else sees this and has an answer, feel free to share. :P


do you agree with the above?
i scratch your back you scratch my back...
funny thing about my back is its located on my...

Offline Jalkson

  • Jr. Member
  • **
  • Posts: 173
  • Gender: Male
Re: Buddies in main profile template
« Reply #10 on: January 13, 2008, 12:01:39 PM »
I can't say without testing it.



I was able to get that much with only messing with about 20 lines of code, though I'm having an issue with it showing the buddies.  It tends to think that the user has no buddies, even when they do. :P


Looking at the code, it appears it would work well enough.  I'm still working on it, so feel free to use his.  I can't guarantee how long this will take me.
« Last Edit: January 13, 2008, 12:08:29 PM by Jalkson »

Offline myaicons

  • Jr. Member
  • **
  • Posts: 228
  • Gender: Female
Re: Buddies in main profile template
« Reply #11 on: January 13, 2008, 12:09:42 PM »
I can't say without testing it.

I was able to get that much with only messing with about 20 lines of code, though I'm having an issue with it showing the buddies.  It tends to think that the user has no buddies, even when they do. :P


Looking at the code, it appears it would work well enough.  I'm still working on it, so feel free to use his.  I can't guarantee how long this will take me.


oh you can do it too! i know you can! i believe in you!
i scratch your back you scratch my back...
funny thing about my back is its located on my...

Offline Jalkson

  • Jr. Member
  • **
  • Posts: 173
  • Gender: Male
Re: Buddies in main profile template
« Reply #12 on: January 13, 2008, 12:24:23 PM »
@jackregan,

You should edit your post and put your code inside of the code tags, rather than the quote.

On topic -

I'm making progress, so hopefully not too much longer. ;p

Offline jackregan

  • Jr. Member
  • **
  • Posts: 167
  • Gender: Male
Re: Buddies in main profile template
« Reply #13 on: January 13, 2008, 02:29:33 PM »
@jackregan,

You should edit your post and put your code inside of the code tags, rather than the quote.

Good call. Didn't know about that one.

Every day is a school day :)
Bible Study, Catholic News, Youth Group Stuff (my humble attempt at an SMF site... I'm grateful to the amazing people who have made SMF what it is!!

Offline Jalkson

  • Jr. Member
  • **
  • Posts: 173
  • Gender: Male
Re: Buddies in main profile template
« Reply #14 on: January 13, 2008, 03:58:30 PM »
I was able to get it working, it's not anywhere near perfect.  And can use some improving.



Please feel free to leave comments on how to improve it. =]


**NOTE**

This was created, and tested, on a brand new install of SMF on the default theme only.  I did this on my localhost, and HAVE NOT tested it live.  There were no mods installed on this forum.

Please make sure to backup files before making any changes.


Find profile.php in /Sources/

Code: (Find) [Select]
// Allow the change or view of profiles...
function ModifyProfile($post_errors = array())
{
global $txt, $scripturl, $user_info, $context, $ID_MEMBER, $sourcedir, $user_profile, $modSettings;

loadLanguage('Profile');
loadTemplate('Profile');

/* Set allowed sub-actions.

Change out the global variable area, with this bit of code.

Code: (globals) [Select]
global $txt, $scripturl, $user_info, $context, $ID_MEMBER, $sourcedir, $user_profile, $modSettings, $db_prefix, $memberContext, $func;

Code: (Find) [Select]
// !!! I still don't think this warrants a new section by any means, but it's definitely not part of viewing a person's profile, if only the owner can do it.
if (!empty($modSettings['enable_buddylist']) && $context['user']['is_owner'] && allowedTo(array('profile_extra_own', 'profile_extra_any')))
$context['profile_areas']['edit_profile']['areas']['editBuddies'] = '<a href="' . $scripturl . '?action=profile;u=' . $memID . ';sa=editBuddies">' . $txt['editBuddies'] . '</a>';
}

Code: (Add After) [Select]
// Do a quick check to ensure people aren't getting here illegally! NOTE BY JACK: I've added a little line here so that this check doesn't apply to admins.

   if (empty($modSettings['enable_buddylist']))
      fatal_lang_error(1, false);

   // !!! No page_title.

   // For making changes!
   $buddiesArray = explode(',', $user_profile[$memID]['buddy_list']);
   foreach ($buddiesArray as $k => $dummy)
      if ($dummy == '')
         unset($buddiesArray[$k]);

   // Get all the users "buddies"...
   $buddies = array();

   if (!empty($buddiesArray))
   {
      $result = db_query("
         SELECT ID_MEMBER
         FROM {$db_prefix}members
         WHERE ID_MEMBER IN (" . implode(', ', $buddiesArray) . ")
         ORDER BY realName
         LIMIT " . (substr_count($user_profile[$memID]['buddy_list'], ',') + 1), __FILE__, __LINE__);
      while ($row = mysql_fetch_assoc($result))
         $buddies[] = $row['ID_MEMBER'];
      mysql_free_result($result);
   }

   $context['buddy_count'] = count($buddies);

   // Load all the members up.
   loadMemberData($buddies, false, 'profile');

   // Setup the context for each buddy.
   $context['buddies'] = array();
   foreach ($buddies as $buddy)
   {
      loadMemberContext($buddy);
      $context['buddies'][$buddy] = $memberContext[$buddy];
   }

Find your profile.template.php file in /Themes/default/

Code: (Find) [Select]
// Now print the second column where the members avatar/text is shown.
echo '
<td class="windowbg" valign="middle" align="center" width="150">
', $context['member']['avatar']['image'], '<br /><br />
', $context['member']['blurb'], '
</td>
</tr>';

Code: (Add After) [Select]
//Buddy info in profile summary
if ($context['user']['is_logged']){
echo '<div style="overflow:auto; height:200px; width:100%">
<table border="0" width="51%" cellspacing="1" cellpadding="4" class="bordercolor" align="center">
<tr class="catbg3">
<td width="100%" align="center">', $context['member']['name'], 's ', $txt['buddy'], '</td>
</tr>';

// If they don't have any buddies don't list them!
if (empty($context['buddies'])){
echo '
<tr class="windowbg">
<td colspan="1" align="center"><b>', $txt['u_no_buddies'], '</b></td>
</tr>';
}


// Now loop through each buddy showing info on each.

foreach ($context['buddies'] as $buddy)
{
echo '
<tr class="windowbg2">
<td colspan="1" align="center"><b>', $buddy['link'] , '</b><br />', $buddy['avatar']['image'], '<br />';
}
           '</td>
        </tr></div>';
}

Find your profile.english.php (or whatever other language you use. :P) in /Themes/default/languages/

Code: (Find) [Select]
$txt['buddy_add'] = 'Add To Buddy List';
$txt['buddy_remove'] = 'Remove From Buddy List';
$txt['buddy_add_button'] = 'Add';
$txt['no_buddies'] = 'Your buddy list is currently empty';

Code: (Add after) [Select]
$txt['buddy'] = 'Buddy List';
$txt['u_no_buddies'] = 'Users buddy list is currently empty';


**NOTE**

This was created, and tested, on a brand new install of SMF on the default theme only.  I did this on my localhost, and HAVE NOT tested it live.  There were no mods installed on this forum.

Please make sure to backup files before making any changes.

« Last Edit: January 13, 2008, 05:03:08 PM by Jalkson »

Offline myaicons

  • Jr. Member
  • **
  • Posts: 228
  • Gender: Female
Re: Buddies in main profile template
« Reply #15 on: January 13, 2008, 04:33:11 PM »
ooh.. thanks!

im gonna try these out right now :)

ill let you know how it goes for me
i scratch your back you scratch my back...
funny thing about my back is its located on my...

Offline Jalkson

  • Jr. Member
  • **
  • Posts: 173
  • Gender: Male
Re: Buddies in main profile template
« Reply #16 on: January 13, 2008, 04:35:55 PM »
Please make sure you backup files. :]

Also, screenshots of how it looks would be great, as mine was tested with very few members.

Offline myaicons

  • Jr. Member
  • **
  • Posts: 228
  • Gender: Female
Re: Buddies in main profile template
« Reply #17 on: January 13, 2008, 04:44:18 PM »
ah... well mine is pretty barren too... i havent released my forum into the wild yet until i have it to what i need it to do.... but ima goona give it a shot....


also... odd question...  are admins automatically added to someones buddy list without approval?
i scratch your back you scratch my back...
funny thing about my back is its located on my...

Offline myaicons

  • Jr. Member
  • **
  • Posts: 228
  • Gender: Female
Re: Buddies in main profile template
« Reply #18 on: January 13, 2008, 04:56:25 PM »

i did it... but got error:


Table ' ' doesn't exist
File: /Sources/Profile.php
Line: 272
« Last Edit: January 13, 2008, 05:10:40 PM by myaicons »
i scratch your back you scratch my back...
funny thing about my back is its located on my...

Offline Jalkson

  • Jr. Member
  • **
  • Posts: 173
  • Gender: Male
Re: Buddies in main profile template
« Reply #19 on: January 13, 2008, 05:00:53 PM »
Ah.. sorry about that.  My mistake.

Find your profile.php in /Sources/



Code: (Find) [Select]
// Allow the change or view of profiles...
function ModifyProfile($post_errors = array())
{
global $txt, $scripturl, $user_info, $context, $ID_MEMBER, $sourcedir, $user_profile, $modSettings;

loadLanguage('Profile');
loadTemplate('Profile');

/* Set allowed sub-actions.

Change out the global variable area, with this bit of code.

Code: (globals) [Select]
global $txt, $scripturl, $user_info, $context, $ID_MEMBER, $sourcedir, $user_profile, $modSettings, $db_prefix, $memberContext, $func;

That should do it.


Also, for your other question, I don't remember ever having to approve anyone. 
« Last Edit: January 13, 2008, 05:02:48 PM by Jalkson »