4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: ccsakuweb on May 14, 2007, 06:56:49 PM

Title: [MOD] Buddy List || Friend List
Post by: ccsakuweb on May 14, 2007, 06:56:49 PM
COMMENTS BY AUTHOR
   My second mod to 4images. :)  I wanted to install this mod allways and
   now I have maked it for all us.  This is the first version and I tested
   in 1.7.3 , and the other users : 1.7.1 and 1.7 4images version.

DESCRIPTION
   This mod make a buddy list (or friend list) for user registered. The user
   will can delete all the list or a friend. At the moment the user can add
   his list a friend in comments from details or member_profile page.

DOWNLOAD (http://www.myart.es/img688.htm?l=english) : With an english and spanish install version
DEMO: http://www.myart.es   user:test  pass: test

ADDONS:
- Letter Select (http://www.4homepages.de/forum/index.php?topic=17491.msg93450#msg93450)
- Icon and Order by User Sex/Gender
- Member Personal Photo in the list
- PM icon in the list (http://www.4homepages.de/forum/index.php?topic=17491.msg93462#msg93462)
- User Status (http://www.4homepages.de/forum/index.php?topic=17491.msg93480#msg93480) => by Loda
- Users List that added as a friend in profile (http://www.4homepages.de/forum/index.php?topic=17491.msg93482#msg93482)
- Send PM to users that added you as a friend for notify that you have uploaded a file (http://www.4homepages.de/forum/index.php?topic=17491.msg96478#msg96478)
- Avatar MOD no Userpic mod (http://www.4homepages.de/forum/index.php?topic=17491.msg106101#msg106101)
Title: Re: [MOD] Buddy List || Friend List
Post by: Loda on May 14, 2007, 08:12:26 PM
hello!
thank you very much! great work!
it's running on 1.7, too!
a little mitake in the friendslist.php:
change
Code: [Select]
include(ROOT_PATH.'includes/paging.php');to this:
Code: [Select]
include(ROOT_PATH.'includes/user_paging.php');
Title: Re: [MOD] Buddy List || Friend List
Post by: ccsakuweb on May 14, 2007, 08:32:21 PM
ups! thank you I forgot. I have user_paging.php because memberlist mod XD

I'm very happy! thanks for you reply ^^

If your interested I have posted some addons here (http://translate.google.com/translate?u=http%3A%2F%2Fwww.4homepages.de%2Fforum%2Findex.php%3Ftopic%3D17457.0&langpair=es%7Cen&hl=es&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools)

And in my gallery I added other atribute in users table.  Because in profiles of my gallery the users can show who added their to friends list. If you are interested i will post that version.
Title: Re: [MOD] Buddy List || Friend List
Post by: Loda on May 16, 2007, 11:36:20 AM
yes! I'm very interesting in your addons! can you post it? thank you very much.
another question:
is it possible to show the number of new images from a buddy (amigo) in the friendslist ?
Title: Re: [MOD] Buddy List || Friend List
Post by: ccsakuweb on May 16, 2007, 11:53:29 AM
I did the addon because I want to send a notify by pm when a user upload a picture.
So If you added me as a friend, and when I upload a picture you receive a pm with name, thumbnail, url... from the new picture

I think that your idea is possible but it is like my idea, what idea do you like more?? Because, at the moment I don't have time, I have to study, maybe this weekend I will try the best idea

Title: Re: [MOD] Buddy List || Friend List
Post by: Loda on May 16, 2007, 12:49:06 PM
I did the addon because I want to send a notify by pm when a user upload a picture.
So If you added me as a friend, and when I upload a picture you receive a pm with name, thumbnail, url... from the new picture
that's it!! yes!!
Title: Re: [MOD] Buddy List || Friend List
Post by: mawenzi on May 16, 2007, 01:16:56 PM
... if Loda has tested this MOD and he said ... all OK ... the MOD is running ... then this MOD is ok and works ...
... the MOD is moved to Mods & Plugins (Releases & Support) ...
Title: Re: [MOD] Buddy List || Friend List
Post by: ccsakuweb on May 16, 2007, 01:33:05 PM
 :lol: great! hehe thanks!!!

@Loda: ok! Then this weekend I will try that XD

maybe someone could help me to fix search a friend in friendslist .
Title: Re: [MOD] Buddy List || Friend List
Post by: Loda on May 16, 2007, 10:24:25 PM
hello,
nice to here that! i'm still waiting..  :wink:
i think the mistake is that you search for the user_name. maybe you search for the user_friend_ids
the same mistake with the integration of the letterbits-mod? have you tried this?

@mawenzi:  :oops: the mod works fine ... the search in the friendlist is not necessarily for me.
Title: Re: [MOD] Buddy List || Friend List
Post by: ccsakuweb on May 16, 2007, 11:51:58 PM
hi! i fixed the problem in search  :lol:  i forgot to add the condition XD
ok!

Search:
Code: [Select]
//----------------------------
//---- Sort ------------------
//----------------------------

add before:
Code: [Select]
$condition = "";
$user_search = "";

Search:
Code: [Select]
$sql = "SELECT *
        FROM ".USERS_TABLE."
WHERE user_id IN ($friends_id_sql)
        ORDER BY $order_by
        LIMIT $offset, $user_per_page";

Replace to:
Code: [Select]
$sql = "SELECT *
        FROM ".USERS_TABLE."
WHERE user_id IN ($friends_id_sql) ".$condition."
        ORDER BY $order_by
        LIMIT $offset, $user_per_page";

Search:
Code: [Select]
$sql = "SELECT COUNT(user_id) AS total_friends
       FROM ".USERS_TABLE."
   WHERE user_id IN ($friends_id_sql) ";

Replace:
Code: [Select]
$sql = "SELECT COUNT(user_id) AS total_friends
       FROM ".USERS_TABLE."
   WHERE user_id IN ($friends_id_sql) ".$condition."";

Download UPDATED.

I don't use the letterbits but do you want it??
Title: Re: [MOD] Buddy List || Friend List
Post by: Loda on May 17, 2007, 09:32:09 AM
yes i want..
and tried it but no result..  :cry:
i have change this:
Code: [Select]
$sql = "SELECT COUNT(user_id) AS total_friends
       FROM ".USERS_TABLE."
   WHERE user_id IN ($friends_id_sql)";
to this:
Code: [Select]
$sql = "SELECT COUNT(user_id) AS total_friends
       FROM ".USERS_TABLE."
   WHERE user_id IN ($friends_id_sql) ".$condition."";
but without success..
do you have any idea?
Title: Re: [MOD] Buddy List || Friend List
Post by: ccsakuweb on May 17, 2007, 10:36:29 AM
Yes I forgot change that sql sentence.

I tried it and works.
Search:
Code: [Select]
$condition = "";
$user_search = "";

After add:
Code: [Select]
//--------------------------------
//------ Letter Select ----------
//--------------------------------

$ltr = "";
$letter = "num";
$letterbits = "<TABLE width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\" class=\"bordercolor\">\n<tr>\n<TD>\n<TABLE width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\">\n<TR align=\"center\"><td class=\"row1\">";
if (isset($HTTP_GET_VARS['ltr']) || isset($HTTP_POST_VARS['ltr'])) {
$ltr = (isset($HTTP_POST_VARS['ltr'])) ? $HTTP_POST_VARS['ltr'] : $HTTP_GET_VARS['ltr'];
}
if ($ltr) {
$letterbits .= "<normalfont><a href=\"".$site_sess->url(ROOT_PATH."friendslist.php")."\">".$lang['lang_all']."</a></normalfont>";
  if ($ltr == "num") {
$condition = " AND ".get_user_table_field("", "user_name")." NOT REGEXP(\"^[a-zA-Z]\")";
}else{
$ltr = chr(intval(ord($ltr)));
$condition = ($ltr) ? " AND ".get_user_table_field("", "user_name")." LIKE '".addslashes($ltr)."%'" : "";
}
$user_search = "ltr=".$ltr;
}else{
$letterbits .= "<normalfont>[<b>".$lang['lang_all']."</b>]</normalfont>";
}
if ($ltr == $letter) {
$letterbits .= "&nbsp;.&nbsp;<normalfont>[<b>#</b>]</normalfont>";
} else {
$letterbits .= "&nbsp;.&nbsp;<normalfont><a href=\"".$site_sess->url(ROOT_PATH."friendslist.php?ltr=$letter")."\">#</a></normalfont>";
}
for ($i = 65; $i < 91; $i++) {
$letter = chr($i); $linkletter = $letter;
if ($ltr == $letter) {
$letterbits .= "&nbsp;.&nbsp;<normalfont>[<b>$letter</b>]</normalfont>";
} else {
$letterbits .= "&nbsp;.&nbsp;<normalfont><a href=\"".$site_sess->url(ROOT_PATH."friendslist.php?ltr=$letter")."\">$letter</a></normalfont>";
}
}
$letterbits .= "</td></TR>\n</TABLE>\n</TD>\n</TR>\n</TABLE>";
//---- End Letter Select ----

Search:
Code: [Select]
'mode_action' => $site_sess->url(ROOT_PATH."friendslist.php".(($user_search) ? "?$user_search" : "")))
Before adD:
Code: [Select]
'letterbits' => $letterbits,

Use {letterbits} where you want in friendslist.html
in my list i use like that:
Code: [Select]
{if friendslist}{letterbits}
<table width="450" border="0" cellspacing="0" cellpadding="1">
                    <tr>
                      <td class="head1">
                        <table width="100%" border="0" cellspacing="0" cellpadding="3">

                          <tr>
                            <td class="row2" valign="top">{friendslist}</td>
                          </tr>
                        </table>
                      </td>
                    </tr>
                  </table>
  {endif friendslist}


Please tell me if it works. If it doesn't work please say me what is your problem
Title: Re: [MOD] Buddy List || Friend List
Post by: ccsakuweb on May 17, 2007, 10:42:27 AM
@Loda it would be great that you post your main changes and the friendslist button in english :wink:
Title: Re: [MOD] Buddy List || Friend List
Post by: Loda on May 17, 2007, 11:06:20 AM
ok..
it works..
i found my mistake.. i have insert the part "letterselect" before and not after "$condition = "";
$user_search = "";

i'm an idiot..

my friedlist buttons:
Title: Re: [MOD] Buddy List || Friend List
Post by: ccsakuweb on May 17, 2007, 11:11:01 AM
ok! doesn't matter. thank you for the icons I will put them in fiendslist mod If you let me ^^
Title: Re: [MOD] Buddy List || Friend List
Post by: Loda on May 17, 2007, 11:21:10 AM
yes you do so..
here my friendslist.php with
user country, gender, online status and user guestbook mod link
Title: Re: [MOD] Buddy List || Friend List
Post by: ccsakuweb on May 17, 2007, 11:23:04 AM
wow it's great! i will write this addons. And do you have the main changes in english? I didn't translated it  :?
Title: Re: [MOD] Buddy List || Friend List
Post by: kai on May 17, 2007, 12:05:22 PM
Great mod!
Title: Re: [MOD] Buddy List || Friend List
Post by: ccsakuweb on May 17, 2007, 12:28:00 PM
Thank you very much  :lol:

:Download updated: With icons from Loda

ADDONS
1-. MOD USER_GENDER/SEX =>  If you have installed this mod with a field in users table named user_gender or user_sex with  m (man), w (woman) or b (bisex) values
At the next modifications I use user_gender If you have user_sex please overwrite user_gender to user_sex
Search:
Code: [Select]
$mode_types_text = array($lang['lang_sort_username'],In the same line, add after:
Code: [Select]
$lang['lang_sort_gender'],/code]

Search:
[code]$mode_types = array('user_name',
In the same line, add after:
Code: [Select]
'user_gender',
Search:
Code: [Select]
case 'user_joindate':
$order_by = "user_joindate $sort_order";
break;
Add Before:
Code: [Select]
        case 'user_gender':
            $order_by = "user_gender $sort_order";
            break;


=>That last steps do that you can order your friends by sex.

Search:
Code: [Select]
  $user_id = "";Add After:
Code: [Select]
  $user_gender = "";
Search:
Code: [Select]
    $user_name = "<a href=\"".$site_sess->url($user_profile_link)."\">".htmlspecialchars($user_row['user_name'])."</a>";Add After:
Code: [Select]
$user_gender = "<img src=\"".get_gallery_image(htmlspecialchars($user_row['user_gender'])).".gif\">".$var_name." ";
Search:
Code: [Select]
align=\"left\">".$session_ip." ".$user_name.In the same line, add after::
Code: [Select]
" ".$user_gender.
2-. Member Personal Photo in the list:

Search:
Code: [Select]
  $user_id = "";Add After:
Code: [Select]
  $user_pic=""; //Member Photo
Search:
Code: [Select]
    $user_name = "<a href=\"".$site_sess->url($user_profile_link)."\">".htmlspecialchars($user_row['user_name'])."</a>";Add After:
Code: [Select]
// Show Member Personal Photo
if(($config['userpic'])&&($user_row['userpic'])){
    $user_pic =   "<a href=\"".$site_sess->url($user_profile_link)."\"><img src=\"".$site_sess->url(ROOT_PATH."data/userpic/".$user_row['userpic'])."\"></a>";
}

Search:
Code: [Select]
align=\"left\">".$session_ip." ".$user_name.In the same line, add after:
Code: [Select]
"<br>".$user_pic.

3-. PM icon in the list:
Search:
Code: [Select]
<td class=\"head2\" align=\"center\">".$lang['email']."</td>In the same line, add after::
Code: [Select]
\n<td class=\"head2\" align=\"center\">".$lang['lang_friendslist_pm']."</td>
Search:
Code: [Select]
  $user_id = "";Add after:
Code: [Select]
  $user_pm_button=""; //IF YOU HAVE PMS ACTIVATE
Search:
Code: [Select]
    $user_name = "<a href=\"".$site_sess->url($user_profile_link)."\">".htmlspecialchars($user_row['user_name'])."</a>";Add after:
Code: [Select]
//PM
if($config['pm']){
$user_pm_button = "<a href=\"".$site_sess->url(ROOT_PATH."pm.php?action=new&user_id=".$user_id)."\" /><img src=\"".get_gallery_image("pm.gif")."\" border=\"0\" alt=\"".$lang['pm_user_pm_alt']."\" /></a>";
}

Search:
Code: [Select]
    $userlist .= "<td valign=\"center\" align=\"center\">".$user_email_button."</td>\n";Add after:
Code: [Select]
    $userlist .= "<td valign=\"center\" align=\"center\">".$user_pm_button."</td>\n";
soon .. addons from loda : user country, gender, online status and user guestbook mod link[/code]
Title: Re: [MOD] Buddy List || Friend List
Post by: Loda on May 17, 2007, 10:41:02 PM
Addon user status:
search:
Code: [Select]
<td class=\"head2\" align=\"center\">".$lang['user_name']."</td>\nadd after in the same line:
Code: [Select]
<td class=\"head2\" align=\"center\">Status:</td>\nsearch:
Code: [Select]
$user_name = "";add after
Code: [Select]
$user_status = "";search:
Code: [Select]
    $user_join_date = (isset($user_row['user_joindate'])) ? format_date($config['date_format'], $user_row['user_joindate']) : REPLACE_EMPTY;
add after:
Code: [Select]
$user_status = ($user_row['user_lastaction'] >= (time() - 300) && ((isset($user_row['user_invisible']) && $user_row['user_invisible'] == 0) || $user_info['user_level'] == ADMIN)) ? " <img src=\"".get_gallery_image("user_online.gif")."\" border=\"0\" alt=\"online\" />" : "<img src=\"".get_gallery_image("user_offline.gif")."\" border=\"0\" alt=\"Offline\" />";
search:
Code: [Select]
    $userlist .= "<td valign=\"top\" align=\"left\"> ".$user_name." </td>\n";
add after:
Code: [Select]
$userlist .= "<td valign=\"top\" align=\"center\">".$user_status."</td>\n";   
soon.. the other addons..
Title: Re: [MOD] Buddy List || Friend List
Post by: ccsakuweb on May 18, 2007, 01:00:18 AM
hehe thank you Loda for the addons  :lol:

Ok! here is the addon that show a list in your profile of the last users that added you as a friend.
You can show in you profile the number of users that you want. Here is a photo of the addon:
(http://www.4homepages.de/forum/index.php?action=dlattach;topic=17491.0;attach=1934;image)


For the addon I had two options:
1-. Search in all users table, the users than added me as a friend and write it in my profile
or
2-. When someone add a friend modify my friends ids and add in the field from the user that I added, my user_id

I took the second option because in a future it would be better and more quickly. So If you want to install addon you will need to reset your friends ids.

Ok! here are the modifications:
DELETE user_friend_ids from users table => RESET FRIENDS IDS

Add the two fields in your users_table
 
Code: [Select]
ALTER TABLE 4images_users ADD user_friend_ids text NULL DEFAULT NULL
ALTER TABLE 4images_users ADD user_friend_you_ids text NULL DEFAULT NULL

Open includes/functions.php
Search:
Code: [Select]
////////////////////////////
//BEGIN friendslist
function add_to_friendslist($id) {
  global $user_info, $site_db;
  $id = intval($id);
  if (!$id) {
    return false;
  }
  $friendslist_ids = $user_info['user_friend_ids'];
  $friendslist_array = explode(" ", $friendslist_ids);
  if (!in_array($id, $friendslist_array)) {
    $friendslist_ids .= " ".$id;
  }
  $user_info['user_friend_ids'] = trim($friendslist_ids);
  $sql = "UPDATE ".USERS_TABLE."
          SET user_friend_ids = '".$user_info['user_friend_ids']."'
          WHERE user_id = ".$user_info['user_id'];
  return ($site_db->query($sql)) ? 1 : 0;
}

function remove_from_friendslist($id) {
  global $user_info, $site_db;
  $friendslist_array = explode(" ",$user_info['user_friend_ids']);
  foreach ($friendslist_array as $key => $val) {
    if ($val == $id) {
      unset($friendslist_array[$key]);
    }
  }
  $user_info['user_friend_ids'] = trim(implode(" ", $friendslist_array));
  $sql = "UPDATE ".USERS_TABLE."
          SET user_friend_ids = '".$user_info['user_friend_ids']."'
          WHERE user_id = ".$user_info['user_id'];
  return ($site_db->query($sql)) ? 1 : 0;
}

function clear_friendslist() {
  global $user_info, $site_db;
  $sql = "UPDATE ".USERS_TABLE."
          SET user_friend_ids = ''
          WHERE user_id = ".$user_info['user_id'];
  if ($site_db->query($sql)) {
    $user_info['user_friend_ids'] = "";
    return true;
  }
  else {
    return false;
  }
}

function check_friendslist($id) {
  global $user_info;
  $friendslist_array = explode(" ", $user_info['user_friend_ids']);
  return in_array($id, $friendslist_array);
}
/////////////////
//END FRIENDSLIST
/////////////////

Replace:
Code: [Select]
////////////////////////////
//BEGIN friendslist
function add_to_friendslist($id) {
  global $user_info, $site_db;
  $id = intval($id);
  if (!$id) {
    return false;
  }
  $friendslist_ids = $user_info['user_friend_ids'];
  $friendslist_array = explode(" ", $friendslist_ids);
  if (!in_array($id, $friendslist_array)) {
    $friendslist_ids .= " ".$id;
}

//Aqui vamos a agregar el id del usuario q esta añadiendo a la lista, a la lista de ids que han agregado al amigo
$sql = "SELECT *
            FROM ".USERS_TABLE."
            WHERE user_id = ".$id;
    $friend_row = $site_db->query_firstrow($sql);
$friendslist_you_ids = $friend_row['user_friend_you_ids'];
$friendslist_you_array = explode(" ", $friendslist_you_ids);
  if (!in_array($id, $friendslist_you_array)) {
    $friendslist_you_ids .= " ".$user_info['user_id'];
}
$friend_row['user_friend_you_ids'] = trim($friendslist_you_ids);

  $user_info['user_friend_ids'] = trim($friendslist_ids);
  $sql = "UPDATE ".USERS_TABLE."
          SET user_friend_ids = '".$user_info['user_friend_ids']."'
          WHERE user_id = ".$user_info['user_id'];

    $sql2 = "UPDATE ".USERS_TABLE."
          SET user_friend_you_ids = '".$friend_row['user_friend_you_ids']."'
          WHERE user_id = ".$friend_row['user_id'];
    $site_db->query($sql);
    $site_db->query($sql2);
return true;
 
}

function remove_from_friendslist($id) {
  global $user_info, $site_db;
  $friendslist_array = explode(" ",$user_info['user_friend_ids']);
  foreach ($friendslist_array as $key => $val) {
    if ($val == $id) {
      unset($friendslist_array[$key]);
    }
  }
  $user_info['user_friend_ids'] = trim(implode(" ", $friendslist_array));
  $sql = "UPDATE ".USERS_TABLE."
          SET user_friend_ids = '".$user_info['user_friend_ids']."'
          WHERE user_id = ".$user_info['user_id'];
  if ($site_db->query($sql)){ //Si se han borrado correctamente, lo borramos de la otra lista
  $sql = "SELECT *
            FROM ".USERS_TABLE."
            WHERE user_id = ".$id;
    $friend_row = $site_db->query_firstrow($sql);
$friendslist_you_array = explode(" ",$friend_row['user_friend_you_ids']);
  foreach ($friendslist_you_array as $key => $val) {
    if ($val == $user_info['user_id']) {
       unset($friendslist_you_array[$key]);
    }
  }
  $friend_row['user_friend_you_ids'] = trim(implode(" ", $friendslist_you_array));
  $sql2 = "UPDATE ".USERS_TABLE."
          SET user_friend_you_ids = '".$friend_row['user_friend_you_ids']."'
          WHERE user_id = ".$id;
  $site_db->query($sql2);
  return true;
 
  }else{   
  return false;
  }
}

function clear_friendslist() {
  global $user_info, $site_db;
 
  $friendslist_array = explode(" ",$user_info['user_friend_ids']);
  foreach ($friendslist_array as $key => $val) {
      $sql = "SELECT *
            FROM ".USERS_TABLE."
            WHERE user_id = ".$val;
    $friend_row = $site_db->query_firstrow($sql);
$friendslist_you_array = explode(" ",$friend_row['user_friend_you_ids']);
  foreach ($friendslist_you_array as $key => $val2) {
    if ($val2 == $user_info['user_id']) {
       unset($friendslist_you_array[$key]);
    }
  }
  $friend_row['user_friend_you_ids'] = trim(implode(" ", $friendslist_you_array));
  $sql = "UPDATE ".USERS_TABLE."
          SET user_friend_you_ids = '".$friend_row['user_friend_you_ids']."'
          WHERE user_id = ".$val;
$site_db->query($sql); 
  }
  $sql2 = "UPDATE ".USERS_TABLE."
          SET user_friend_ids = ''
          WHERE user_id = ".$user_info['user_id'];
  if ($site_db->query($sql2)) {
    $user_info['user_friend_ids'] = "";
    return true;
  }
  else {
    return false;
  }
}

function check_friendslist($id) {
  global $user_info;
  $friendslist_array = explode(" ", $user_info['user_friend_ids']);
  return in_array($id, $friendslist_array);
}
/////////////////
//END FRIENDSLIST
/////////////////

Open member.php
Search:
Code: [Select]
if (($user_info['user_level'] != GUEST) && ($user_info['user_id'] != $user_row['user_id'])) {
    $friendslist_url = $self_url;
    $friendslist_url .= (!empty($mode)) ? ((strpos($friendslist_url, '?') !== false) ? "&amp;" : "?")."mode=".$mode : "";
    $friendslist_url .= strpos($friendslist_url, '?') !== false ? "&amp;" : "?";

    if (check_friendslist($user_row['user_id'])) {
      $friendslist_url .= "action=removefromfriendslist&amp;id=".$user_row['user_id']."";
      $friendslist_button = "<a href=\"".$site_sess->url($friendslist_url)."\"><img src=\"".get_gallery_image("friendslist_yes.gif")."\" border=\"0\" alt=\"\" /></a>";
    }
    else {
      $friendslist_url .= "action=addtofriendslist&amp;id=".$user_row['user_id']."";
      $friendslist_button = "<a href=\"".$site_sess->url($friendslist_url)."\"><img src=\"".get_gallery_image("friendslist_no.gif")."\" border=\"0\" alt=\"\" /></a>";
    }
  }
  else {
    $friendslist_button = "<img src=\"".get_gallery_image("friendslist_off.gif")."\" border=\"0\" alt=\"\" />";
  }
$site_template->register_vars("lang_friendslist_add", $lang['lang_friendslist_add']);
       

After add:   $friends_limit = 10; 10 is a default, you can edit the limit of users that you want to show in profiles
Code: [Select]
    $friends_limit = 10;  //Edit the limit of users that you want to show in profiles

    if (!empty($user_row['user_friend_you_ids'])) {

$friendslist_you_array = explode(" ", $user_row['user_friend_you_ids']);
$friendslist_you_array = array_reverse($friendslist_you_array);

$friends_user = "<b>".$lang['user_friend_you'].$user_row['user_name'].":</b> ";
foreach ($friendslist_you_array as $key => $val) {
        $sql = "SELECT user_id, user_name, user_gender
FROM ".USERS_TABLE."
              WHERE user_id = '".$val."'";
    $friends_row = $site_db->query_firstrow($sql);
  $friends_user .= "<a href='member.php?action=showprofile&user_id=".$friends_row['user_id']."'>".$friends_row['user_name']."</a> | ";
  $friends_limit--;
  if($friends_limit == 0){
   break;
   }
  }

}

//--- END FRIENDSLIST MOD ---

Search:
Code: [Select]
  "friendslist_button" => $friendslist_button, //Friend list modAfter add:
Code: [Select]
  "friendslist_add_you" => $friends_user, //Friend list mod
Open main.php
Search:
Code: [Select]
//-----------------------------------------------------
//--- Friendslist  -------------------------------------
//-----------------------------------------------------

After add:
Code: [Select]
$lang['user_friend_you'] = "List of users that added as a friend to ";
Open templates/yourtheme/member_profile.html

Paste {friendslist_add_you} where you like it

That's all ;)

PS: This weekend i will work in another addon that needs the last. This new addon will send pms to users that added you as a friend when you upload a picture
Title: Re: [MOD] Buddy List || Friend List
Post by: Loda on May 18, 2007, 10:01:07 AM
wow! works fine!
thank you very much!
Title: Re: [MOD] Buddy List || Friend List
Post by: Fragezeichen on June 10, 2007, 04:37:58 PM
i cheket all codes but it seems all time the same error,

Parse error: syntax error, unexpected T_DOUBLE_ARROW in /var/www/html/web609/html/includes/page_header.php on line 338

could someone please help?
Title: Re: [MOD] Buddy List || Friend List
Post by: ccsakuweb on June 10, 2007, 04:43:59 PM
please could you paste here the lines near of line 338  in includes/page_header.php???

and, please what 4images version use your galley??
Title: Re: [MOD] Buddy List || Friend List
Post by: Fragezeichen on June 14, 2007, 01:00:23 PM
thanks for this great mod,
but there is not posible to show buddy-icon in member profile.
i´f use the &nbsp;&nbsp;{friendslist_button} tag,but nothin happen.
only by details.html it works well
Title: Re: [MOD] Buddy List || Friend List
Post by: ccsakuweb on June 15, 2007, 11:06:21 AM
do you have in member.php the next??
Code: [Select]
if (($user_info['user_level'] != GUEST) && ($user_info['user_id'] != $user_row['user_id'])) {
    $friendslist_url = $self_url;
    $friendslist_url .= (!empty($mode)) ? ((strpos($friendslist_url, '?') !== false) ? "&amp;" : "?")."mode=".$mode : "";
    $friendslist_url .= strpos($friendslist_url, '?') !== false ? "&amp;" : "?";

    if (check_friendslist($user_row['user_id'])) {
      $friendslist_url .= "action=removefromfriendslist&amp;id=".$user_row['user_id']."";
      $friendslist_button = "<a href=\"".$site_sess->url($friendslist_url)."\"><img src=\"".get_gallery_image("friendslist_yes.gif")."\" border=\"0\" alt=\"\" /></a>";
    }
    else {
      $friendslist_url .= "action=addtofriendslist&amp;id=".$user_row['user_id']."";
      $friendslist_button = "<a href=\"".$site_sess->url($friendslist_url)."\"><img src=\"".get_gallery_image("friendslist_no.gif")."\" border=\"0\" alt=\"\" /></a>";
    }
  }
  else {
    $friendslist_button = "<img src=\"".get_gallery_image("friendslist_off.gif")."\" border=\"0\" alt=\"\" />";
  }
$site_template->register_vars("lang_friendslist_add", $lang['lang_friendslist_add']);
and
Code: [Select]
  "friendslist_button" => $friendslist_button, //Friend list mod??
Title: Re: [MOD] Buddy List || Friend List
Post by: Fragezeichen on June 15, 2007, 11:19:03 AM
yes,and the freindlist works well.
i can add the button by the comments,not in the profile
Title: Re: [MOD] Buddy List || Friend List
Post by: ccsakuweb on June 15, 2007, 12:22:12 PM
please attach your member.php like member.txt
Title: Re: [MOD] Buddy List || Friend List
Post by: Fragezeichen on June 16, 2007, 01:38:22 PM
pls check,that´s nice...
 :D
Title: Re: [MOD] Buddy List || Friend List
Post by: ccsakuweb on June 16, 2007, 01:41:53 PM
do you have in member.php the next??
Code: [Select]
if (($user_info['user_level'] != GUEST) && ($user_info['user_id'] != $user_row['user_id'])) {
    $friendslist_url = $self_url;
    $friendslist_url .= (!empty($mode)) ? ((strpos($friendslist_url, '?') !== false) ? "&amp;" : "?")."mode=".$mode : "";
    $friendslist_url .= strpos($friendslist_url, '?') !== false ? "&amp;" : "?";

    if (check_friendslist($user_row['user_id'])) {
      $friendslist_url .= "action=removefromfriendslist&amp;id=".$user_row['user_id']."";
      $friendslist_button = "<a href=\"".$site_sess->url($friendslist_url)."\"><img src=\"".get_gallery_image("friendslist_yes.gif")."\" border=\"0\" alt=\"\" /></a>";
    }
    else {
      $friendslist_url .= "action=addtofriendslist&amp;id=".$user_row['user_id']."";
      $friendslist_button = "<a href=\"".$site_sess->url($friendslist_url)."\"><img src=\"".get_gallery_image("friendslist_no.gif")."\" border=\"0\" alt=\"\" /></a>";
    }
  }
  else {
    $friendslist_button = "<img src=\"".get_gallery_image("friendslist_off.gif")."\" border=\"0\" alt=\"\" />";
  }
$site_template->register_vars("lang_friendslist_add", $lang['lang_friendslist_add']);
and
Code: [Select]
  "friendslist_button" => $friendslist_button, //Friend list mod??


you don't have this code in your member.php


in [MOD]FriendsList_english_install.txt you can read the next
Code: [Select]
#
#-----[ ABRIR ]--------------------------------------------
# //NOte: If you want that the users add their friends from members profiles
member.php

#
#-----[ FIND ]--------------------------------------------
#
    if (!empty($user_row['user_email']) && (!isset($user_row['user_showemail']) || (isset($user_row['user_showemail']) && $user_row['user_showemail'] == 1))) {
      $user_email = $user_row['user_email'];

#
#-----[ BEFORE, ADD ]--------------------------------------------
#
//-----------------------------------------------------
//--- BEGIN FRIENDSLIST MOD ---------------------------
//-----------------------------------------------------
//FRIENDS LIST MOD

 if (($user_info['user_level'] != GUEST) && ($user_info['user_id'] != $user_row['user_id'])) {
    $friendslist_url = $self_url;
    $friendslist_url .= (!empty($mode)) ? ((strpos($friendslist_url, '?') !== false) ? "&amp;" : "?")."mode=".$mode : "";
    $friendslist_url .= strpos($friendslist_url, '?') !== false ? "&amp;" : "?";

    if (check_friendslist($user_row['user_id'])) {
      $friendslist_url .= "action=removefromfriendslist&amp;id=".$user_row['user_id']."";
      $friendslist_button = "<a href=\"".$site_sess->url($friendslist_url)."\"><img src=\"".get_gallery_image("friendslist_yes.gif")."\" border=\"0\" alt=\"\" /></a>";
    }
    else {
      $friendslist_url .= "action=addtofriendslist&amp;id=".$user_row['user_id']."";
      $friendslist_button = "<a href=\"".$site_sess->url($friendslist_url)."\"><img src=\"".get_gallery_image("friendslist_no.gif")."\" border=\"0\" alt=\"\" /></a>";
    }
  }
  else {
    $friendslist_button = "<img src=\"".get_gallery_image("friendslist_off.gif")."\" border=\"0\" alt=\"\" />";
  }
$site_template->register_vars("lang_friendslist_add", $lang['lang_friendslist_add']);
       

//--- END FRIENDSLIST MOD ---


#
#-----[ FIND ]--------------------------------------------
#
      "user_homepage" => $user_homepage,

#
#-----[ AFTER, ADD ]--------------------------------------------
#
  "friendslist_button" => $friendslist_button, //Friend list mod
Title: Re: [MOD] Buddy List || Friend List
Post by: Fragezeichen on June 16, 2007, 10:51:08 PM
 8O ....aha,now it works!
just a mistake,but big thanks for your help
 :D
Title: Re: [MOD] Buddy List || Friend List
Post by: ccsakuweb on June 16, 2007, 11:47:38 PM
 :D it's ok!  :wink: if you have another question im here
Title: Re: [MOD] Buddy List || Friend List
Post by: ccsakuweb on July 24, 2007, 06:55:14 PM
ADDON Send PM to users that added you as a friend for notify that you have uploaded a file

create an atribute in users table named allow_pmf_uploads type: INT and default 1
in member.php

search:
Code: [Select]
      else {
        $sql = "INSERT INTO ".IMAGES_TEMP_TABLE."
                (cat_id, user_id, image_name, image_description, image_keywords, image_date, image_media_file, image_thumb_file, image_download_url".$additional_field_sql.")
                VALUES
                ($cat_id, ".$user_info['user_id'].", '$image_name', '$image_description', '$image_keywords', $current_time, '$new_name', '$new_thumb_name', '$image_download_url'".$additional_value_sql.")";
        $result = $site_db->query($sql);
      }

add after:
Code: [Select]
  //MOD FRIENDLIST SEND PM TO FRIENDS THAT ADDED YOU TO THEIR LIST
if ($direct_upload && !empty($user_info['user_friend_you_ids'])) {

$user_id = $user_info['user_id'];

$image_url = $script_url."/details.php?".URL_IMAGE_ID."=".$image_id."";
$image_name_url = "[url=".$image_url."]".$image_name."[/url]";

if (!empty($new_thumb_name)) {
$thumb = $site_sess->url(ROOT_PATH."data/thumbnails/".$cat_id."/".$new_thumb_name);
$thumb = "[url=".$image_url."][img]".$thumb."[/img][/url]";
} else {
$thumb = "";
}

$pm_from = $user_info['user_id'];
$pm_type = 5;
$pm_bbcode = 1;
$pm_smiles = 1;
$pm_sig = "-- \n If you don't want to receive pms about the new images uploaded from your friends, modify this option in your control panel. ";

$pm_message = "I uploaded a new file, the name is ".$image_name.". Please comment this file ok? \n\n [B]URL:[/B] ".$image_name_url."\n".$thumb." \n\n".$pm_sig;
$pm_subject = "\"".$user_info['user_name']."\" has uploaded a new file: ".$image_name;


$friendslist_you_array = explode(" ", $user_info['user_friend_you_ids']);
$friendslist_you_array = array_reverse($friendslist_you_array);
foreach ($friendslist_you_array as $key => $val) {
        $sql2 = "SELECT allow_pmf_uploads
FROM ".USERS_TABLE."
              WHERE user_id = '".$val."'";
    $friends_row = $site_db->query_firstrow($sql2);
if($friends_row['allow_pmf_uploads']){
$sql = "INSERT INTO ".PM_TABLE."
(pm_date, pm_to, pm_from, pm_subject, pm_type, pm_text, pm_bbcode, pm_html, pm_ip, pm_smiles)
VALUES
('".time()."', $val, $pm_from, '".$pm_subject."', $pm_type, '".$pm_message."', $pm_bbcode, 0, '".$session_info['session_ip']."', $pm_smiles)";
$result = $site_db->query($sql);
}
}//end foreach
 
      }

search:
Code: [Select]
   $sql = "UPDATE ".USERS_TABLE."
           SET ".get_user_table_field("", "user_email")." = '$user_email', ".get_user_table_field("", "user_showemail")." = $user_showemail, ".get_user_table_field("", "user_allowemails")." = $user_allowemails,

add after in the same line:
Code: [Select]
allow_pmf_uploads = '$allow_pmf_uploads' ,
search:
Code: [Select]
    $user_allowemails = $user_info['user_allowemails'];
add after:

Code: [Select]
$allow_pmf_uploads = $user_info['allow_pmf_uploads'];
search:
Code: [Select]
  if ($user_allowemails == 1) {
    $user_allowemails_yes = " checked=\"checked\"";
    $user_allowemails_no = "";
  }
  else {
    $user_allowemails_yes = "";
    $user_allowemails_no = " checked=\"checked\"";
  }

add after:
Code: [Select]
if ($allow_pmf_uploads  == 1) {
      $allow_pmf_uploads_yes = " checked=\"checked\"";
      $allow_pmf_uploads_no = "";
    }
    else {
      $allow_pmf_uploads_yes = "";
      $allow_pmf_uploads_no = " checked=\"checked\"";
  }

open includes/page_header.php
search:
Code: [Select]
  "charset" => $lang['charset'],add after:
Code: [Select]
"lang_allowpmfuploads" => $lang['allowpmfuploads'],
open includes/db_field_definitions.php
search:
Code: [Select]
?>
add before:
Code: [Select]
$additional_user_fields['allow_pmf_uploads'] = array($lang['allow_pmf_uploads'], "radio", 0);
open lang/yorlang/main.php
search:
Code: [Select]
$lang['allow_emails']add  after in a new line:

Code: [Select]
$lang['allowpmfuploads'] = "Receive PMs when your friends upload new images:";
open templates/yourtheme/member_editprofile.html
search:
Code: [Select]
          <tr>
            <td class="row1"><b>{lang_user_pm_popup}</b></td>
            <td class="row1">
              <input type="radio" name="user_pm_popup" value="1"{user_pm_popup_yes} />
              {lang_yes}&nbsp;&nbsp;&nbsp;
              <input type="radio" name="user_pm_popup" value="0"{user_pm_popup_no} />
              {lang_no}
            </td>
          </tr>
add after:
Code: [Select]
<tr>
            <td class="row2"><b>{lang_allowpmfuploads}</b></td>
            <td class="row2">
              <input type="radio" name="allow_pmf_uploads" value="1"{allow_pmf_uploads_yes} />
              {lang_yes}&nbsp;&nbsp;&nbsp;
              <input type="radio" name="allow_pmf_uploads" value="0"{allow_pmf_uploads_no} />
              {lang_no}
            </td>
          </tr>


That's all ;)
Title: Re: [MOD] Buddy List || Friend List
Post by: Loda on July 25, 2007, 06:12:13 PM
you're great!
works fine!!
thank you very much for the addon!!  :D
Title: Re: [MOD] Buddy List || Friend List
Post by: Loda on July 26, 2007, 10:22:09 AM
hello!
maybe a mistake is in your code?
"$imgname" is it correct?
i don't know but i think you need "$image_name" ?
 :(  :?:
Title: Re: [MOD] Buddy List || Friend List
Post by: Mr_LovaLove on July 26, 2007, 08:45:03 PM
BiG thanks 4 both of u :Pp !!

really its a great MOD !!

well im new with 4images !

i have a small question !!

i installed the MOD ! but thought there will be a PM MSGs in my site !!

as a Friends List and Buddy List its working fine ! and more than fine :Pp

but where is the PMs !! O_o

Do i have to install it from somewhere else !

or this MOD already has this function  !

BIG THANKS AGAIN
Title: Re: [MOD] Buddy List || Friend List
Post by: ccsakuweb on July 27, 2007, 11:41:03 AM
@Mr_LovaLove. hi! is great that this mod work in your site. what version gallery do you have?
 if you want to receive pms when a friend upload a file you need pmv2 installed. Here: http://www.4homepages.de/forum/index.php?topic=6692.0   

 @Loda: i think that $image_name is right too. and i can use $imgname, can't you use this variable? i wrote the mod fast because i am out of home and i wanted to write it before that i forgot any step. hehe i forgot to translate spanish pm to english pm
Title: Re: [MOD] Buddy List || Friend List
Post by: Loda on July 27, 2007, 05:32:29 PM
@Loda: i think that $image_name is right too. and i can use $imgname, can't you use this variable? i wrote the mod fast because i am out of home and i wanted to write it before that i forgot any step. hehe i forgot to translate spanish pm to english pm

hi,
i can only used $image_name"
my 4images version is 1.7, i think that's the reason.
 :wink: i translate your spanish language to my native language  :wink: no problem!
thank you for your "fast" work!  :D
Title: Re: [MOD] Buddy List || Friend List
Post by: ccsakuweb on July 28, 2007, 12:44:53 PM
ok! i will change the variable in the addon ^^
and.. sorry.. my english is horrible hehe. there are a lot of time that i don't study it and i only practice english here. I must speak like the Indians :P
Title: Re: [MOD] Buddy List || Friend List
Post by: Mr_LovaLove on July 28, 2007, 04:09:48 PM
@ccsakuweb  thanks for your replay !!

yes it works and fine only one small problem ( also thanks for the pm link )

Well, im using 1.7.4

in fact, it was working very well in the local host !! but after i upload it ( and its my first upload for the MYSQL DATABASE ) this error appears to me *MAD*

Error: Unknown column 'used_ips' in 'field list'

and i thought its from one of the tables in my database !! searched  for this used_ips !! couldn't find it !! it might not cased by ur MOD coz i already added Best Uploader MOD and Ban MOD

also the Avatar MOD !!

Poor Me :Pp !!

i hope you have the sulotion

btw, all these MODS and urs was uploaded at same time ! :(







Title: Re: [MOD] Buddy List || Friend List
Post by: Mr_LovaLove on July 28, 2007, 08:52:51 PM
I just removed the Ban + Best Uploader MODs

But seems there error comes from another MODs ! :(

waiting for a replay
Title: Re: [MOD] Buddy List || Friend List
Post by: Loda on July 29, 2007, 09:37:44 AM
I just removed the Ban + Best Uploader MODs

But seems there error comes from another MODs ! :(

waiting for a replay
i think you have insert the starrating mod:
http://www.4homepages.de/forum/index.php?topic=17829.0
and you don't added the field used_ips
i'm right?
check your files..
Title: Re: [MOD] Buddy List || Friend List
Post by: Mr_LovaLove on July 29, 2007, 10:00:36 PM
@ Loda .. You were totally right ^_^

yes i didnt insert that field ! in fact, i did not complete that rate MOD ! but seems my database infected coz of that MOD ! :)

thanks alot u did a big fava for me :)

well, Now i have another small problem with this MOD ( Friends List )

first let me explain the first error that i fixed it ( i think the next error i will talk about has a link with this one )

when i go to my friend list i found my firends whenever i click on the number of the images that he/she has an error apears on the search page but the process goes normaly only the msg appears on the top of the page
so, i just canceled the link so the search for the users image not works anymore

and now the number of images for every friend in my friend list not working but when i search for my friend using the search bar
the link appears again ( for the number of images they have )

when i click on it

this error displayed :

Code: [Select]
Notice: Undefined variable: lightbox_total_count in /home/alwasmy/public_html/pix/includes/page_header.php on line 162
and my code in the line 162 is :

Code: [Select]
  "lightbox_total_count" => intval($lightbox_total_count),
same question goes to ccsakuweb as well :)

My solution is to delete the link :(

thanks again Loda :)
Title: Re: [MOD] Buddy List || Friend List
Post by: thunderstrike on July 30, 2007, 04:53:24 AM
Quote
"lightbox_total_count" => intval($lightbox_total_count),

change to:

Quote
"lightbox_total_count" => (isset($lightbox_total_count)) ? intval(trim($lightbox_total_count)) : 0,

Should work. ;)
Title: Re: [MOD] Buddy List || Friend List
Post by: Mr_LovaLove on July 30, 2007, 05:45:45 AM
Well thanks for fast replay :)


 im at work right now !! so just when i'll go back to home ganna try it :)

thanks alot  ^_^

Title: Re: [MOD] Buddy List || Friend List
Post by: Mr_LovaLove on July 30, 2007, 12:43:54 PM
Perfect :)

that solve the problem :)

ThaaaaaaaaaaankS ^_ ^


Title: Re: [MOD] Buddy List || Friend List
Post by: Mr_LovaLove on July 31, 2007, 12:48:48 PM

I'm now having this problem !

i set the size of the image 650 px for both width and hight and the image  size  that user uploaded is 450 width and 275 the hight ?!?!

and this error is appears:
Code: [Select]
Template Error: Couldn't open Template ./templates/infoqatar/exif_bit.html
how come ? any idea ?


Title: Re: [MOD] Buddy List || Friend List
Post by: thunderstrike on July 31, 2007, 01:05:56 PM
Quote
Template Error: Couldn't open Template ./templates/infoqatar/exif_bit.html

exif_bit.html does not exist on your infogatar folder. Take it from the default template. This will fix problem.
Title: Re: [MOD] Buddy List || Friend List
Post by: Mr_LovaLove on August 01, 2007, 12:40:01 AM
ThankS ^_^

that fix the problem :)

seems i forgot to move that file from the defualt to the new template

its my pleasure to be one of whom you helped em  ^_^
Title: Re: [MOD] Buddy List || Friend List
Post by: Stoleti on August 03, 2007, 02:24:05 AM
great mod , congratulations  :mrgreen:

but this would be better if we can block/ignore the user also  8)
Title: Re: [MOD] Buddy List || Friend List
Post by: thunderstrike on August 03, 2007, 04:20:10 AM
Quote
$user_id = $user_info['user_id'];
  $user_row = get_user_info($user_id);
   $sql = "SELECT *
        FROM ".USERS_TABLE."
        WHERE user_id = $user_id";
    $user_friends_info = $site_db->query_firstrow($sql);

No need from MOD ... $user_info use from includes/sessions.php file. No need call 2 time. ;)

And this:

Quote
if (isset($user_info['user_friends_ids']) && !empty($user_info['user_friend_ids'])) {
    $friends_id_sql = str_replace(" ", ",", trim($user_info['user_friend_ids']));
   }else{
      $friends_id_sql=0;
   }

;)
Title: Re: [MOD] Buddy List || Friend List
Post by: ccsakuweb on August 03, 2007, 02:44:29 PM
wow thank you thunderstrike. Im new in php and this is my first mod ^^ i will change this and it will be more optimizated

how many time stolety, i remember when we req a buddylist ;)
Title: Re: [MOD] Buddy List || Friend List
Post by: thunderstrike on August 03, 2007, 02:48:55 PM
No prob. Took look at code and I like. Close to clean code. :)

1 comment - should use $action foreach request. Stoleti ask for ignore user, easy to addin with seperate $action. ;)
Title: Re: [MOD] Buddy List || Friend List
Post by: Stoleti on August 03, 2007, 04:48:34 PM
wow thank you thunderstrike. Im new in php and this is my first mod ^^ i will change this and it will be more optimizated

