Reconstructing profile page, halp? :c

Forum
Last Post
Threads / Messages

tahbikat

Member
Member
Joined
Feb 11, 2014
Messages
408
Points
16
Age
30
Location
Louisiana
Mysidian Dollar
32,360
I'm trying to reconstruct profile pages. I want to remove the tabs. Not a big fan of them.

This is basically what I'm trying to do (just a mockup): http://i.imgur.com/W7jwLeV.png


I've managed to figure out how to edit the About Me section and such in the class_userprofile.php, however, I'd like the friends and the Adoptables sections to display on pages similar to what's on the myadopts.php page (or see mockup above). Could anyone help me with this? :c It would look sooo much better and load so much faster.

edit: Also can't seem to figure out how to get the spotlight adopt to display in the about me part.

Also you can see what I've done so far here (very big mess, beware!) http://mysgardia.com/profile/view/Lavie
 
Last edited:
Well, for the favepet, the lines here in .../classes/class_userprofile.php are what display the favepet on the adoptables tab:
PHP:
      $document->add($this->favpet);
      $document->add(new Comment($this->about));

I just copied those lines and added it to the about me tab like this;
PHP:
  private function aboutme(){
      $mysidia = Registry::get("mysidia");	
	  $document = $mysidia->frame->getDocument();
      $title = new Comment($mysidia->lang->basic.$mysidia->input->get("user"));
      $title->setBold(TRUE);
      $title->setUnderlined(TRUE);
      $membersince = $mysidia->db->select("users", array("membersince"), "username = '{$mysidia->input->get("user")}'")->fetchColumn();      
      $basicinfo = "<br><strong>Member Since:</strong> {$membersince}<br>
				    <strong>Gender:</strong> {$this->gender}<br>
				    <strong>Favorite Color:</strong> {$this->color}<br>
				    <strong>Nickname:</strong> {$this->nickname}<br>
				    <strong>Bio:</strong> {$this->bio}";
	  
      $document->add($title);
      $document->add(new Image($this->avatar, "avatar", 100));
      $document->add(new Comment($basicinfo));
      $document->add($this->favpet);
      $document->add(new Comment($this->about));
  }

And as you can see here, it displays just fine.

As for the rest...well I know the adoptables section is done primarily through tables. If you want them to appear on separate pages then I believe you're going to need to build new pages to display the information. I'm going to play around with tables to see if I can get the pets, at least, to display like how you have it in your mockup.

EDIT:
OK, I got the pets to display in a table like they do on the myadopts page, the only issue is that when a user has a lot of pets you'll probably want to be able to go to another page of pets, and that's something I'm still working on.
PHP:
      $title = new Comment("{$mysidia->input->get("user")}'s Pets:");
      $title->setBold(TRUE);
      $title->setUnderlined(TRUE);
      $document->add($title);
	    $adoptTable = new TableBuilder("adopttable", 650);
		$adoptTable->setAlign(new Align("center", "middle"));
		$adoptTable->buildHeaders("Creature", "Name", "Species", "Level", "Points");
      $stmt = $mysidia->db->select("owned_adoptables", array("aid"), "owner = '{$mysidia->input->get("user")}'");
      while($id = $stmt->fetchColumn()){
		    $adopt = new OwnedAdoptable($id);
			$cells = new LinkedList;
			$cells->add(new TCell(new Comment("<a href='http://mysgardia.com/levelup/click/{$adopt->getAdoptID()}'><img src='{$adopt->getImage()}'/></a>")));
			$cells->add(new TCell("{$adopt->getName()}"));
			$cells->add(new TCell("{$adopt->getType()}"));
			$cells->add(new TCell($adopt->getCurrentLevel()));
			$cells->add(new TCell($adopt->getTotalClicks()));
			$adoptTable->buildRow($cells);
	    }
		$document->add($adoptTable);
    }
 
Last edited:
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:
$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?
 
Last edited:
Thank you guys!

@Abronsyth, thank you! It looks much better now, even if not paginated. Gonna see if I can figure it out. Probably take me a while though lol.

@Kyttias, I'm gonna add your code soon and let you know how it works! Thank you for explaining everything. <3
edit: Thank you Kyttias! Looks so nice and sleek now. :D
 
Last edited:
Humm, does anyone know how I could apply css styles to only the adopt, market, stats, etc tables? If I try to style them as is, it of course styles the container table too.

edit: oh and Abron, with the Spotlight Adopt, I wanted it to float to the right of the about me section, but I'm not sure how to do that with how it's currently written. :c
 
Last edited:
If you show me how it's currently written I may be able to help, I've played around with getting images to display properly a lot, hehe.

As for the tables...if you give the tables a specific ID then you can style each individual one in the CSS...now I'm not very good with PHP tables but I *think* that the ID for, say, the myadopts table (and the way I've set it up the table that displays user pets on profiles as well), is "adopttable", so in CSS you could edit it with;
Code:
#adopttable { }

Edit:
I tested this and it works :D
#adopttable: myadopts table
#top10: Top 10 adoptables on stats page
#rand5: "5 random adoptables" table on stats page
#shoplist: market

((I have not tested for any others aside from adopttable yet!))

Edit 2:
The .../adopt.php page's table is simply ID'd as "table," so you might want to change that (line 37 in .../view/adoptview.php) to something else so that you can use CSS to customize it :)
 
Last edited:

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,280
Messages
33,132
Members
1,603
Latest member
Monako
BETA

Latest Threads

Top