• [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove 5 0 5 1
Currently:  

Poll

Buddy List v1.0 - Buddy Request/Accept/Reject/Remove

I like
11 (84.6%)
I don't like
2 (15.4%)
I don't care
0 (0%)

Total Members Voted: 10

Author Topic: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove  (Read 56832 times)

0 Members and 1 Guest are viewing this topic.

Offline eMagix

  • Pre-Newbie
  • Posts: 3
    • View Profile
[MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
« 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


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 :-)
« Last Edit: December 11, 2007, 05:41:35 AM by eMagix »

Offline Loda

  • Sr. Member
  • ****
  • Posts: 353
    • View Profile
    • Fotosucht Schweiz
Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
« Reply #1 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";
« Last Edit: December 10, 2007, 01:09:16 PM by Loda »

Offline eMagix

  • Pre-Newbie
  • Posts: 3
    • View Profile
Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
« Reply #2 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 :-).

Offline matab

  • Newbie
  • *
  • Posts: 43
    • View Profile
Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
« Reply #3 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

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
« Reply #4 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. ;)
« Last Edit: December 23, 2007, 09:26:22 PM by thunderstrike »
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline matab

  • Newbie
  • *
  • Posts: 43
    • View Profile
Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
« Reply #5 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


Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
« Reply #6 on: December 23, 2007, 08:32:56 PM »
This is right. I edit post. Try again. ;)
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline matab

  • Newbie
  • *
  • Posts: 43
    • View Profile
Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
« Reply #7 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

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
« Reply #8 on: December 23, 2007, 08:50:57 PM »
Try now. ;)
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline matab

  • Newbie
  • *
  • Posts: 43
    • View Profile
Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
« Reply #9 on: December 23, 2007, 09:08:43 PM »
Try now. ;)

Error  :?  :

Quote
#1072 - Key column 'users_friendship_id' doesn't exist in table

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
« Reply #10 on: December 23, 2007, 09:26:37 PM »
Well, is author problem so now - is fix from my post. :?
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline matab

  • Newbie
  • *
  • Posts: 43
    • View Profile
Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
« Reply #11 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

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
« Reply #12 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.
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline matab

  • Newbie
  • *
  • Posts: 43
    • View Profile
Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
« Reply #13 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:

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: [MOD] Buddy List v1.0 - Buddy Request/Accept/Reject/Remove
« Reply #14 on: December 23, 2007, 10:23:32 PM »
Ahh ! very good. Thank for posting.
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?