View Single Post
  #4  
Old 01-07-2016, 08:17 AM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 396,211
Hall of Famer is on a distinguished road
Default

1. You will need to check if the user is on your friendlist, and only show the 'send a friend request' image and link when the user is not a friend of yours yet. The below steps demonstrates how to check this:

PHP Code:
$friendlist = new Friendlist($mysidia->user); //create your own friendlist object.
$friend = new Friend(new Member($mysidia->input->get("user")), $friendlist); //create a friend object.
if(!$friend->isfriend){ //only show if the user is a friend of yours. 
    
$document->add(new Image("templates/icons/fr.gif""Send a Friend Request"));
    
$document->add(new Link("friends/request/{$member->uid}""Send {$mysidia->input->get("user")} a Friend Request"TRUE));     

Note the above code may need some tweaks, as if you are viewing the page as a guest you may get get a glitch. You can test it and lemme know how it goes.

2. Yeah, you can add one line to the friend class' remove method, to delete the row from table prefix_friend_requests. The code should look like this below:

PHP Code:
$mysidia->db->delete("friend_requests""(fromuser='{$mysidia->user->username}' AND touser='{$this->username}') OR (touser='{$mysidia->user->username}' AND fromuser='{$this->username}')"); 
This above code should delete a row with friend request between you and your old friend that you dont want to maintain friendship anymore. After the friend request is deleted, you should be able to send friend request to this user again without any problems.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote