4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: eMagix on December 08, 2007, 06:07:36 PM

Title: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
Post by: eMagix on December 08, 2007, 06:07:36 PM
COMMENTS BY AUTHOR
   - This is my first MOD and I hope you guys will enjoy it. This MOD is basically a different version of (ccsakuweb - friendlist mod), however, the concept of adding buddy (friend) is different. This MOD took me 3 hrs including writing this tutorial. This is my first PHP project and the code maybe a little un-organized. My main language is VB.NET.

DESCRIPTION
  - Send Buddy Request (next version will have send buddy request with message)
  - Accept/Reject Buddy Request  (next version will have reject buddy request with message)
  - Remove Buddy/Delete Buddy List
  - Display Buddies on your profile Page
  - This is different from friendlist MOD because it is 2 ways buddies instead of 1 way. IE. If I requested to add you as a friend and you have accepted it, we will be each other buddy mean my name will be displayed on yours buddylist and yours will be displayed on mine. For ccsakuweb MOD you will be just adding the person without they even noticed it and they will not have you as friend even if you added them.


TEST PROOF: http://www.msislander.com/gallery    user:test  pass: test <-- this mod has been tested on a clean version of 4image gallery just to make sure it doesn't screw anyone up.

DEMO: http://www.henesys.com/gallery   user:test  pass: test


DOWNLOAD:  Click Here (http://www.4homepages.de/forum/index.php?action=dlattach;topic=19755.0;attach=2664)


BUG FIXED:

-------------------------------------------------------------------------------------------------------------------------------------------------
v.1.1 Fixed:
- Clear Buddy List (Empty Buddy List

If you have installed version 1.0 then do the steps below if not then ignore it
-----[OPEN]-------

Code: [Select]
buddy.php
-----[FIND]--------

Code: [Select]
action=clearbuddy
----[REPLACE]---

Code: [Select]
action=emptybuddy

-----[OPEN]-------

Code: [Select]
includes/function.php
-----[FIND]--------

Code: [Select]
    $sql = "DELETE FROM ".USERS_FRIENDSHIP_TABLE."
            WHERE user_id_primary = ".$user_info['user_id'].",

----[REPLACE]---

Code: [Select]
    $sql = "DELETE FROM ".USERS_FRIENDSHIP_TABLE."
            WHERE user_id_primary = ".$user_info['user_id']."

-------------------------------------------------------------------------------------------------------------------------------------------------









CAUTION: EVERYTHING BELOW ARE FOR INTEGRATION WITH OTHER MOD NOT THE MOD ITSELF. PLEASE DOWNLOAD THE ATTACHED RAR FILE FOR INSTRUCTION AND FILES FOR THIS MOD


INTEGRATION WITH OTHER MODS:

MOD: Memberlist by Nicky - http://www.4homepages.de/forum/index.php?topic=1954.0

-----[OPEN]-------

memberlist.php


-----[FIND]--------
Code: [Select]
$userlist .="<tr>\n<td class=\"head2\" align=\"center\">".$lang['user_name']."</td>\n<td class=\"head2\" align=\"center\">".$lang['join_date']."</td>\n<td class=\"head2\" align=\"center\">".$lang['email']."</td>\n<td class=\"head2\" align=\"center\">".$lang['homepage']."</td>\n<td class=\"head2\" align=\"center\">".$lang['lang_total_user_comments']."</td>\n<td class=\"head2\" align=\"center\">".$lang['lang_total_user_images']."</td>\n</tr>\n";

----[REPLACE WITH ]----
Code: [Select]
//$userlist .="<tr>\n<td class=\"head2\" align=\"center\">".$lang['user_name']."</td>\n<td class=\"head2\" align=\"center\">".$lang['join_date']."</td>\n<td class=\"head2\" align=\"center\">".$lang['email']."</td>\n<td class=\"head2\" align=\"center\">".$lang['homepage']."</td>\n<td class=\"head2\" align=\"center\">".$lang['lang_total_user_comments']."</td>\n<td class=\"head2\" align=\"center\">".$lang['lang_total_user_images']."</td>\n</tr>\n";

$userlist .="<tr>\n<td class=\"head2\" align=\"center\">".$lang['user_name']."</td>\n<td class=\"head2\" align=\"center\">".$lang['join_date']."</td>\n<td class=\"head2\" align=\"center\">".$lang['email']."</td>\n<td class=\"head2\" align=\"center\">".$lang['homepage']."</td>\n<td class=\"head2\" align=\"center\">".$lang['lang_total_user_comments']."</td>\n<td class=\"head2\" align=\"center\">".$lang['lang_total_user_images']."</td>\n<td class=\"head2\" align=\"center\">".$lang['lang_buddy_friend']."</td>\n</tr>\n";

-----[FIND]--------
Code: [Select]
    if ($count == 0) {
      $row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
      $userlist .= "<tr class=\"imagerow".$row_bg_number."\">\n";
    }
-----[AFTER, ADD]--------
Code: [Select]
//---[MOD] BUDDY  V.1.0.0 beta ------------
//----2007 by eMagix for 4images gallery --
//----------- START CODE  -----------------

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

   
    // IF USER ALREADY A BUDDY SHOW ALREADY BUDDY TEXT
    $buddy_status = check_buddy($user_row['user_id']);
    if ($buddy_status == 1) {
      $buddy_button = $lang['user_buddy_yes'];
    }
    // IF USER REQUEST PENDING SHOW PENDING TEXT
    elseif ($buddy_status == 0) {
      $buddy_button = $lang['user_buddy_pending'];
    }
// IF NOT YET BUDDY SHOW BUTTON
    elseif ($buddy_status == -1) {
      $buddy_url .= "action=addbuddy&amp;id=".$user_row['user_id']."";
      $buddy_button = "<a href=\"".$site_sess->url($buddy_url)."\"><img src=\"".get_gallery_image("buddy_no.gif")."\" border=\"0\" alt=\"\" /></a>";
    }


  }
  else {
  // BUDDY BUTTON DISABLED
    $buddy_button = "<img src=\"".get_gallery_image("buddy_off.gif")."\" border=\"0\" alt=\"\" />";
  }
//----------- END CODE  -----------------

-----[FIND]-------- Thanks loda for point it out - I totally forgot about it :-)
Code: [Select]
$total_user_images = "";

