Mysidia Adoptables Support Forum  

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

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 03-18-2013, 10:52 AM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 327,362
Hall of Famer is on a distinguished road
Default (How to...) Add user avatar to the sidebar with Mys v1.3.3

Well this is a simple tutorial for admins to add user avatar as a module to their users, it assumes that you uses Mys v1.3.3. For earlier versions you may have to do this by editing script files, which can be a problem.

So to begin with, go to module manager in your ACP, create a new module with basic information as entered below:


It does not matter what name you give to your avatar module, but the required userlevel can be tricky. Enter 'member' as suggested above, otherwise it may attempt to get avatars for guests and return an error message.

The next thing to do is to enter the module's PHP code. The PHP code is evaluated by the script's internal code, but there are a few variables you may need to keep track of. One of them is $mysidia, which stores important system information. The other is $moduleContainer, which serves as container for your GUI module. Sounds complicated? Well for this tutorial you do not need to know how they work, since I will provide the actual code to get this avatar module done for you. However, you may want to learn a bit more about them if you plan to add some custom php code completely yourself.

Anyway, in the field 'module php code' text area, enter the following code below:

PHP Code:
$profile $mysidia->user->getprofile();
$avatar = new Image($profile->getAvatar());
$avatar->resize(200);
$moduleContainer->add($avatar); 
And we are all done, submit the form and your users will find their avatar displayed on the sidebar. You can change the value '200' in $avatar->resize(200) to get any size you want for your site, 200 is used here since the width of default sidebar column is about that size. Your user may have a problem if they have rectangular shaped avatar rather than squarely shaped, but this cant be helped. The avatar module in action is shown below:



This concludes my tutorial for how to add user avatars to your site, lemme know if you encounter any issues. Also you can change the display order for each sidebar module in ACP too, just in case you havent noticed yet. Have fun playing with the script, everyone.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #2  
Old 03-18-2013, 03:33 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 111,659
Abronsyth is on a distinguished road
Default

*Dances* Wonderful! I was just wondering about this too :D

Thanks, HoF ^_^
__________________
My Mods Site (1.3.4, 2020 Mods)
Reply With Quote
  #3  
Old 03-18-2013, 05:20 PM
Infernette Infernette is offline
CODE CODE CODE CODE CODE
 
Join Date: Jan 2013
Location: Where I live? I live home.
Posts: 164
Gender: Female
Credits: 23,613
Infernette is on a distinguished road
Default

Coolio! I was wondering though, how do you change the alignment of the avatar, like center or something. :)
__________________
No, I have no idea what I'm doing. But it works. Barely.
Reply With Quote
  #4  
Old 12-28-2015, 10:55 PM
SapphirePhoenix's Avatar
SapphirePhoenix SapphirePhoenix is offline
Adoptable Site Owner
 
Join Date: Nov 2015
Location: Australia
Posts: 81
Gender: Female
Credits: 8,170
SapphirePhoenix is on a distinguished road
Default

Yay! And it works with Mys v1.3.4 as well!
Reply With Quote
Reply

Thread Tools
Display Modes

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Avatar uploading MikiHeart Feedback and Suggestions 11 11-13-2013 05:38 AM
Easy way to put user's avatar on any page Derpstra Tutorials and Tips 0 08-20-2012 04:05 PM
Memberlist (user avatar) Alaric Questions and Supports 6 06-01-2012 02:28 AM
Avatar system AlkseeyaKC Suggestions and Feature Requests 1 01-14-2012 07:38 AM
User name and avatar RoconzaArt Questions and Supports 8 03-15-2011 10:02 AM


All times are GMT -5. The time now is 07:03 AM.

Currently Active Users: 455 (0 members and 455 guests)
Threads: 4,080, Posts: 32,024, 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 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636