how many time stolety, i remember when we req a buddylist ;)

yea i've been lil out, also i've made few php works, well i'm back and i'm happy for you did it , also i'll try make few addons  8)
Title: Re: [MOD] Buddy List || Friend List
Post by: Stoleti on August 03, 2007, 11:18:59 PM
where can i find the english version for lang files in english ?

 :roll:
Title: Re: [MOD] Buddy List || Friend List
Post by: thunderstrike on August 04, 2007, 12:34:55 AM
Install lang / whole MOD lang ?
Title: Re: [MOD] Buddy List || Friend List
Post by: ccsakuweb on August 04, 2007, 01:23:49 PM
Im sorry i forgot to translate lang variables in spanish to english. I translated the steps and explanation.

 I dont understand what you two said about ignore an user... what i have to ignore?? that an user add me as friend??
Title: Re: [MOD] Buddy List || Friend List
Post by: thunderstrike on August 04, 2007, 01:26:20 PM
Quote
what i have to ignore??

Hard for me to get first time.  :lol:

Think like: Buddy List / Hate List ... mirror thing request.
One like + one hate in one module.  :mrgreen:
Title: Re: [MOD] Buddy List || Friend List
Post by: ccsakuweb on August 04, 2007, 01:35:55 PM
lol is the first time that i hear something like that xDDD
I wouldn't like have a list with people that i don't like xD  But with that it would be posible doing a counter about how popular is an user.
I think that a hate list is easy to make... it would be a list like buddy list, but i would have to list users from two list in the same page. isn't it?  i will search information about $action foreach. I am newest coding in php.

sorry because my horrible english..
Title: Re: [MOD] Buddy List || Friend List
Post by: thunderstrike on August 04, 2007, 02:08:23 PM
Quote
but i would have to list users from two list in the same page. isn't it?

Other way ... need two diff list (one for like, one for hate).  :mrgreen:

Quote
i will search information about $action foreach.

Great examp from member.php file. ;)
Title: Re: [MOD] Buddy List || Friend List
Post by: Stoleti on August 04, 2007, 04:37:57 PM
Im sorry i forgot to translate lang variables in spanish to english. I translated the steps and explanation.

 I dont understand what you two said about ignore an user... what i have to ignore?? that an user add me as friend??

well just doing the inverse, for example blocking a user, making him not possible see your profile  :mrgreen: 

add to friends / block this user  :wink:
Title: Re: [MOD] Buddy List || Friend List
Post by: thunderstrike on August 04, 2007, 05:08:47 PM
Yes, is right. ;)
Title: Re: [MOD] Buddy List || Friend List
Post by: ccsakuweb on August 04, 2007, 05:17:37 PM
making him not possible see your profile  :mrgreen: 

add to friends / block this user  :wink:
ok! if i find time i will try it
Title: Re: [MOD] Buddy List || Friend List
Post by: thunderstrike on August 04, 2007, 06:07:08 PM
Quote
making him not possible see your profile