-----[AFTER, ADD]--------
Code: [Select]
$buddy_button = "";

-----[FIND]-------- Thanks loda for point it out - I totally forgot about it :-)
Code: [Select]
$userlist .= "<td valign=\"top\" align=\"center\">".$total_user_images_link."</td>\n";
-----[AFTER, ADD]--------
Code: [Select]
$userlist .= "<td valign=\"top\" align=\"left\"> ".$buddy_button." </td>\n";


- That is it now you can browse for buddies and add them at the same time :-)
Title: Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
Post by: Loda on December 10, 2007, 11:55:13 AM
very nice, too!
is it possible to integrate this codes:
http://www.4homepages.de/forum/index.php?topic=17491.msg96478#msg96478
in your buddylistmod? because it is a helpful plugin for me.

edit:
you forget something in the memberlist.
find this:
Code: [Select]
$total_user_images = "";after, add
Code: [Select]
$buddy_button = "";then find this:
Code: [Select]
$userlist .= "<td valign=\"top\" align=\"center\">".$total_user_images_link."</td>\n";after, add:
Code: [Select]
$userlist .= "<td valign=\"top\" align=\"left\"> ".$buddy_button." </td>\n";
Title: Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
Post by: eMagix on December 10, 2007, 03:26:34 PM
Thanks loda for pointing it out. I have added it to the memberlist integration. :-)

I will see what I can do :-).
Title: Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
Post by: matab on December 23, 2007, 07:21:55 PM
nice MOD ...

But I have prob.

when I uz ( install_buddy2.php ) >> I have installed Memberlist MOD from Nicky

this what I get :

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
Title: Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
Post by: thunderstrike on December 23, 2007, 07:33:13 PM
Hum ... if phpmyadmin - try this:

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;

2 - See if 4images_users_friendship is correct table name and 4images_ for right table prefix. ;)
Title: Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
Post by: matab on December 23, 2007, 07:57:06 PM
yup its ( phpmyadmin )

 I use SQL to run this order but  :( this what i get from phpmyadmin :

Quote
MySQL said: 

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"CREATE TABLE 4images_users_friendship (
            friendship_id int(11) NOT ' at line 1

Title: Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
Post by: thunderstrike on December 23, 2007, 08:32:56 PM
This is right. I edit post. Try again. ;)
Title: Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
Post by: matab on December 23, 2007, 08:47:35 PM
sorry but same error  :| :

Quote
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 11
Title: Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
Post by: thunderstrike on December 23, 2007, 08:50:57 PM
Try now. ;)
Title: Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
Post by: matab on December 23, 2007, 09:08:43 PM
Try now. ;)

Error  :?  :

Quote
#1072 - Key column 'users_friendship_id' doesn't exist in table
Title: Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
Post by: thunderstrike on December 23, 2007, 09:26:37 PM
Well, is author problem so now - is fix from my post. :?
Title: Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
Post by: matab on December 23, 2007, 09:41:35 PM
ok thx thunderstrike for help
 
and for me

 I give up I tried many time but the same error
Title: Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
Post by: thunderstrike on December 23, 2007, 10:08:51 PM
No possible for get same error after my last edit. users_friendship_id is no exist after this.
Title: Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
Post by: matab on December 23, 2007, 10:21:57 PM
No possible for get same error after my last edit. users_friendship_id is no exist after this.

:oops: sorry thunderstrike I was think that post is the same one before

the prob. now is solved  :D



thx alot thunderstrike  :oops:
Title: Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
Post by: thunderstrike on December 23, 2007, 10:23:32 PM
Ahh ! very good. Thank for posting.
Title: Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
Post by: OtusDesign on May 26, 2008, 02:01:18 AM
Hi, thanks for great mod, I have a question, is it possible to inform user by email for when somebody add him/her to buddy list?
Title: Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
Post by: Sunny C. on June 15, 2008, 09:09:06 PM
Läuft 1A unter 1.7.6! Keine Probleme gefunden! Alles wird dargestellt und zu 100% ausgeführt!

Habs in der Liste mit aufgenommen!
Unter 1.7.6 laufende Modifikationen (selbst getestet) (http://www.4homepages.de/forum/index.php?topic=21849.0)

Edit//

Ein Fehler habe ich doch noch gefunden!

Wenn man eine Einladung ablehnt, kommt folgendes:

Code: [Select]
DB Error: Bad SQL Query: UPDATE 4images_users_friendship SET friendship_status = -1, friendship_reject_message = 'Sorry, I'm not ready to be your friend yet' WHERE friendship_id = 3
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'm not ready to be your friend yet' WHERE friendship_id = 3' at line 3
Title: Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
Post by: SnaFy on July 27, 2008, 04:59:58 PM
Code: [Select]
DB Error: Bad SQL Query: SELECT COUNT(*) AS total_requests FROM 4images_users_friendship WHERE friendship_status = 0 AND user_id_secondary = 1
Table 'd.4images_users_friendship' doesn't exist
HRLP ME
Title: Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
Post by: Pontos on July 28, 2008, 08:08:37 AM
Morgen!

Ist einfach!
Liegt an dem einfachen Anführungszeichen in der Rückgabenachricht

$msg = "Sorry, I'm not ready to be your friend yet";


ist in der function:
Code: [Select]
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;
}

Entweder auskommentieren \’ oder löschen dann geht es!
Code: [Select]
  $msg = "Sorry, I\'m not ready to be your friend yet";oder
Code: [Select]
  $msg = "Sorry, Im not ready to be your friend yet";


Edit:

Wenn du möchtest das der Empfänger auch die Nachricht sehen tut musst du in der buddy.php das ändern:

Code: [Select]
    // REJECTED
    if ($user_row['friendship_status'] == -1){
    $buddy_button =  $user_row['friendship_reject_message']."<br />";
in:
Code: [Select]
    // REJECTED
    if ($user_row['friendship_status'] == -1){
    $buddy_button =  $user_row['friendship_response_message']."<br />";
Title: Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
Post by: Sunny C. on September 11, 2008, 04:52:24 PM
 :flag-de:
Kann man diese Modifikation um dieses Script erweitern?
Ich würde das gerne selber machen, doch dieses english ist zu hoch für mich und auch das anpassen in php Dateien ist sehr schwer! Dort ist der html-code auch anders.
http://www.danvk.org/wp/dragtable/
 

:flag-en:
Can one extend this modification by this script?
I would like to make this same, but this English is too high for me and files also adapt this in php is very heavy! The HTML code is also different there.
http://www.danvk.org/wp/dragtable/
Title: Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
Post by: rinaldos on September 12, 2008, 03:53:02 PM
Ich baue gerade diesen MOD in meine Gallerie ein. Nur sobald ich dieses in die Memberlist.php eintrage habe ich folgenden Effekt.
Code: [Select]
//---[MOD] BUDDY  V.1.0.0 beta ------------
//----2007 by eMagix for 4images gallery --
//----------- START CODE  -----------------

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

   
    // IF USER ALREADY A BUDDY SHOW ALREADY BUDDY TEXT
    $buddy_status = check_buddy($user_row['user_id']);
    if ($buddy_status == 1) {
      $buddy_button = $lang['user_buddy_yes'];
    }
    // IF USER REQUEST PENDING SHOW PENDING TEXT
    elseif ($buddy_status == 0) {
      $buddy_button = $lang['user_buddy_pending'];
    }
// IF NOT YET BUDDY SHOW BUTTON
    elseif ($buddy_status == -1) {
      $buddy_url .= "action=addbuddy&amp;id=".$user_row['user_id']."";
      $buddy_button = "<a href=\"".$site_sess->url($buddy_url)."\"><img src=\"".get_gallery_image("buddy_no.gif")."\" border=\"0\" alt=\"\" /></a>";
    }


  }
  else {
  // BUDDY BUTTON DISABLED
    $buddy_button = "<img src=\"".get_gallery_image("buddy_off.gif")."\" border=\"0\" alt=\"\" />";
  }
//----------- END CODE  -----------------

Die Anfrage wird korrekt gestellt, aber in der Adressleiste des Browsers steht dann die Adresse:
memberlist.php?&action=addbuddy&id=66
Wenn nun ein Nutzer erneut auf aktualisieren drückt, wird die ganze Anfrage erneut gestellt und beim Nutzer laufen nun schon zwei Anfragen auf. Wie kann man nun unterbinden, das die Adresse im Browser angezeigt wird bzw. überhaupt mit ausgegeben wird?

Für Hilfe wäre ich sehr dankbar.

Gruß
Ingo
Title: Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
Post by: Sunny C. on October 22, 2008, 11:18:20 PM
 :flag-de: :flag-de: :flag-de: :flag-de: :flag-de: :flag-de: :flag-de: :flag-de:
Hallo zusammen,

ich wollte einen Freund diese Mod einbauen, aber leider klappt das irgendwie nicht!
Ich habe diese Mod auch bei mir installiert, doch bei ihm klappt das nicht!

Schon die Ausführung der install_buddy2.php funktionierte nicht, daher habe ich dieses genommen!

Hum ... if phpmyadmin - try this:

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;

2 - See if 4images_users_friendship is correct table name and 4images_ for right table prefix. ;)

Die Tabellen wurden alle angelegt, aber dennoch klappt es nicht!
Auf der Startseite kommt folgender Fehler:
Code: [Select]
DB Error: Bad SQL Query: SELECT COUNT(*) AS total_requests FROM USERS_FRIENDSHIP_TABLE WHERE friendship_status = 0 AND user_id_secondary = 1
Table 'test.users_friendship_table' doesn't exist

Und wenn man die Buddyliste aufruft, zeigt er nichts an und dieser Fehler kommt:
Code: [Select]
DB Error: Bad SQL Query: SELECT COUNT(*) AS total_requests FROM USERS_FRIENDSHIP_TABLE WHERE friendship_status = 0 AND user_id_secondary = 1
Table 'test.users_friendship_table' doesn't exist

DB Error: Bad SQL Query: SELECT COUNT(friendship_id) AS total_friends FROM USERS_FRIENDSHIP_TABLE WHERE friendship_status =1 AND user_id_primary = 1 OR user_id_secondary = 1
Table 'test.users_friendship_table' doesn't exist

DB Error: Bad SQL Query: SELECT * FROM (4images_users u) INNER JOIN USERS_FRIENDSHIP_TABLE i ON (u.user_id = i.user_id_primary) WHERE i.friendship_status =1 AND i.user_id_secondary = 1 UNION SELECT * FROM (4images_users u) INNER JOIN USERS_FRIENDSHIP_TABLE i1 ON (u.user_id = i1.user_id_secondary) WHERE i1.friendship_status =1 AND i1.user_id_primary = 1 ORDER BY user_name ASC LIMIT 0, 30
Table 'test.users_friendship_table' doesn't exist

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\2\includes\db_mysql.php on line 116

DB Error: Bad SQL Query: SELECT * FROM (4images_users u) INNER JOIN USERS_FRIENDSHIP_TABLE i ON (u.user_id = i.user_id_primary) WHERE i.friendship_status <> 1 AND i.user_id_secondary = 1 UNION SELECT * FROM (4images_users u) INNER JOIN USERS_FRIENDSHIP_TABLE i1 ON (u.user_id = i1.user_id_secondary) WHERE i1.friendship_status <> 1 AND i1.user_id_primary = 1 ORDER BY friendship_request_date ASC
Table 'test.users_friendship_table' doesn't exist

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\2\includes\db_mysql.php on line 116

----------
 :flag-en: :flag-en: :flag-en: :flag-en: :flag-en: :flag-en: :flag-en: :flag-en:

Hello,

I wanted a friend install this mod, but unfortunately it works somehow not!
I have this mod installed for me too, but it does not work!

Even the execution of install_buddy2.php did not work, so I made this!

Hum ... if phpmyadmin - try this:

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;

2 - See if 4images_users_friendship is correct table name and 4images_ for right table prefix. ;)

The tables have all been created, but it does not work!
On the front page the following errors:
Code: [Select]
DB Error: Bad SQL Query: SELECT COUNT(*) AS total_requests FROM USERS_FRIENDSHIP_TABLE WHERE friendship_status = 0 AND user_id_secondary = 1
Table 'test.users_friendship_table' doesn't exist

And if you call the buddy list, it shows nothing, and this error:
Code: [Select]
DB Error: Bad SQL Query: SELECT COUNT(*) AS total_requests FROM USERS_FRIENDSHIP_TABLE WHERE friendship_status = 0 AND user_id_secondary = 1
Table 'test.users_friendship_table' doesn't exist

DB Error: Bad SQL Query: SELECT COUNT(friendship_id) AS total_friends FROM USERS_FRIENDSHIP_TABLE WHERE friendship_status =1 AND user_id_primary = 1 OR user_id_secondary = 1
Table 'test.users_friendship_table' doesn't exist

DB Error: Bad SQL Query: SELECT * FROM (4images_users u) INNER JOIN USERS_FRIENDSHIP_TABLE i ON (u.user_id = i.user_id_primary) WHERE i.friendship_status =1 AND i.user_id_secondary = 1 UNION SELECT * FROM (4images_users u) INNER JOIN USERS_FRIENDSHIP_TABLE i1 ON (u.user_id = i1.user_id_secondary) WHERE i1.friendship_status =1 AND i1.user_id_primary = 1 ORDER BY user_name ASC LIMIT 0, 30
Table 'test.users_friendship_table' doesn't exist

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\2\includes\db_mysql.php on line 116

DB Error: Bad SQL Query: SELECT * FROM (4images_users u) INNER JOIN USERS_FRIENDSHIP_TABLE i ON (u.user_id = i.user_id_primary) WHERE i.friendship_status <> 1 AND i.user_id_secondary = 1 UNION SELECT * FROM (4images_users u) INNER JOIN USERS_FRIENDSHIP_TABLE i1 ON (u.user_id = i1.user_id_secondary) WHERE i1.friendship_status <> 1 AND i1.user_id_primary = 1 ORDER BY friendship_request_date ASC
Table 'test.users_friendship_table' doesn't exist

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\2\includes\db_mysql.php on line 116
Title: Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
Post by: Lucifix on October 28, 2009, 10:58:40 AM
Did anyone tried to add invitation function (like Facebook), where you send invitation by email and when that person register, it will automatically added to your buddy list?
Title: Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
Post by: zakaria666 on August 09, 2010, 08:36:37 PM
Lucifix hello i have tried to install this MOD, but with no success, u helped me before and i want to thank u but then i got a few errors, have u succesfully installed this MOD? and does it actually work??

thanks
Title: Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
Post by: Lucifix on August 09, 2010, 09:05:22 PM
You're welcome.

Yes I have successfully installed this mod and it's working now. I can't recall if there were any errors during installation, because I did that few years ago.
Title: Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
Post by: zakaria666 on August 09, 2010, 09:39:06 PM
For some reason alot of the errors that im recieving sir are already mentioned here . For example....

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

as u can see above is the error i am getting when i install everything, The reason why i want this MOD as oppose to the other friend mod is because it has requests and the friendship can be seen my both people. The error above tells me i have no table existing, but with ur help i created that table :(. Its really weird,

What do u suggest i do sir? start again or just forget it? because i really like this MOD :(

thank you sir
Title: Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
Post by: V@no on August 09, 2010, 11:47:04 PM
missed step that changes includes/constants.php ?
Title: Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
Post by: zakaria666 on August 10, 2010, 12:36:04 AM
@ VANNO

Thank u so much for the reply sir,

I did not miss any steps sir, i did all of them and also sir, i think its in the include/ function.php... the problem is in there. But i dont know why its giving me the error that u can see in the previous thread. I did everything correctly,

:-( i want this MOD so badly and as u can see from this topic, in first page and 2nd page, everyone is having problem to but no body has answer to question to fix it :-(
Title: Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
Post by: V@no on August 10, 2010, 12:41:54 AM
from the error message you showed I can only conclude that constant USERS_FRIENDSHIP_TABLE wasn't defined in includes/constants.php = missed a step.

Code: (READ ME.doc) [Select]
-----[ OPEN ]-------------------------------------------

includes/constants.php


-----[ FIND ]--------------------------------------------

define('USERS_TABLE', $table_prefix.'users');


-----[ AFTER, ADD ]---------------------------------

define('USERS_FRIENDSHIP_TABLE', $table_prefix.'users_friendship');
Title: Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
Post by: zakaria666 on August 10, 2010, 04:28:36 PM
@ VANO,

Thank u ever so much for replying back to me sir. I want to thank u and i did exactly what u said and it worked. I  know sir i am pushing my luck and lucifix said a good point, u guys are doing this for me free and then u get people like me asking 100question for help. I will pay u for your help as i dont want u to think i am taking advantage I am not sir. :(

Sir i just have a few question, The MOD is working perfect but it has very very little flaws, that ive been trying to figure out but with my php knowlegde it isnt so well,


1) The image u see below is the user that has made a comment, and the comment has a buddy button that is completely shaded out, as a user cannot add themselves, that is pretty understandable. But is there any way using sessions to remove the buddy button from the person who aactually makes a comment? but show buddy buttons to all other membrs who make comments but hide the buddy button from the users comment that is currently logged in? I hope u understand what i mean sir.

(http://i33.tinypic.com/34z0vq0.jpg)

2) There is another flaw, if a user adds a person then the buddy button gets shaded out, however if i refresh the page over and over again lets say 5 times i have consequently send 5 friends requests for the user i want to be friends with, is there a way i can just send 1 friend request and from there if i refresh it does not mean i have again sent a friend request?

3) Also this is the last flaw, im so sorry, if user 1 sends friend request to user 2 then what happens is user 2 has the option to accept or reject, but the reject button is not work, it gives an error "There is an error, please try again later".  Can u please point to the direction from where maybe this problem is.

Please forgive me Vano, i know i am asking alot, but if i had as good php knowlegde like u i would not ask u and take ur time like this, but when i try to find problems and fix it, its very hard for me currently i am learning php but ur php is too advance for me. If u cannot help i understand please u just direct me to correct place and i will god willing try to fix it.

thank u VANO
Title: Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
Post by: V@no on August 10, 2010, 05:01:55 PM
1) in details.php find:
   $buddy_button = "<img src=\"".get_gallery_image("buddy_off.gif")."\" border=\"0\" alt=\"\" />";


Replace it with:
        if ($user_info['user_level'] != GUEST && $user_info['user_id'] == $comment_user_id)
        {
          $buddy_button = "";
        }
        else
        {
          $buddy_button = "<img src=\"".get_gallery_image("buddy_off.gif")."\" border=\"0\" alt=\"\" />";
        }
 


2) try this:
in includes/functions.php find:
  $sql= "INSERT INTO ".USERS_FRIENDSHIP_TABLE." (


Insert above :above:
  if (check_buddy($id) != -1) return 1;



3) as usual in such situations it's best have exact error message. refer to An unexpected error occured. Please try again later (http://www.4homepages.de/forum/index.php?topic=24177.0) topic to get exact error message.
Title: Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
Post by: zakaria666 on August 10, 2010, 06:05:44 PM
@ VANO,

Thank u so so so much for your reply, i went to the link u posted and did exaactly like u said, it tells me the error, its so strange, u r so clever i would have never imagine few simple code can help in making errors more detailed.

First of to re-cap, the problem was when user 1 sends friend request to user 2 and user 2 clicks reject it does not work, i get the error, unexpected error, please try again later,

below is the error u asked for sir in  more detail. This is only flaw left and the buddy list will be perfect, thanks to u

Bad SQL Query: UPDATE 4images_users_friendship
          SET friendship_status = -1,
               friendship_reject_message = 'Sorry, I'm not ready to be your friend yet'
          WHERE friendship_id = 15You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'm not ready to be your friend yet'
          WHERE friendship_id = 15' at line 3

when i look at the url link it tells me its in the buddy.php script.
God bless u VANO
Title: Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
Post by: V@no on August 10, 2010, 06:22:07 PM
Much better, now it's clear what is the problem.

In includes/functions.php find:
            friendship_reject_message = '".$user_info['buddy_reject_msg']."'


Replace with:
            friendship_reject_message = '".addslashes($user_info['buddy_reject_msg'])."'

(IMO author made a mistake by saving messages into database, this method kills any multilanguage compatibilities.)

This should fix the error.


Now if you get backlashes when viewing the request status at buddy.php (example: I\'m not ready..) then in buddy.php find two times $user_row['friendship_request_message'] (part of a line) and replace both with: stripslashes($user_row['friendship_request_message'])
Title: Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
Post by: zakaria666 on August 10, 2010, 06:54:12 PM
@VANO

Hello sir, please forgive me for doing this to u, im very sorry. I have tried that method u proposed unfortunately sir the problem is still there ,however this time i went back and i checked what the error was in more detail after i had taken ur steps to try to resolve the issue. Below is the issue in more detail after taking changing 1 line of code in the include/function.php.  As you can see from below sir, the error is different from the first error i put up. Im so sorry for this sir, Any idea why again this problem arrises

Bad SQL Query: UPDATE 4images_users_friendship
          SET friendship_status = -1,
               friendship_reject_message = 'Sorry, I\'m not ready to be your friend yet'
          WHERE friendship_id = 16Unknown column 'friendship_reject_message' in 'field list'

God bless vano and thank u
Title: Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
Post by: V@no on August 10, 2010, 07:11:09 PM
Oh, that is a bigger error...

You'll need search in all files that were modified by this mod (including buddy.php) for reject_message (part of a line) and replace all with: response_message
Title: Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
Post by: zakaria666 on August 10, 2010, 07:38:41 PM
WOWAWEEEEEEEEEEWA, it works, u r brilliant man. GREAT asset to 4images in everything u do. Just pure amazing. U not only help me but u give me belief that there are honourable people in this world who are 1 in a million. Thank u so much Vano i mean this, i will never forget ur proffesionalism and great work. There is no word in the world to show u my gratitude,

thank u so much vano, god bless u with all my heart
Title: Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
Post by: Sunny C. on August 10, 2010, 08:32:31 PM
by reject a buddy
Quote
DB Error: Bad SQL Query: UPDATE 4images_users_friendship SET friendship_status = -1, friendship_reject_message = '' WHERE friendship_id = 4
Unknown column 'friendship_reject_message' in 'field list'

can you help me?
Title: Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
Post by: V@no on August 10, 2010, 08:39:11 PM
Oh, that is a bigger error...

You'll need search in all files that were modified by this mod (including buddy.php) for reject_message (part of a line) and replace all with: response_message
Title: Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
Post by: Sunny C. on August 11, 2010, 12:15:11 PM
Thank you!

But i have replaced
if (!$num_rows)  {
  $userlist = "";
  $msg = $lang['buddy_no_empty'];
}
else {
  $userlist .="\n<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">\n<tr>\n<td class=\"bordercolor\">\n"; 
  $userlist .="<table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"1\">\n";
  $userlist .="<tr>\n<td class=\"head2\" align=\"center\">".$lang['user_name']."</td>\n<td class=\"head2\" align=\"center\">".$lang['email']."</td>\n<td class=\"head2\" align=\"center\">".$lang['homepage']."</td>\n<td class=\"head2\" align=\"center\">".$lang['lang_total_user_comments']."</td>\n<td class=\"head2\" align=\"center\">".$lang['lang_total_user_images']."</td>\n<td class=\"head2\" align=\"center\">".$lang['lang_buddy_action']."</td>\n</tr>\n";
  $count = 0;
  $bgcolor = 0;
  while ($user_row = $site_db->fetch_array($result)){
  $user_id = "";
  $user_name = "";
  $user_join_date = "";
  $user_email = "";
  $user_email_save = "";
  $user_mailform_link = "";
  $buddy_url="";
  $buddy_button="";
  $user_email_button = "";
  $total_user_images = "";
  $total_user_comments = "";
  $user_id = $user_row['user_id'];
   // --------------------------
   // COUNT users pics
   // --------------------------
   $sql = "SELECT COUNT(image_id) AS t_images
           FROM ".IMAGES_TABLE."
           WHERE user_id = $user_id";
   $count_t_images = $site_db->query_firstrow($sql);
   // --------------------------
   // UPDATE user_t_images field
   // --------------------------
   $sql = "UPDATE ".USERS_TABLE."
           SET user_t_images = ".$count_t_images['t_images']."
           WHERE user_id = $user_id";
   // --------------------------
   $site_db->query($sql);
    $user_profile_link = (!empty($url_show_profile)) ? preg_replace("/{user_id}/", $user_row['user_id'], $url_show_profile) : ROOT_PATH."member.php?action=showprofile&amp;".URL_USER_ID."=".$user_row['user_id'];
    $user_name = "<a href=\"".$site_sess->url($user_profile_link)."\">".htmlspecialchars($user_row['user_name'])."</a>";
$user_homepage = (isset($user_row['user_homepage'])) ? format_url($user_row['user_homepage']) : REPLACE_EMPTY;
if (!empty($user_homepage) && $user_homepage != REPLACE_EMPTY) {
      $user_homepage_button = "<a href=\"".$user_homepage."\" target=\"_blank\"><img src=\"".get_gallery_image("homepage.gif")."\" border=\"0\" alt=\"".$user_homepage."\" /></a>";
    }
    else {
      $user_homepage_button = REPLACE_EMPTY;
    }

    $buddy_url = $self_url;
    $buddy_url .= (!empty($mode)) ? ((strpos($buddy_url, '?') !== false) ? "&amp;" : "?")."mode=".$mode : "";
    $buddy_url .= strpos($buddy_url, '?') !== false ? "&amp;" : "?";
    $buddy_url .= "action=removefrombuddy&amp;id=".$user_id;
    //$buddy_button = "<a href=\"".$site_sess->url($buddy_url)."\"><img src=\"".get_gallery_image("buddy_yes.gif")."\" border=\"0\" alt=\"\" /></a>";

    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'];
      $user_email_save = str_replace("@", " at ", $user_row['user_email']);
      if (!empty($url_mailform)) {
        $user_mailform_link = $site_sess->url(preg_replace("/{user_id}/", $user_row['user_id'], $url_mailform));
      }
      else {
        $user_mailform_link = $site_sess->url(ROOT_PATH."member.php?action=mailform&amp;".URL_USER_ID."=".$user_row['user_id']);
      }
      $user_email_button = "<a href=\"".$user_mailform_link."\"><img src=\"".get_gallery_image("email.gif")."\" border=\"0\" alt=\"".$user_email_save."\" /></a>";
    }
    $user_join_date = (isset($user_row['user_joindate'])) ? format_date($config['date_format'], $user_row['user_joindate']) : REPLACE_EMPTY;
    $total_user_comments = $user_row['user_comments'];
    $total_user_images = $user_row['user_t_images'];
      if ($total_user_images > 0) {
        $total_images_link = $site_sess->url(ROOT_PATH."search.php?search_user=".$user_row['user_name']);
        $total_user_images_link =  "<a href=\"".$total_images_link."\">".$total_user_images."</a>";
      } else {
       $total_user_images_link = $total_user_images;
      }
     
    // ACCEPTED
    if ($user_row['friendship_status'] == 1){
   
    $buddy_button = "<a href=\"buddy.php?action=removebuddy&id=".$user_row['friendship_id']."\">".$lang['buddy_remove']."</a> ";
   
   
    }
   
    if ($count == 0) {
      $row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
      $userlist .= "<tr class=\"imagerow".$row_bg_number."\">\n";
    }
   
    $userlist .= "<td valign=\"center\" align=\"left\">".$session_ip." ".$user_name."</td>\n";
    $userlist .= "<td valign=\"center\" align=\"center\">".$user_email_button."</td>\n";
    $userlist .= "<td valign=\"center\" align=\"center\">".$user_homepage_button."</td>\n";
    $userlist .= "<td valign=\"center\" align=\"center\">".$total_user_comments."</td>\n";
    $userlist .= "<td valign=\"center\" align=\"center\">".$total_user_images_link."</td>\n";
$userlist .= "<td valign=\"center\" align=\"center\">".$buddy_button."</td>";
    $userlist .= "\n</tr>\n";
  }
  $userlist .= "</table>\n";
  $userlist .= "</td>\n</tr>\n</table>\n";
}
to
if (!$num_rows)  {
  $userlist = "";
  $msg = $lang['buddy_no_empty'];
}
else {
  $userlist .= $site_template->parse_template("buddy_userlist_header");
  $count = 0;
  $bgcolor = 0;
  while ($user_row = $site_db->fetch_array($result)){
  $user_id = "";
  $user_name = "";
  $user_join_date = "";
  $user_email = "";
  $user_email_save = "";
  $user_mailform_link = "";
  $buddy_url="";
  $buddy_button="";
  $user_email_button = "";
  $total_user_images = "";
  $total_user_comments = "";
  $user_id = $user_row['user_id'];
   // --------------------------
   // COUNT users pics
   // --------------------------
   $sql = "SELECT COUNT(image_id) AS t_images
           FROM ".IMAGES_TABLE."
           WHERE user_id = $user_id";
   $count_t_images = $site_db->query_firstrow($sql);
   // --------------------------
   // UPDATE user_t_images field
   // --------------------------
   $sql = "UPDATE ".USERS_TABLE."
           SET user_t_images = ".$count_t_images['t_images']."
           WHERE user_id = $user_id";
   // --------------------------
   $site_db->query($sql);
    $user_profile_link = (!empty($url_show_profile)) ? preg_replace("/{user_id}/", $user_row['user_id'], $url_show_profile) : ROOT_PATH."member.php?action=showprofile&amp;".URL_USER_ID."=".$user_row['user_id'];
    $user_name = "<a href=\"".$site_sess->url($user_profile_link)."\">".htmlspecialchars($user_row['user_name'])."</a>";
$user_homepage = (isset($user_row['user_homepage'])) ? format_url($user_row['user_homepage']) : REPLACE_EMPTY;
if (!empty($user_homepage) && $user_homepage != REPLACE_EMPTY) {
      $user_homepage_button = "<a href=\"".$user_homepage."\" target=\"_blank\"><img src=\"".get_gallery_image("homepage.gif")."\" border=\"0\" alt=\"".$user_homepage."\" /></a>";
    }
    else {
      $user_homepage_button = REPLACE_EMPTY;
    }

    $buddy_url = $self_url;
    $buddy_url .= (!empty($mode)) ? ((strpos($buddy_url, '?') !== false) ? "&amp;" : "?")."mode=".$mode : "";
    $buddy_url .= strpos($buddy_url, '?') !== false ? "&amp;" : "?";
    $buddy_url .= "action=removefrombuddy&amp;id=".$user_id;
    //$buddy_button = "<a href=\"".$site_sess->url($buddy_url)."\"><img src=\"".get_gallery_image("buddy_yes.gif")."\" border=\"0\" alt=\"\" /></a>";

    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'];
      $user_email_save = str_replace("@", " at ", $user_row['user_email']);
      if (!empty($url_mailform)) {
        $user_mailform_link = $site_sess->url(preg_replace("/{user_id}/", $user_row['user_id'], $url_mailform));
      }
      else {
        $user_mailform_link = $site_sess->url(ROOT_PATH."member.php?action=mailform&amp;".URL_USER_ID."=".$user_row['user_id']);
      }
      $user_email_button = "<a href=\"".$user_mailform_link."\"><img src=\"".get_gallery_image("email.gif")."\" border=\"0\" alt=\"".$user_email_save."\" /></a>";
    }
    $user_join_date = (isset($user_row['user_joindate'])) ? format_date($config['date_format'], $user_row['user_joindate']) : REPLACE_EMPTY;
    $total_user_comments = $user_row['user_comments'];
    $total_user_images = $user_row['user_t_images'];
      if ($total_user_images > 0) {
        $total_images_link = $site_sess->url(ROOT_PATH."search.php?search_user=".$user_row['user_name']);
        $total_user_images_link =  "<a href=\"".$total_images_link."\">".$total_user_images."</a>";
      } else {
       $total_user_images_link = $total_user_images;
      }
     
    // ACCEPTED
    if ($user_row['friendship_status'] == 1){
   
    $buddy_button = "<a href=\"buddy.php?action=removebuddy&id=".$user_row['friendship_id']."\">".$lang['buddy_remove']."</a> ";
   
   
    }
   
    if ($count == 0) {
      $row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
      $userlist .= "";
    }
   
    $userlist .= $site_template->parse_template("buddy_userlist");
  }
  $userlist .= $site_template->parse_template("buddy_userlist_footer");
}
// END ALREADY BUDDY
$site_template->register_vars("buddy", $userlist);
$site_template->register_vars("buddy_msg", $msg);
unset($userlist,$msg);

