Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Tutorials and Tips (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=27)
-   -   Displaying different usergroup titles on profiles (http://www.mysidiaadoptables.com/forum/showthread.php?t=5649)

Micolai 06-16-2020 03:02 PM

Displaying different usergroup titles on profiles
 
I wanted to add a title to my members profile pages where it listed what type member they are. So, with the help of my friend, Ittermat, we figured out how to get the call to work that will display whatever the member's group is. I know that's probably to most a very simple code, but I don't know anything about PHP lol I only know HTML and CSS. So, anyway, below is how we got it to work.

- Open up your File Manager, and open class_userprofile.php
- Go around to about line 116. It should be the Private Function aboutme area. In here is where you can type in whatever you want, but I used 'Title'.

So, at the top of the other account information that was already there is where I placed my title area, but you can put it anywhere in here or call it something different. Here is my code:

Quote:

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();
$line = $mysidia->db->select("online", array("username"), "username = '{$mysidia->input->get("user")}'")->fetchColumn();
if($line == $mysidia->input->get("user")){$online = "<font color=green>Online</font>";}else{$online = '<font color=red>Offline</font>';}
$basicinfo = "<br><strong>Member Since:</strong> {$membersince}<br>
<br>
Online Status: {$online}</br>
Title: {$usergroup}<br>
Gender: {$this->gender}<br>
Name: {$this->nickname}<br>
<br>
Bio: {$this->bio}";

$document->add($title);
$document->add(new Image($this->avatar, "avatar", 100));
$document->add(new Comment($basicinfo));
$document->add(new Comment(""));
}
So you need to add this code under your {$membersince code:

Quote:

$usergroup = $mysidia->db->select("users", array("usergroup"), "username = '{$mysidia->input->get("user")}'")->fetchColumn();
$groups = $mysidia->db->select("groups", array("groupname"), "gid = '{$usergroup}'")->fetchColumn();
Then add in your basic info area:

Quote:

Title: {$groups}
and that's it! Hope this helps someone.

Note: You can also use this to call other things, too. Similar to the public pet profiles that call rarity and what not.

Once I learn more about how to add things that isn't already part of the framework I'll edit this post to also talk about how to go about creating the thing you're wanting to have. Say, you want to be able to use a rarity since that's not something already in the Mysidia framework, you would have to add it to the database and go to a few areas in the files and add some code before it would call and display right. I already have added a rarity system into my site so I can re-look at how I did that and edit this topic with a tutorial.

Whelp, that's it! :]

Micolai 06-16-2020 05:42 PM

Delete this reply post, code is fixed.


All times are GMT -5. The time now is 05:56 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.