Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Notices

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 01-05-2016, 05:42 PM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 137,024
Kyttias is on a distinguished road
Default

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.)

  Spoiler: Lead Up 
In profileview.php, a display() is called:
PHP Code:
$profile->display("friends"$user); 
With $profile being set earlier up the page:
PHP Code:
$profile $this->getField("profile"); 
This means it's been set on the non 'view' version of the page, so over to profile.php:
PHP Code:
$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 Code:
$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 Code:
$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 Code:
$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 Code:
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?
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it.

Last edited by Kyttias; 01-05-2016 at 06:03 PM.
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 09:52 AM.

Currently Active Users: 3323 (0 members and 3323 guests)
Threads: 4,081, Posts: 32,032, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636