Displaying different usergroup titles on profiles

Forum
Last Post
Threads / Messages

GeneticAlpha

Loving Mysidia!
Member
Joined
May 24, 2020
Messages
287
Points
18
Age
31
Location
Tennessee
Mysidian Dollar
13,377
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:

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:

$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:

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! :]​
 
Last edited:

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,274
Messages
33,115
Members
1,602
Latest member
BerrieMilk
BETA

Latest Threads

Latest Posts

Top