Can integrate wit profile invisible MOD. ;)

http://www.4homepages.de/forum/index.php?topic=18185.0
Title: Re: [MOD] Buddy List || Friend List
Post by: ccsakuweb on August 04, 2007, 09:34:41 PM
wow thanks i didn't know that mod
Title: Re: [MOD] Buddy List || Friend List
Post by: Stoleti on August 04, 2007, 09:41:29 PM
well i know about that mod, but question goes to not make invisible for ALL , but just for a especific member, example: imagine you've some issues with one member and you dotn want him to have access to your profile,so you block him, but the other still having access ;)

 :mrgreen:

gosh i'm re-build my site, ill need weeks to add the mods  :mrgreen:
Title: Re: [MOD] Buddy List || Friend List
Post by: thunderstrike on August 04, 2007, 10:00:27 PM
Quote
one member and you dotn want him to have access to your profile,so you block him, but the other still having access

Little modify need for that. ;)
Title: Re: [MOD] Buddy List || Friend List
Post by: Stoleti on August 05, 2007, 04:01:30 AM
well i hope so :) lil...
Title: Re: [MOD] Buddy List || Friend List
Post by: thunderstrike on August 05, 2007, 05:50:29 AM
If action seperate, can work on it.
Title: Re: [MOD] Buddy List || Friend List
Post by: Mr_LovaLove on August 05, 2007, 09:06:46 PM
seems many topic was discussed here  :D