But dont work

buddy_userlist_header.html
Code: [Select]
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td class="bordercolor"><table width="100%" border="0" cellpadding="2" cellspacing="1">
        <tr>
          <td class="head2" align="center">{lang_user_name}</td>
          <td class="head2" align="center">{lang_email}</td>
          <td class="head2" align="center">{lang_homepage}</td>
          <td class="head2" align="center">{lang_total_user_comments}</td>
          <td class="head2" align="center">{lang_total_user_images}</td>
          <td class="head2" align="center">{lang_buddy_action}</td>
        </tr>
buddy_userlist.html
Code: [Select]
        <tr class="imagerow{row_bg_number}">
          <td valign="center" align="left">{session}{user_name}</td>
          <td valign="center" align="center">{user_email_button}</td>
          <td valign="center" align="center">{user_homepage_button}</td>
          <td valign="center" align="center">{total_user_comments}</td>
          <td valign="center" align="center">{total_user_images_link}</td>
          <td valign="center" align="center">{buddy_button}</td>
        </tr>
buddy_userlist_footer.html
Code: [Select]
      </table></td>
  </tr>
</table>
Title: Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
Post by: zakaria666 on August 11, 2010, 12:45:51 PM
Hello

What is the problem exactly. Vano was really helpful and kinf to me and i would like to repay this by helping u. What problem do u have and hopefully i may have the answers all thanks to Vano
Title: Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
Post by: Sunny C. on August 11, 2010, 01:54:43 PM
This has nothing to do with the other problems
I want to separate the HTML code from the PHP code
Title: Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
Post by: V@no on August 11, 2010, 02:46:18 PM
@Sumale.nin:
I think you should start over with explanation on what exactly you are trying to do and/or what is the problem. Your first reply was about error message, then you said my suggestion on repairing it didn't work (or at least whatever didn't work was without explanation about what you were trying to do...or you are quizzing us? :)), and lastly you are talking about separation of HTML from PHP...

