Results 1 to 2 of 2
  1. #1
    Casual Pligger eH9116's Avatar
    Joined
    Jan 2007
    Posts
    47
    Thanks
    Received:0
    Given: 0

    Viewing your friends in ones that added you

    Hey I was wondering what the line of code would be to do the following....When a user is viewing the "people who have added you as a friend" page, if they have added that person as a friend, I want to show a check next to the message column. I have already set up the column and just need to put the check into it, so far I have the following in function do_viewfriends2() but the red statement isn't quite correct, how can I fix this? It seems pretty easy but I'm just not sure of the code. Basically it just needs to see if the friend exists in $myfriend and $myfriends.

    Code:
    $friend4=new Friend;
    $myfriends = $friend4->get_friend_list();
    
    ....
    $temp=$myfriend->user_login;
    			if (array_key_exists($temp, $myfriends))
    			{
    				echo '<td><img src='.my_pligg_base.'/templates/mollio-beat/images/green_check.gif border=0></a></td>';
    			}

  2. #2
    Casual Pligger eH9116's Avatar
    Joined
    Jan 2007
    Posts
    47
    Thanks
    Received:0
    Given: 0

    Got it!

    Cancel the help, I have figured it out....great mod idea though! This code will display a third column titled "your friend" and place a green check if that person is added as your friend as well. Goes great with my idea to remove the "view people who have added you as a friend" and just display both on the same page. just call "do_viewfriends2()" at the end of do_viewfriends() and remove all instances of the image and link for "{* display "people who have added me as a friend" link *}" in "\your template\user_center.tpl"

    In the "user.php" file, replace the do_viewfriends2() function with the following:

    Code:
    function do_viewfriends2(){
    	global $db, $user;
    	$friend = new Friend;
    	$friends = $friend->get_friend_list_2();
    
    	$friend4 = new Friend;
    	$myfriends = $friend4->get_friend_list();
    	
    	echo "<h2>People who have added you as a friend</h2>";
    
    	if ($friends){
    	    echo '<table style=width:50% class=listing><th>username</th><th>message</th><th>your friend</th>';
    		foreach($friends as $myfriend) {
    		    echo '<tr><td>';
    			if(Enable_Gravatar){
    				echo ' <img src="http://www.gravatar.com/avatar.php?gravatar_id='. md5($myfriend->user_email) .'&size=20&rating=' . Gravatar_Maxrating . '">';
    			}
    			echo '<a href="'. my_pligg_base. '/user.php?login=' . $myfriend->user_login . '">' . $myfriend->user_login.'</a></td>';
    			
    			echo '<td><a href="#view_message" rel="view_message~!~view=small_msg_compose~!~login=' .$myfriend->user_login . '"	class="lbOn"><img src='.my_pligg_base.'/templates/mollio-beat/images/user_message.png border=0></a></td>';			
    			$temp=$myfriend->user_login;
    			foreach($myfriends as $myfriend2) { 
    				if ($myfriend2->user_login == $myfriend->user_login) {
    					echo '<td><img src='.my_pligg_base.'/templates/mollio-beat/images/green_check.gif border=0></a></td>';
    				}
    			}
    		}
    		echo '</tr></table>';
    	}
    	else {
    		echo "<br /><br /><center><strong>nobody has added you as a friend</strong></center>";
    	}
    }

Similar Threads

  1. Status when viewing a story
    By cmstheme in forum Questions & Comments
    Replies: 1
    Last Post: 10-12-2010, 11:45 AM
  2. Sql error while viewing category
    By Jaffery in forum Questions & Comments
    Replies: 1
    Last Post: 02-06-2008, 09:11 AM
  3. Viewing only links added by friends
    By doef in forum Questions & Comments
    Replies: 0
    Last Post: 05-09-2007, 01:24 AM
  4. Viewing Friends List Error
    By Simon in forum Questions & Comments
    Replies: 1
    Last Post: 05-03-2007, 07:41 PM
  5. Viewing discarded posts?
    By Nurke in forum Questions & Comments
    Replies: 6
    Last Post: 11-20-2006, 08:57 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Pligg Modules and Pligg Templates from Pligg Pro Web Hosting Services by Midphase Dreamhost Web Hosting Donate to Pligg