hope to know how 4images work :P

still got lost for solving my problem !!

im having an error and thunderstrike ( big thanks ) solved my last problem but while i was testing nothin was discovered

but 2day i found this error :

Code: [Select]
Notice: Undefined variable: report_url in /home/alwasmy/public_html/pix/includes/functions.php on line 860

Notice: Undefined variable: report_url in /home/alwasmy/public_html/pix/includes/functions.php on line 860

Notice: Undefined variable: report_url in /home/alwasmy/public_html/pix/includes/functions.php on line 860

Notice: Undefined variable: report_url in /home/alwasmy/public_html/pix/includes/functions.php on line 860

Notice: Undefined variable: report_url in /home/alwasmy/public_html/pix/includes/functions.php on line 860

i went to the function line and found this:

Code: [Select]
"report_image_url" => $report_url,
i was tryin to find the variable but where i can find it !!! it seems set somewhere in the code

i need to know where so i can solve it

plz if anyone will solve this plz give me a breif explanation so i can get the idea ^_^

need to learn more from u guyz

thanks again
Title: Re: [MOD] Buddy List || Friend List
Post by: Mr_LovaLove on August 05, 2007, 09:10:32 PM
i comment the code in the functions.php

but hope that wont effect any of my codes :S


now tis working perfectly

but still need to know why i got that error

sorry 4 being talkative :P
Title: Re: [MOD] Buddy List || Friend List
Post by: thunderstrike on August 05, 2007, 09:39:15 PM
Quote
but hope that wont effect any of my codes

Yes ... it will.  :|

Quote
but still need to know why i got that error

I explain in Report a picture topic ...

Quote
"report_image_url" => $report_url,

Replace:

Quote
"report_image_url" => (isset($report_url)) ? $report_url : "",

Report problem off topic with buddy list ... :?
Title: Re: [MOD] Buddy List || Friend List
Post by: Mr_LovaLove on August 06, 2007, 02:23:20 PM
thanks alot for helping

^_^

that solve the problem

but still didnt get why the error was and the topic was working fine !!

but really u did alot for me ! hope to help u with the days ^_^

and ganna find that topic u added in ur last comment ! to find why was that error
Title: Re: [MOD] Buddy List || Friend List
Post by: thunderstrike on August 06, 2007, 02:37:55 PM
Easy. Variable not pre-define before execute (windows server need - no linux - work direct on linux - no need pre-define). Suppose you 4images on windows ?
Title: Re: [MOD] Buddy List || Friend List
Post by: Stoleti on August 06, 2007, 10:03:41 PM
somebody can translate at least this part:

Quote
$lang['friendslist_no_images'] = "No tienes amigos almacenados. Para guardarlos haz clic en la imagen Amigo en los comentarios.";
$lang['friendslist_add_success'] = "Amigo guardado.";
$lang['friendslist_add_error'] = "¡Error agregando amigo a la lista!";
$lang['friendslist_remove_success'] = "Amigo eliminado.";
$lang['friendslist_remove_error'] = "¡Error borrando amigo!";
$lang['friendslist_register'] = "Para poder usar su listado de amigos, debe registrarse.<br />&raquo; <a href=\"{url_register}\">Registrarse ahora</a>";
$lang['friendslist_delete_success'] = "Lista de amigos eliminada.";
$lang['friendslist_delete_error'] = "¡Error eliminando lista de amigos!";
$lang['delete_friendslist'] = "Eliminar lista de amigos";
$lang['friendslist_lastaction'] = "Última actualización en su lista de amigos:";
$lang['delete_friendslist_confirm'] = "¿Esta seguro de eliminar su lista de amigos?";

 :|
Title: Re: [MOD] Buddy List || Friend List
Post by: thunderstrike on August 06, 2007, 10:14:09 PM
http://world.altavista.com ;)
Title: Re: [MOD] Buddy List || Friend List
Post by: Stoleti on August 06, 2007, 10:19:53 PM
dude....everybody knows that kind of translators sucks as hell ..mostly of times make translations without any sense, i prefer somebody , a user or try find out somebody to help :)

but thanks for the tip  :wink:
Title: Re: [MOD] Buddy List || Friend List
Post by: thunderstrike on August 06, 2007, 10:20:50 PM
Don't like it, use Google. ;)
Title: Re: [MOD] Buddy List || Friend List
Post by: Mr_LovaLove on August 07, 2007, 07:03:08 AM
@Stoleti

well !! i use aan online site :P !! and it works !! ( but with little small mistakes in some words )

after testin teh mod you will know where ur mistakes are :P !! ( talking about translating )

------------------
My Part
------------------
hmmm, while i was testing !! i figer something little bet wired ! ( no its all wierd )

b4 this mod i already downloaded the Best Uploader MOD !

and it was working ! in local host perfect ! so i didnt test it that musch when i uploaded to my site !!

but know i reliazed that, the count of pictures for my 5 best uploader wont change even he/she uploaded 10000 pix ! that wont effect the counter ! untill one of hi/her friend who has add him/her to his buddy list

in the buddy list, if the user in my buddy list ( and he is one of the best uploader ) when i click on the number of his uploaded pix in the site the search run and gives me all his uploaded pix in the site and then the best uploader number will be updated :S

( example:
my nickname is: Mr_LovaLove
im in the best uploader nick and the count in next to my nick name is :50 pix

i uploaded another 20 pix 2day ! so my totall pix in the site is: 70 pix

whatever i do that number in the best uploader wont change it will be 50 and wont become 70 pix

let assume thunderstrike added me in his friend list

when he click on the list he will see that i have only have 50 pix !! ( and it suppose to be 70 pix )

if he clicks on 50 ( in the friend list ) then everything will be changed to 70 !! in the friend list and in the best uploader !

* lol the good thing is ! i figured this mistake while i was trying to know where my last error was :P and we can say thunderstrike who discovered this :P *


sorry no error code :P
Title: Re: [MOD] Buddy List || Friend List
Post by: Stoleti on August 07, 2007, 05:43:28 PM
hopefully i've got friend from chile who are going translate it to english  :wink:
Title: Re: [MOD] Buddy List || Friend List
Post by: ccsakuweb on August 08, 2007, 02:16:17 AM
@Mr_LoveLove : hehe you are right , i saw that mistake a lot time ago, when i havent yet finished all the mod. And i forgot to fix that little bug. But at now here is 2:11 am and i don't have neurons working hehe... I will try to fix that bug tomorrow. And i will install a new list for hated people with little modifications from this mod

@sToleti: I didnt translated it because my english is horrible. Please, when your friend finish the translation, it would be great if you share it with us
Title: Re: [MOD] Buddy List || Friend List
Post by: Mr_LovaLove on August 08, 2007, 03:25:02 PM
thanks alot for the fast replay

in fact, this mod is great and i can hide the best uploader at this time :P

thought this error comes from my code ! so i was searching alot in my code ! well u just cut that off :P !! now i can go and try to make some modificatio in the
design

and yeah , waiting for ur MOD and hope to see this mod with the pm v2 ! coz i tried alot and still trying to solve the mysql error to see how pm v2 and list friends work 2gother

i saw that u have added many ADD ONS :D and almost all works with the PM *hate to wait* :P

thanks again for this nice MOD and waiting to see the hated MOD ^_*

dont worry this topic is on my favorites  list
Title: Re: [MOD] Buddy List || Friend List
Post by: Stoleti on August 09, 2007, 12:03:01 AM
@ccsakuweb , sure i'll post here, but one note if you say your english is horrible, so you should see my spanish ... "crime against mankind"  :mrgreen:
Title: Re: [MOD] Buddy List || Friend List
Post by: ccsakuweb on August 09, 2007, 01:11:07 AM
if you want i will teach you xD

thank you Mr_LoveLove, ^^ im really happy that you like this mod :)  Im busy but i will find free time and i will make more and more addons for this mod hehe
Title: Re: [MOD] Buddy List || Friend List
Post by: thunderstrike on August 09, 2007, 01:20:28 AM
Question ... is whos online in MOD ?
Title: Re: [MOD] Buddy List || Friend List
Post by: ccsakuweb on August 09, 2007, 09:26:02 PM
wow what a nice idea!!

and it would be great too an option that send pm to all friends with pm v2
Title: Re: [MOD] Buddy List || Friend List
Post by: thunderstrike on August 09, 2007, 09:36:20 PM
Did it for friendslist (my version - for whosonline). Look good. Think this one is build - no so ... ;)
Title: Re: [MOD] Buddy List || Friend List
Post by: Mr_LovaLove on August 10, 2007, 02:45:26 AM
@ccsakuweb

well, no need to harry up :P !! just take ur time its ur MOD and no one ganna say anythin if u close this subject :P !! so (what about if u post a late ADD-ONS :Pp )

good luck with ur study:P


@thunderstrike

No worries :P !!


we will wait ur code or her code ^_* but seems u find a good way with small part of codin' :P am i right !!

it will be great if u just post it ( as long as go with this rule: sharing is caring ) :P

Title: Re: [MOD] Buddy List || Friend List
Post by: fast on August 12, 2007, 11:13:52 AM
Addon user status:
search:
Code: [Select]
<td class=\"head2\" align=\"center\">".$lang['user_name']."</td>\nadd after in the same line:
Code: [Select]
<td class=\"head2\" align=\"center\">Status:</td>\nsearch:
Code: [Select]
$user_name = "";add after
Code: [Select]
$user_status = "";search:
Code: [Select]
    $user_join_date = (isset($user_row['user_joindate'])) ? format_date($config['date_format'], $user_row['user_joindate']) : REPLACE_EMPTY;
add after:
Code: [Select]
$user_status = ($user_row['user_lastaction'] >= (time() - 300) && ((isset($user_row['user_invisible']) && $user_row['user_invisible'] == 0) || $user_info['user_level'] == ADMIN)) ? " <img src=\"".get_gallery_image("user_online.gif")."\" border=\"0\" alt=\"online\" />" : "<img src=\"".get_gallery_image("user_offline.gif")."\" border=\"0\" alt=\"Offline\" />";
search:
Code: [Select]
    $userlist .= "<td valign=\"top\" align=\"left\"> ".$user_name." </td>\n";
add after:
Code: [Select]
$userlist .= "<td valign=\"top\" align=\"center\">".$user_status."</td>\n";   
soon.. the other addons..

what do i have to do to be able to sort my user with the online status? like with the date of register or homepage etc.?
Title: Re: [MOD] Buddy List || Friend List
Post by: ccsakuweb on August 12, 2007, 10:02:00 PM
I think you can use the last_Action and order Desc

Search:
Code: [Select]
$lang['lang_sort_pictures']
Add after in the same line:
Code: [Select]
, "Status"
Search:
Code: [Select]
'user_t_images'
Add after in the same line:
Code: [Select]
, 'user_lastaction'
search:
Code: [Select]
case 'user_t_images':
$order_by = "user_t_images $sort_order";
break;

add after.
Code: [Select]
case 'user_lastaction':
$order_by = "user_lastaction $sort_order";
break;

;)
Title: Re: [MOD] Buddy List || Friend List
Post by: Lucifix on August 14, 2007, 12:01:58 AM
Hi great mod!

Is there a way to show user friends listed directly in his profile?
Title: Re: [MOD] Buddy List || Friend List
Post by: thunderstrike on August 14, 2007, 12:07:05 AM
Quote
Is there a way to show user friends listed directly in his profile?

Is URL link to point at friends from profile ?
Title: Re: [MOD] Buddy List || Friend List
Post by: Lucifix on August 14, 2007, 12:20:22 AM
I manage to add friends id in profile but I don't have time to change id to name:

In member.php before //--- END FRIENDSLIST MOD --- ADD:

Code: [Select]
$sql = "SELECT *
        FROM ".USERS_TABLE."
        WHERE user_id = ".$user_row['user_id']."";
    $user_friends_info = $site_db->query_firstrow($sql);
    $num_rows_all = 0;
    if (!empty($user_friends_info['user_friend_ids'])) {
    $friends_id_sql = str_replace(" ", "<br>", trim($user_friends_info['user_friend_ids']));
//here you need to make while and if sentece to get user name

}else{
$friends_id_sql=0;
}

    $site_template->register_vars(array(
          "lang_friendslist_add", $lang['lang_friendslist_add'],
  "user_friends" => $friends_id_sql
    ));

then in your profile template add:
Code: [Select]
{user_friends}
Title: Re: [MOD] Buddy List || Friend List
Post by: thunderstrike on August 14, 2007, 01:29:38 PM
Can no while with query_firstrow - only query.

Quote
change id to name

Quote
$sql = "SELECT *
        FROM ".USERS_TABLE."
        WHERE user_id = ".$user_row['user_id']."";
    $result = $site_db->query_firstrow($sql);

for:

Quote
if (empty($user_select_row_cache)) {
$sql = "SELECT " . get_user_table_field("", "user_id") . get_user_table_field(", ", "user_name") . "
           FROM ".USERS_TABLE."
           WHERE " . get_user_table_field("", "user_id") . " = ".$user_row['user_id'];
$user_friends_info = $site_db->query($sql);
$user_select_row_cache = array();
while ($row = $site_db->fetch_array($result)) {
    // Change ID to name.
    $user_select_row_cache[$row[$user_table_fields['user_id']]] = $row[$user_table_fields['user_name']];
}
Title: Re: [MOD] Buddy List || Friend List
Post by: Lucifix on August 15, 2007, 12:04:42 AM
I made it work with this code:

Code: [Select]
$sql_friends = "SELECT *
        FROM ".USERS_TABLE."
        WHERE user_id = ".$user_row['user_id']."";
$friends_row = $site_db->query_firstrow($sql_friends);

  if (!empty($friends_row['user_friend_ids'])) {
    $split_keywords = explode(" ", $friends_row['user_friend_ids']);
    $friends_id = "";
    foreach ($split_keywords as $key => $val) {
$sql1 = "SELECT user_name
        FROM ".USERS_TABLE."
        WHERE user_id = $val";
$friends_name = $site_db->query_firstrow($sql1);
$fname = $friends_name['user_name'];

      $friends_id .= (($keywords != "" ) ? ", " : "")."<a href=\"".$site_sess->url("/portfolio/".urlencode($fname))."\">$fname</a><br>";
    }
  }
  else {
    $friends_id = REPLACE_EMPTY;
  }


    $site_template->register_vars(array(
      "lang_friendslist_add", $lang['lang_friendslist_add'],
  "user_friends" => $friends_id
    ));
Title: Re: [MOD] Buddy List || Friend List
Post by: thunderstrike on August 15, 2007, 12:08:14 AM
Ah ! so this was you want.

Quote
$sql_friends = "SELECT *
        FROM ".USERS_TABLE."
        WHERE " . get_user_table_field("", "user_id") . " = ".$user_row[$user_table_fields['user_id']];
   $friends_row = $site_db->query_firstrow($sql_friends);
   
  if (!empty($friends_row['user_friend_ids'])) {
    $split_keywords = explode(" ", $friends_row['user_friend_ids']);
    $friends_id = "";
    foreach ($split_keywords as $key => $val) {
      $sql1 = "SELECT " . get_user_table_field("", "user_name") . "
        FROM ".USERS_TABLE."
        WHERE " . get_user_table_field("", "user_id") . " = " . $val;
   $friends_name = $site_db->query_firstrow($sql1);
   $fname = $friends_name[$user_table_fields['user_name']];

      $friends_id .= ((isset($keywords) && strlen(trim($keywords)) > 0) ? ", " : "")."<a href=\"".$site_sess->url("/portfolio/".urlencode($fname))."\">$fname</a><br>";
    }
  }
  else {
    $friends_id = REPLACE_EMPTY;
  }


       $site_template->register_vars(array(
      "lang_friendslist_add", $lang['lang_friendslist_add'],
     "user_friends" => (int)$friends_id
    ));   

;)
Title: Re: [MOD] Buddy List || Friend List
Post by: fast on October 28, 2007, 10:36:53 AM
the mod limit displaying 20 users on one site, there is no way to switch to the next site when you have more than 20 friends. how do i implement this?
Title: Re: [MOD] Buddy List || Friend List
Post by: thunderstrike on October 28, 2007, 12:40:10 PM
I no find 20 for limit in MOD ...
Title: Re: [MOD] Buddy List || Friend List
Post by: fast on October 28, 2007, 12:43:16 PM
do you have paging with this mod? i dont...  :cry:
Title: Re: [MOD] Buddy List || Friend List
Post by: thunderstrike on October 28, 2007, 01:31:41 PM
Sorry, I no have.
Title: Re: [MOD] Buddy List || Friend List
Post by: glitzer on October 28, 2007, 05:06:18 PM
Hi,

how i have to change the line

  $friends_id .= (($keywords != "" ) ? ", " : "")."<a href=\"".$site_sess->url("/portfolio/".urlencode($fname))."\">$fname</a><br>";

that it link to the members profile?

"Porfolio" is not a right link.

another question:
In the Download is a second install with "install_friendslist2.php".

do i need to also install this?

Please help,
thanks,
Glitzer
Title: Re: [MOD] Buddy List || Friend List
Post by: thunderstrike on October 28, 2007, 06:03:00 PM
Quote
$friends_id .= (($keywords != "" ) ? ", " : "")."<a href=\"".$site_sess->url("/portfolio/".urlencode($fname))."\">$fname</a><br>";

I check in friendslist.php file and I think is this:

Code: [Select]
$friends_id .= (($keywords != "" ) ? ", " : "")."<a href=\"".$site_sess->url($friendslist_url)."\">$fname</a><br>";

Quote
In the Download is a second install with "install_friendslist2.php".

Yes.
Title: Re: [MOD] Buddy List || Friend List
Post by: glitzer on October 28, 2007, 06:10:45 PM
Hi Thunderstrike,

thank you for trying help me, but $friends_id .= (($keywords != "" ) ? ", " : "")."<a href=\"".$site_sess->url($friendslist_url)."\">$fname</a><br>";
is not the correct one.

I don´t have "portfolio" on my site.

I need the correct Url to the Members profile.

has anybody a idea?
Title: Re: [MOD] Buddy List || Friend List
Post by: thunderstrike on October 28, 2007, 06:12:34 PM
Quote
I need the correct Url to the Members profile.

And which page this from for put this link ?
Title: Re: [MOD] Buddy List || Friend List
Post by: glitzer on October 28, 2007, 06:21:23 PM
Hi Thunderstrike..

on the Members profile.html

i attach you my problem..i hope this helps ..to understand me
Title: Re: [MOD] Buddy List || Friend List
Post by: thunderstrike on October 28, 2007, 07:50:48 PM
So ... this is from postcard page after click link in email message ?
Title: Re: [MOD] Buddy List || Friend List
Post by: glitzer on October 28, 2007, 08:03:28 PM
*lol*

no this is my member profile with my avatar  :D

member_profile.html
Title: Re: [MOD] Buddy List || Friend List
Post by: thunderstrike on October 28, 2007, 08:07:08 PM
Quote
$friends_id .= (($keywords != "" ) ? ", " : "")."<a href=\"".$site_sess->url($friendslist_url)."\">$fname</a><br>";

for:

Code: [Select]
$friends_id .= (($keywords != "" ) ? ", " : "")."<a href=\"".$site_sess->url(ROOT_PATH . "member.php?action=showprofile&" . URL_USER_ID . "=" . $user_id)."\">$fname</a><br>";
Title: Re: [MOD] Buddy List || Friend List
Post by: glitzer on October 28, 2007, 08:16:21 PM
Hi Thunderstrike.

thats a gooood way!! The link is now correct, but when i click on the link it don´t open the site of the friend..it still beeing on the same site.
You can try it on my site:

http://www.e-cardss.com/pics/member.php?action=showprofile&user_id=6056 (http://www.e-cardss.com/pics/member.php?action=showprofile&user_id=6056)

Please click a member..but there is no change to the friend.

This is the friendslist code in members:#
//-----------------------------------------------------
//--- BEGIN FRIENDSLIST MOD ---------------------------
//-----------------------------------------------------
//FRIENDS LIST MOD
   
 if (($user_info['user_level'] != GUEST) && ($user_info['user_id'] != $user_row['user_id'])) {
    $friendslist_url = $self_url;
    $friendslist_url .= (!empty($mode)) ? ((strpos($friendslist_url, '?') !== false) ? "&amp;" : "?")."mode=".$mode : "";
    $friendslist_url .= strpos($friendslist_url, '?') !== false ? "&amp;" : "?";
   
    if (check_friendslist($user_row['user_id'])) {
      $friendslist_url .= "action=removefromfriendslist&amp;id=".$user_row['user_id']."";
      $friendslist_button = "<a href=\"".$site_sess->url($friendslist_url)."\"><img src=\"".get_gallery_image("friendslist_yes.gif")."\" border=\"0\" alt=\"\" /></a>";
    }
    else {
      $friendslist_url .= "action=addtofriendslist&amp;id=".$user_row['user_id']."";
      $friendslist_button = "<a href=\"".$site_sess->url($friendslist_url)."\"><img src=\"".get_gallery_image("friendslist_no.gif")."\" border=\"0\" alt=\"\" /></a>";
    }
  }
  else {
    $friendslist_button = "<img src=\"".get_gallery_image("friendslist_off.gif")."\" border=\"0\" alt=\"\" />";
  }
$site_template->register_vars("lang_friendslist_add", $lang['lang_friendslist_add']);
        $sql_friends = "SELECT *
        FROM ".USERS_TABLE."
        WHERE user_id = ".$user_row['user_id']."";
   $friends_row = $site_db->query_firstrow($sql_friends);
   
  if (!empty($friends_row['user_friend_ids'])) {
    $split_keywords = explode(" ", $friends_row['user_friend_ids']);
    $friends_id = "";
    foreach ($split_keywords as $key => $val) {
      $sql1 = "SELECT user_name
        FROM ".USERS_TABLE."
        WHERE user_id = $val";
   $friends_name = $site_db->query_firstrow($sql1);
   $fname = $friends_name['user_name'];

$friends_id .= (($keywords != "" ) ? ", " : "")."<a href=\"".$site_sess->url(ROOT_PATH . "member.php?action=showprofile&" . URL_USER_ID . "=" . $user_id)."\">$fname</a><br>";
    }
  }
  else {
    $friends_id = REPLACE_EMPTY;
  }


       $site_template->register_vars(array(
      "lang_friendslist_add", $lang['lang_friendslist_add'],
     "user_friends" => $friends_id
    ));   
 


//--- END FRIENDSLIST MOD --

Title: Re: [MOD] Buddy List || Friend List
Post by: thunderstrike on October 28, 2007, 08:29:14 PM
Quote
$friends_id .= (($keywords != "" ) ? ", " : "")."<a href=\"".$site_sess->url(ROOT_PATH . "member.php?action=showprofile&" . URL_USER_ID . "=" . $user_id)."\">$fname</a><br>";

for:

Code: [Select]
$friends_id .= (($keywords != "" ) ? ", " : "")."<a href=\"".$site_sess->url(ROOT_PATH . "member.php?action=showprofile&" . URL_USER_ID . "=" . $friends_row['user_id'])."\">$fname</a><br>";
Title: Re: [MOD] Buddy List || Friend List
Post by: glitzer on October 28, 2007, 08:34:24 PM