As of html separation, you did almost everything right, except you missed the part that registers template tags for your buddy_userlist.html template. You must register these tags before you parsing the template.
$userlist = "";
if (!$num_rows)
{
  $msg = $lang['buddy_no_empty'];
}
else
{
  $site_template->register_vars(array(
    "lang_user_name" => $lang['user_name'],
    "lang_email" => $lang['email'],
    "lang_homepage" => $lang['homepage'],
    "lang_user_comments" => $lang['lang_total_user_comments'],
    "lang_user_images" => $lang['lang_total_user_images'],
    "lang_buddy_action" => $lang['lang_buddy_action'],
  ));
  $userlist = $site_template->parse_template("buddy_userlist_header");
  $count = 0;
  $bgcolor = 0;
  while ($user_row = $site_db->fetch_array($result))
  {
    $user_id = "";
    $user_name = "";
    $user_join_date = "";
    $user_email = "";
    $user_email_save = "";
    $user_mailform_link = "";
    $buddy_url="";
    $buddy_button="";
    $user_email_button = "";
    $total_user_images = "";
    $total_user_comments = "";
    $user_id = $user_row['user_id'];
    // --------------------------
    // COUNT users pics
    // --------------------------
    $sql = "SELECT COUNT(image_id) AS t_images
           FROM ".IMAGES_TABLE."
           WHERE user_id = $user_id";
    $count_t_images = $site_db->query_firstrow($sql);
    // --------------------------
    // UPDATE user_t_images field
    // --------------------------
    $sql = "UPDATE ".USERS_TABLE."
           SET user_t_images = ".$count_t_images['t_images']."
           WHERE user_id = $user_id";
    // --------------------------
    $site_db->query($sql);
    $user_profile_link = (!empty($url_show_profile)) ? preg_replace("/{user_id}/", $user_row['user_id'], $url_show_profile) : ROOT_PATH."member.php?action=showprofile&amp;".URL_USER_ID."=".$user_row['user_id'];
    $user_name = "<a href=\"".$site_sess->url($user_profile_link)."\">".htmlspecialchars($user_row['user_name'])."</a>";
  
  
  
    $user_homepage = (isset($user_row['user_homepage'])) ? format_url($user_row['user_homepage']) : REPLACE_EMPTY;



    if (!empty($user_homepage) && $user_homepage != REPLACE_EMPTY) {
      $user_homepage_button = "<a href=\"".$user_homepage."\" target=\"_blank\"><img src=\"".get_gallery_image("homepage.gif")."\" border=\"0\" alt=\"".$user_homepage."\" /></a>";
    }
    else {
      $user_homepage_button = REPLACE_EMPTY;
    }




    $buddy_url = $self_url;
    $buddy_url .= (!empty($mode)) ? ((strpos($buddy_url, '?') !== false) ? "&amp;" : "?")."mode=".$mode : "";
    $buddy_url .= strpos($buddy_url, '?') !== false ? "&amp;" : "?";




    $buddy_url .= "action=removefrombuddy&amp;id=".$user_id;
    //$buddy_button = "<a href=\"".$site_sess->url($buddy_url)."\"><img src=\"".get_gallery_image("buddy_yes.gif")."\" border=\"0\" alt=\"\" /></a>";

    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'];
      $user_email_save = str_replace("@", " at ", $user_row['user_email']);
      if (!empty($url_mailform)) {
        $user_mailform_link = $site_sess->url(preg_replace("/{user_id}/", $user_row['user_id'], $url_mailform));
      }
      else {
        $user_mailform_link = $site_sess->url(ROOT_PATH."member.php?action=mailform&amp;".URL_USER_ID."=".$user_row['user_id']);
      }
      $user_email_button = "<a href=\"".$user_mailform_link."\"><img src=\"".get_gallery_image("email.gif")."\" border=\"0\" alt=\"".$user_email_save."\" /></a>";
    }
    $user_join_date = (isset($user_row['user_joindate'])) ? format_date($config['date_format'], $user_row['user_joindate']) : REPLACE_EMPTY;
    $total_user_comments = $user_row['user_comments'];
    $total_user_images = $user_row['user_t_images'];
    if ($total_user_images > 0) {
      $total_images_link = $site_sess->url(ROOT_PATH."search.php?search_user=".$user_row['user_name']);
      $total_user_images_link =  "<a href=\"".$total_images_link."\">".$total_user_images."</a>";
    } else {
     $total_user_images_link = $total_user_images;
    }
      
    // ACCEPTED
    if ($user_row['friendship_status'] == 1){
      $buddy_button = "<a href=\"buddy.php?action=removebuddy&id=".$user_row['friendship_id']."\">".$lang['buddy_remove']."</a> ";
    }
  
    if ($count == 0) {
      $row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
      $userlist .= "";
    }
    
    $site_template->register_vars(array(
      "row_bg_number" => $row_bg_number,
      "buddy_ip" => $session_ip,
      "buddy_username" => $user_name,
      "buddy_email_button" => $user_email_button,
      "buddy_homepage_button" => $user_homepage_button,
      "buddy_user_comments" => $total_user_comments,
      "buddy_user_images" => $total_user_images_link,
      "buddy_button" => $buddy_button,
    ));
    $userlist .= $site_template->parse_template("buddy_userlist");
  }
  $userlist .= $site_template->parse_template("buddy_userlist_footer");
}
// END ALREADY BUDDY
$site_template->register_vars("buddy", $userlist);
$site_template->register_vars("buddy_msg", $msg);
unset($userlist,$msg);


(note, I did not look what kind of tags you've used in your templates, so you'll need either rename them in templates or in my code to match.
Title: Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
Post by: V@no on August 11, 2010, 07:15:26 PM
New version 2 posted by Sumale.nin

http://www.4homepages.de/forum/index.php?topic=27705.0
Title: Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
Post by: zakaria666 on August 14, 2010, 07:58:31 PM
@VANO

Listen im so sorry, today i think i have made alot of requests, its just im so close to finishing this site thanks to u. Right now im trying to find out how to put bbcode original into bbcode pmV2, also im trying to find out why i have 3 errors on new images, so im all over place.

Just have question as usual  :) Im trying to hide email button for user logged in, just like how before user cannot add themselves and u helped me hide the buddy button, can u plz show me how i can hide email button on comments for original user but show email button for other users.

Thank u so much Vano, i very much appreciate ur time that u take out to help me. God bless u sir with my heart