Okay, well, friend list stuff. I see you've already managed to move it over to the page, which is a good first step.
So let's trace where these functions go. (Feel free to skip over if you just want to get to the good part.)
In
profileview.php, a
display() is called:
PHP:
$profile->display("friends", $user);
With
$profile being set earlier up the page:
PHP:
$profile = $this->getField("profile");
This means it's been set on the non 'view' version of the page, so over to
profile.php:
PHP:
$this->profile = $this->user->getprofile();
It seems a bit of a jump, but
getprofile() is exists in
classes/class_member.php, and inside, this is called:
PHP:
$this->profile = new UserProfile($this->uid);
And that's basically what I was looking for - a declaration of new
Something I now know to look for the
display function - yeah that thing from the start - in
classes/class_userprofile.php. I could have guessed that from the start, but, I figured it was worth showing you how it all connects.
No need to change the display function. It's still what you need to call - and it's called by a few other things. Based on the parameters, it'll just display a different part of the page. Easy!
PHP:
$this->getfriends($data);
So you want to find
private function getfriends($user) in
classes/class_userprofile.php, and this is where the fun begins. Here is where you'll find the title of the section, a count of how many friends the user has, a button to befriend the user (which only displays if you aren't that user, of course), and a notification that will display (if they are visiting their own page) if they have pending friend requests. You'll want to figure out what you're doing with that.
But
$friendlist->display(); is also called, and
PHP:
$friendlist = new Friendlist($user);
tells us that we can look in
classes/class_friendlist.php for another
display function - which is doing a lot of the real dirty work.
Okay, but when you find it, you'll see that it's a table. You'll probably want to break out of that, so we're still going to take advantage of the
foreach loop going on. There are three things in this table - firstly, the user avatar. Secondly, a delete friend button that will only show if you are visiting your own profile. And then thirdly - all the rest of the info.
The rest of the info is being pulled from
classes/class_friendtablehelper.php, in the
getFriendInfo function. We should try to avoid a call to it if possible, so let's take a look to pull over information that we want from it. Doesn't look too bad.
So our real enemy is rewriting that foreach loop in
classes/class_friendlist.php's
display function to not use a table. Let's use some divs?
Save a copy of what's already there as a back up. Otherwise, try replacing the display function with this:
PHP:
public function display(){
// Display the user's friendlist
$mysidia = Registry::get("mysidia");
$document = $mysidia->frame->getDocument();
if(!$this->isfriend($mysidia->user->uid) and $this->privacy == "protected") return FALSE;
elseif(!$this->fids) return FALSE;
else {
foreach($this->fids as $fid){
$friend = new Member($fid);
$document->add(new Comment("<div style='display: inline-block; text-align: center;'>
{$friend->username}
<br>
<a href='../../profile/view/{$friend->username}'>(Visit Profile)</a>
<br>
<a href='../../messages/newpm/{$friend->username}'>(Send Message)</a>
", FALSE));
if(!empty($mysidia->user->username) and $this->user == $mysidia->user->username){
$document->add(new Comment("<br><a href='../../friends/delete/{$friend->uid}'>(Remove Friend)</a>", FALSE));
}
$document->add(new Comment("</div>", FALSE));
}
}
// End of the display method
}
Does that help?