the same..sorry :(
Title: Re: [MOD] Buddy List || Friend List
Post by: thunderstrike on October 28, 2007, 08:45:55 PM
Sorry ... I no get what you want ... is say $friends_row for see friends profile ... if no work ... is no my MOD so I no support ...
Title: Re: [MOD] Buddy List || Friend List
Post by: glitzer on October 28, 2007, 08:49:46 PM
ok, thanks for trying help me!
greets
glitzer
Title: Re: [MOD] Buddy List || Friend List
Post by: thunderstrike on October 28, 2007, 09:53:50 PM
Ok, I think I get ...

find:

Quote
$sql1 = "SELECT user_name
        FROM ".USERS_TABLE."
        WHERE user_id = $val";
   $friends_name = $site_db->query_firstrow($sql1);
   $fname = $friends_name['user_name'];

$friends_id .= (($keywords != "" ) ? ", " : "")."<a href=\"".$site_sess->url(ROOT_PATH . "member.php?action=showprofile&" . URL_USER_ID . "=" . $user_id)."\">$fname</a><br>";

replace:

Code: [Select]
$sql1 = "SELECT " . get_user_table_field("", "user_id") . get_user_table_field(", ", "user_name") . "
        FROM ".USERS_TABLE."
        WHERE " . get_user_table_field("", "user_id") . " = $val";
   $friends_name = $site_db->query_firstrow($sql1);
   $fid = $friends_name[$user_table_fields['user_id']];
   $fname = $friends_name[$user_table_fields['user_name']];

$friends_id .= (($keywords != "" ) ? ", " : "")."<a href=\"".$site_sess->url(ROOT_PATH . "member.php?action=showprofile&" . URL_USER_ID . "=" . $fid)."\">" . format_text(trim($fname), 2) . "</a><br>";
Title: Re: [MOD] Buddy List || Friend List
Post by: glitzer on October 28, 2007, 10:01:52 PM
yeeeeeah!
Thats it!

Thunderstrike du bist ein held! Hab erst jetzt rausgefunden das du deutsch sprichst  :mrgreen:

THANK YOU!!!  :D
Title: Re: [MOD] Buddy List || Friend List
Post by: Lucifix on October 28, 2007, 10:44:50 PM
Did anyone try insted of PM notify, e-mail notify?
Title: Re: [MOD] Buddy List || Friend List
Post by: thunderstrike on October 28, 2007, 11:09:21 PM
Quote
e-mail notify?

Which email notify ?
Title: Re: [MOD] Buddy List || Friend List
Post by: Lucifix on October 29, 2007, 05:42:28 PM
You will recive e-mail notiry if someone add you to buddy list.
Title: Re: [MOD] Buddy List || Friend List
Post by: thunderstrike on October 29, 2007, 05:43:04 PM
Oh ok no - I no try before ...
Title: Re: [MOD] Buddy List || Friend List
Post by: www.katzen.ag on November 16, 2007, 11:30:34 PM
Hello gentleman,

does this Mod works with 1.7.1 ??

Thanks..
Title: Re: [MOD] Buddy List || Friend List
Post by: glitzer on November 16, 2007, 11:48:26 PM
Hi
works with 1.7.1!
 i use this version too, and it works great.

greets,
glitzer
Title: Re: [MOD] Buddy List || Friend List
Post by: www.katzen.ag on November 17, 2007, 12:52:31 AM
Ah, great!!!

Thanks.
Title: Re: [MOD] Buddy List || Friend List
Post by: www.katzen.ag on November 20, 2007, 03:42:44 PM
Hey ladies,

I have installed the mod and it works with 1.7.1 too! :wink:

Ahm but the user pic in the buddy list does't work. I installed the "avatar" mod log time ago and not the "member personal photo".
Does anybode rewirte the addon acording the avatar mod? :idea:

Bye! 8O

Title: Re: [MOD] Buddy List || Friend List
Post by: 131 on November 25, 2007, 10:56:06 PM
Does anyone have missing file friendslist.html ?
In rar is missing or is something wrong with description?

regards
Title: Re: [MOD] Buddy List || Friend List
Post by: ccsakuweb on December 01, 2007, 09:33:22 AM
Does anyone have missing file friendslist.html ?
In rar is missing or is something wrong with description?

regards
At the end of the description I said the next
Code: [Select]

#
#-----[ CREATE ]--------------------------------------------
#
templates/tus_plantillas/friendslist.html

#
#-----[ PASTE ]--------------------------------------------
#//NOte: In your design content. In example error.html paste the next code and rename to friendslist.html

<p>&nbsp;<b><img src="{template_url}/images/spacer.gif" width="4" height="4" alt="" />{clickstream}</b></p>
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td><span class="title">{lang_friendslist_title}</span></td>
                      <td align="right">
                        <script language="JavaScript">
        function clearfriendslist() {
                  if (confirm('{lang_delete_friendslist_confirm}')) {
                location.href = "{url_delete_friendslist}";
                  }
                    }
        </script>
                        <a href="javascript:clearfriendslist()"><b>{lang_delete_friendslist}</b></a>
      </td>
                    </tr>
                 
  <br />
                  <hr size="1" /><div align="right"><form method="post" action="{filter_url}">
Buscar Usuario: <input name="filter" value="{filter}" class="searchinput">&nbsp;<input type="submit" name="submit" value="{lang_go}" class="button" /><br>
<span class="smalltext">Puedes usar * como comodín cuando no estés seguro.</span><br>
</form></div>
  {paging_stats}<br>
                  {if friendslist}
<table width="450" border="0" cellspacing="0" cellpadding="1">
                    <tr>
                      <td class="head1">
                        <table width="100%" border="0" cellspacing="0" cellpadding="3">

                          <tr>
                            <td class="row2" valign="top">{friendslist}</td>
                          </tr>
                        </table>
                      </td>
                    </tr>
                  </table>
  {endif friendslist}
                  <br />
                  <br />
  {paging}
  <br /><div align="center"> Mod Friends List created by <a href="http://www.myart.es" target="_blank">CCSakuweb</a></div><br>

Title: Re: [MOD] Buddy List || Friend List
Post by: ccsakuweb on December 01, 2007, 09:58:06 AM
Hey ladies,

I have installed the mod and it works with 1.7.1 too! :wink:

Ahm but the user pic in the buddy list does't work. I installed the "avatar" mod log time ago and not the "member personal photo".
Does anybode rewirte the addon acording the avatar mod? :idea:

Bye! 8O


I think that you only have to replace friendlist.php the path from the avatar and a little more. Search
Code: [Select]
if(($config['userpic'])&&($user_row['userpic'])){
    $user_pic =   "<a href=\"".$site_sess->url($user_profile_link)."\"><img src=\"".$site_sess->url(ROOT_PATH."data/userpic/".$user_row['userpic'])."\"></a>";
}

Replace to:

Code: [Select]
if(($config['avatar_use'])&&($user_row['user_avatar'])){
    $user_pic =   "<a href=\"".$site_sess->url($user_profile_link)."\"><img src=\"".$site_sess->url(ROOT_PATH."".TEMPLATE_PATH."/avatars/".$user_row['user_avatar'])."\"></a>";
}




Title: Re: [MOD] Buddy List || Friend List
Post by: Bob on May 10, 2008, 01:20:35 AM

Hi there, i have add in friendlist.php:

Code: [Select]
$userpic = "<a href=\"".$site_sess->url($user_profile_link)."\"><img src=\"".ROOT_PATH."data/userpic/".$user_row['userpic']."\" width=\"60\" height=\"60\" border=\"0\" /></a>";
and it works but...

in member.php i have:

"userpic_img" => ($config['userpic'] && $user_row['userpic']) ? ROOT_PATH."data/userpic/".$user_row['userpic'] : ROOT_PATH."data/userpic/noimage.png",

and

"userpic_img" => ($user_info['userpic']) ? ROOT_PATH."data/userpic/".$user_info['userpic'] : ROOT_PATH."data/userpic/noimage.png",

but i dont no what to do to show the "noimage.png" in the friendlist.php ?

Need Help please!
Title: Re: [MOD] Buddy List || Friend List
Post by: ccsakuweb on May 10, 2008, 10:59:32 AM

Hi there, i have add in friendlist.php:

Code: [Select]
$userpic = "<a href=\"".$site_sess->url($user_profile_link)."\"><img src=\"".ROOT_PATH."data/userpic/".$user_row['userpic']."\" width=\"60\" height=\"60\" border=\"0\" /></a>";
and it works but...

in member.php i have:

"userpic_img" => ($config['userpic'] && $user_row['userpic']) ? ROOT_PATH."data/userpic/".$user_row['userpic'] : ROOT_PATH."data/userpic/noimage.png",

and

"userpic_img" => ($user_info['userpic']) ? ROOT_PATH."data/userpic/".$user_info['userpic'] : ROOT_PATH."data/userpic/noimage.png",

but i dont no what to do to show the "noimage.png" in the friendlist.php ?

Need Help please!

To show noimage.png in the friendlist when the user dont have avatar repalace
Code: [Select]
$userpic = "<a href=\"".$site_sess->url($user_profile_link)."\"><img src=\"".ROOT_PATH."data/userpic/".$user_row['userpic']."\" width=\"60\" height=\"60\" border=\"0\" /></a>";to
Code: [Select]
if($user_row['userpic'])
$userpic = "<a href=\"".$site_sess->url($user_profile_link)."\"><img src=\"".ROOT_PATH."data/userpic/".$user_row['userpic']."\" width=\"60\" height=\"60\" border=\"0\" /></a>";
else
$userpic = "<a href=\"".$site_sess->url($user_profile_link)."\"><img src=\"".ROOT_PATH."data/userpic/noimage.png\" width=\"60\" height=\"60\" border=\"0\" /></a>";

i didnt try it so please tell me if it dowesn't work
Title: Re: [MOD] Buddy List || Friend List
Post by: Bob on May 11, 2008, 04:21:05 AM
i didnt try it so please tell me if it dowesn't work


it work Thanks :) :) :)
Title: Re: [MOD] Buddy List || Friend List
Post by: Fragezeichen on November 28, 2009, 01:44:32 PM
nice Mod,works perfect! :D

But how to add the Buddy-Button in the Details.html next Lightbox?
{friendslist_button} dont works there :(
Title: Re: [MOD] Buddy List || Friend List
Post by: ccsakuweb on November 28, 2009, 01:50:54 PM
nice Mod,works perfect! :D

But how to add the Buddy-Button in the Details.html next Lightbox?
{friendslist_button} dont works there :(


I don't understand, friendlist button is to add an other user into your friend list. In details near lightbox who do you want to add in your fiendlist? do you want to add in your friend list the author of the image? I didn't think about that, I think that It isn't easy for the user because the details page is for an image.  But if you need it, It could be implemented. But just now I'm a little busy.
Title: Re: [MOD] Buddy List || Friend List
Post by: Fragezeichen on November 28, 2009, 03:43:10 PM
thanks.
But the Idea is to add the Image uploder directly to Buddylist(under uploaded Picture),not after visit his Profilpage.
It means the same function as the Lightbox button or download button under the Image..
No Idea?
Title: Re: [MOD] Buddy List || Friend List
Post by: ccsakuweb on November 28, 2009, 09:40:46 PM
I see, you are rigth. Usually I add my friends in comments but like you tell for add to the author I have to go his profile.

Well I will try to implement your request. But I can't this weekend I'm really busy this weeks. (near hollidays you know hehe) I wish someone help you soon If they didn't help you I will try in a few weeks. Sorry. Thank you because install my mod.
Title: Re: [MOD] Buddy List || Friend List
Post by: Fragezeichen on November 28, 2009, 10:02:31 PM
Thanks :D
Maybe can found a solution before next year,hehehe..
Title: Re: [MOD] Buddy List || Friend List
Post by: zakaria666 on August 08, 2010, 02:25:40 PM
i NEED MAJOR ASSISTENCE PLEASE ANYONE. V@no if u see this, i need ur help brother.

_____________________________________________________________________

1)
First of all i have made 3 dummy account. what i did is made a comment for each person as u can add someone if they made a comment, so thats what i did, so user 1 adds user 2, and user 1 checks his or her friends list and they see who they added, but whe i log out as user 1 and i log in as user 2 and then user 2 checks his or her friends list, no one is added ?? no user is visible but only 1 minute ago i added user 2 to user 1, so if user 1 can see who they added, why cant user 2 see that user 1 is now there friend on friend list??????


The above are the major problem im having, any suggestions???

PLEASEEE  i beg u all
Title: Re: [MOD] Buddy List || Friend List
Post by: Sunny C. on August 08, 2010, 04:31:19 PM
Use this modification: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove (http://www.4homepages.de/forum/index.php?topic=19755.0)
Title: Re: [MOD] Buddy List || Friend List
Post by: zakaria666 on August 08, 2010, 09:15:10 PM
hello thank u for the reply samuel ,

but there is error, i installed nicky;s memberlist MOD and then it means i must use 2nd version of the install of database creation thats what i did,

but i get error

Error:
CREATE TABLE `4images_users_friendship` ( `friendship_id` int(11) NOT NULL auto_increment, `user_id_primary` int(11) NOT NULL default '0', `user_id_secondary` int(11) NOT NULL default '0', `friendship_status` int(1) NOT NULL default '0', `friendship_request_date` timestamp NOT NULL default CURRENT_TIMESTAMP, `friendship_accept_date` timestamp NOT NULL default '0000-00-00 00:00:00', `friendship_request_message` text NOT NULL, `friendship_response_message` text NULL, PRIMARY KEY (`users_friendship_id`) ) TYPE=MyISAM

any reason for this??

i used install_buddy2.php

helpo me
Title: Re: [MOD] Buddy List || Friend List
Post by: V@no on August 08, 2010, 09:35:28 PM
Show exact, full error message.
Title: Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
Post by: zakaria666 on August 08, 2010, 11:35:22 PM
Hello vano, god bless u for ur reply

ok i installed nickys memberlist MOD so i dont know if this has anything to do with it.

ok I am using install_buddy2.php not install_buddy.php as it tells me if i have installed nicks mod then i must use the one that has number 2 in it.

ok step 1

(http://i36.tinypic.com/2uj6ty1.jpg)

and when i click start modify database ....
(http://i37.tinypic.com/24y8vpd.jpg)

i dont know why it is doing this, i always get something similar in terms of installation when u tell us to install something of ur MOD vano, and i get succeeded all the time, but with this MOD im getting error, its strange.


________******

Important, VANO, i just realized that my thread was meant for this topic ( http://www.4homepages.de/forum/index.php?topic=19755.0 (http://www.4homepages.de/forum/index.php?topic=19755.0)) not the topic im currently on. What should i do, delete this thread here and post it on the link ive posted???
Title: Re: [MOD] Buddy List || Friend List
Post by: zakaria666 on August 08, 2010, 11:36:22 PM
IMPORTANt,

VANO, sorry my fault its not to do with this topic, ive deleted it, i got it confused, as this topic also deals with friends requests,  here is the correect thread, i have put the error message there also with images

http://www.4homepages.de/forum/index.php?topic=19755.new#new (http://www.4homepages.de/forum/index.php?topic=19755.new#new)

So sorry
Title: Re: [MOD] Buddy List || Friend List
Post by: V@no on August 09, 2010, 12:00:51 AM
in the installer replace   $log[$val] = "<font color=\"red\">Error: </font><b>".$reg[1]."</b>";


with:
  $log[$val] = "<font color=\"red\">Error: </font><b>".$content."</b>";


It should show complete error message.
Title: Re: [MOD] Buddy List || Friend List
Post by: zakaria666 on August 09, 2010, 03:05:11 PM
@VANO,

Vano it does not work brother. What should i do. ??
Title: Re: [MOD] Buddy List || Friend List
Post by: V@no on August 09, 2010, 03:18:32 PM
Please stop bumping topics like this 5 times a day (exaggerated :))
The provided changes should reveal more details about the error, not just "an error occur"
And besides, that error comes from running installer from a different mod.
Title: Re: [MOD] Buddy List || Friend List
Post by: zakaria666 on August 09, 2010, 03:30:34 PM
lol Vano hahaha if i dont bump the topics up, i will never get an answer, lol

also sometimes i post a comment, look at it and then i think to myself, why hasnt vano master of php answered lol, so then i delete the comment and post another simple thread, i dont do it intentionally, haha. For example on the other topic on flags and ip,s which u kindfully fixed lol i had another query on that, so what i would do is look at what i postd and think about it for a few seconds is it appropriate to how Vano would read it :( .. im sorry bro and also what do u mean that this error comes from running a different MOD, ??

here is the below image of what i get when u told to replace one line of code for another. If there was more to the error message i will of course tell u bro. Any ideas

(http://i38.tinypic.com/j809zo.jpg)
Title: Re: [MOD] Buddy List || Friend List
Post by: Lucifix on August 09, 2010, 03:42:30 PM
Okey zakaria666 you may now that these guys here aren't paid to help you or me. They are doing that for free and that's why you should show more respect for them.

Your error that you're showing doesn't tell absolutely nothing, just an error. It's like going to the doctor and tell him: doc i'm feeling something wrong, could you write me some kind of prescription?

Do you have access to phpmyadmin? If you do, copy that sql sentence (create table 'images_users_friendship' etc) to phpmyadmin / sql tab on the top and see what kind of error you will get. Copy that error to board here and maybe we'll get some new tip whats wrong.

If you don't have access to phpmyadmin maybe you should give us access to your website and someone might check. Otherwise you are just giving us some VERY unuseful tips.


But to make your life easier I've found error in that sql. At the end it shows user_friendship_id as primary key - that row doesn't exist in SQL. The right SQL sentence should be:
Code: [Select]
CREATE TABLE `4images_users_friendship` ( `friendship_id` int(11) NOT NULL auto_increment, `user_id_primary` int(11) NOT NULL default '0', `user_id_secondary` int(11) NOT NULL default '0', `friendship_status` int(1) NOT NULL default '0', `friendship_request_date` timestamp NOT NULL default CURRENT_TIMESTAMP, `friendship_accept_date` timestamp NOT NULL default '0000-00-00 00:00:00', `friendship_request_message` text NOT NULL, `friendship_response_message` text NULL, PRIMARY KEY (`friendship_id`) ) TYPE=MyISAM
Title: Re: [MOD] Buddy List || Friend List
Post by: zakaria666 on August 09, 2010, 03:56:33 PM
@lucifix, You have just seen me write a few threads most likely on this topic. How dare u tell me to show respect when thats all i ever do? Dont u think i know that Vano and these guys do this for free, do u think im stupid bro?? u have no idea, sometimes i am by myself and i think to myself that 1 day if i everrr become a millionaire, the first thing i will do is invest money into 4images. Everytime i have needed help i have wrote a topic and Vano and other members have been kind enough to help me. And im shocked u r telling me to show some respect when every word i use and every action i make is with the utmost respect, i never swear never angry, never tell VANO f*k u, why u not helping. NO wayyyyy,

everytime i call VANO sir, i say thank u VANO everytime he helps me, i even click on the button on this topic "THANK YOU", everytime, every single time i not once show disrespect to VANO, u really upset me man, because it hurts me u say i dont show respect when i have 1000000000000000000000000000000000x respect for vano and for mawezani and for everyone here who show us and me help. If u think i showed disrespect then i really apologize but im very upset now, very angry u will say i dont show vano respect when u cannot believe how much i look up to vano and how much i want to be clever like vano.

If vano u see this i am sorry if u think i not show u respect because u dont understand how much respect i have and lucifix, u really hurt me man, because i have so much respect for people who have knowlegde, every single day and night i promse u i think about ways to help 4images, im sorry lucifix for not being more clear and i apologize to u if u think i was being disrespectful, i hope u accepting my apology and vano also accept my apology, also i like to thank u for helping me and again i am sorry...

i have done what u have said lucifix and below is the error i am now getting, the funny thing is, the table is now created ,

DB Error: Bad SQL Query: SELECT COUNT(*) AS total_requests FROM USERS_FRIENDSHIP_TABLE WHERE friendship_status = 0 AND user_id_secondary = 1
Table 'globa122_kurd.USERS_FRIENDSHIP_TABLE' doesn't exist
Title: Re: [MOD] Buddy List || Friend List
Post by: V@no on August 09, 2010, 04:38:42 PM
Will read all that later today, but I'll repeat myself, that error has nothing to do with this mod. This mod doesn't create any new tables in the database. So, if you'd install the OTHER mod properly this error should not be happening.
Title: Re: [MOD] Buddy List || Friend List
Post by: zakaria666 on August 09, 2010, 04:51:57 PM
hello Vano and thank u for the fast reply,

Im sorry but i dont quite understand sir what u r saying. Lucifix found the error, the error was that the creator of the MOD was calling his primary key name user_friendship_table when in fact it was user_friendship. But i do ask for your forgiveness but are u talking about the MOD we are disuccsing the topic on in this thread ?? or are u talking about this MOD http://www.4homepages.de/forum/index.php?topic=17491.135 (http://www.4homepages.de/forum/index.php?topic=17491.135) Because the link i have just posted is the MOD i have problems with, i posted a thread saying im sorry and that i made a mistake but u replied to my question on this topic so i presumed that u knew that and i carried on asking for help in this thread. The real MOD i have problem with is not this topic but is this link http://www.4homepages.de/forum/index.php?topic=17491.135 (http://www.4homepages.de/forum/index.php?topic=17491.135)

Thanks to lucifix, I changed it and succesfully created the tables, i just checked my phpadmin and i have tables there. Below is the image of the created table.

(http://i38.tinypic.com/6f1q9u.jpg)

I then tracked down the problem and the problem is given to me when i type my gallery address...

DB Error: Bad SQL Query: SELECT COUNT(*) AS total_requests FROM USERS_FRIENDSHIP_TABLE WHERE friendship_status = 0 AND user_id_secondary = 1
Table 'globa122_kurd.USERS_FRIENDSHIP_TABLE' doesn't exist

and this small code highlited red is from the source below... it is line line 112 This code below goes into includes/function.php... Ive tried to debug the problem by changing the names but have not succeeded, i was hoping if it was possible that u may no what the issue is and i apologize if u thought before i was disrespectufl, im sorry sir.

Code: [Select]
//---[MOD] BUDDY  V.1.0.0 beta ------------
//----2007 by eMagix for 4images gallery --
//----------- START CODE  -----------------

function add_to_buddy($id,$msg) {
  global $user_info, $site_db;
  $id = intval($id);
  if (!$id) {
    return false;
  }
  

  $user_info['buddy_id'] = $id;
  $user_info['buddy_request_msg'] = $msg;
  
  $sql= "INSERT INTO ".USERS_FRIENDSHIP_TABLE." (
`user_id_primary` ,
`user_id_secondary` ,
`friendship_request_date` ,
`friendship_request_message`
)
VALUES (
".$user_info['user_id'].",
".$user_info['buddy_id'].",

CURRENT_TIMESTAMP,
'".$user_info['buddy_request_msg']."'
);";
  

  return ($site_db->query($sql)) ? 1 : 0;
}

function accept_buddy_request($id) {
  global $user_info, $site_db;
  if (!$id) {
    return false;
  }
  
  $user_info['buddy_id'] = $id; //Accept 1 , Reject -1
  $sql = "UPDATE ".USERS_FRIENDSHIP_TABLE."
          SET friendship_status = 1, friendship_accept_date = CURRENT_TIMESTAMP
          WHERE friendship_id = ".$user_info['buddy_id'];
  return ($site_db->query($sql)) ? 1 : 0;
}

function reject_buddy_request($id) {
  global $user_info, $site_db;
  if (!$id) {
    return false;
  }
  $msg = "Sorry, I'm not ready to be your friend yet";
  $user_info['buddy_reject_msg'] = $msg;
  $user_info['buddy_id'] = $id; //Accept 1 , Reject -1
  $sql = "UPDATE ".USERS_FRIENDSHIP_TABLE."
          SET friendship_status = -1,
            friendship_reject_message = '".$user_info['buddy_reject_msg']."'
          WHERE friendship_id = ".$user_info['buddy_id'];
  return ($site_db->query($sql)) ? 1 : 0;
}

function remove_from_buddy($id) {
  global $user_info, $site_db;
  if (!$id) {
    return false;
  }
  
  $user_info['buddy_id'] = $id;
  $sql = "DELETE FROM ".USERS_FRIENDSHIP_TABLE."
          WHERE friendship_id = ".$user_info['buddy_id'];
          
  return ($site_db->query($sql)) ? 1 : 0;
}

function clear_buddy() {
  global $user_info, $site_db;
    $sql = "DELETE FROM ".USERS_FRIENDSHIP_TABLE."
            WHERE user_id_primary = ".$user_info['user_id']."
            OR user_id_secondary =".$user_info['user_id'];

  return ($site_db->query($sql)) ? 1 : 0;
}

function check_buddy($id) {
  global $user_info, $site_db;
  $user_info['buddy_id'] = $id;
  $return_value = "";
  
  $sql = "SELECT friendship_status FROM ".USERS_FRIENDSHIP_TABLE."
          WHERE
            
             (user_id_primary = ".$user_info['user_id']." AND user_id_secondary =".$user_info['buddy_id'].")
             OR
             (user_id_primary = ".$user_info['buddy_id']." AND user_id_secondary =".$user_info['user_id'].")";
            
$result = $site_db->query_firstrow($sql);

if (!$result)  {
$return_value = -1;
}
else {
$return_value = $result['friendship_status'];
}
            
  return $return_value;
}

function check_buddy_request() {
  global $user_info, $site_db;

  
  [size=12pt][b]$sql = "SELECT COUNT(*) AS total_requests FROM ".USERS_FRIENDSHIP_TABLE."
            WHERE friendship_status = 0
             AND user_id_secondary = ".$user_info['user_id'];[/b][/size]

  $result = $site_db->query_firstrow($sql);
  $user_total_friends = $result['total_requests'];
  return $user_total_friends;
}