Pick 3 badges you're proud of to show with each post
Hi!
I was brainstorming with some friends about the badge system. I did install the plugin that shows all badges next to your name on every post. But would it be possible to make someone select up to 3 badges and display those next to the posts they make?
Would that even be possible? Or would it be a lot of coding. I'm a wordpress guy and just dove in Vanilla. Not even that much of a Wordpress developper but I know about the hooks and with some googling I was able to make some simple changes to plugins.
Before I'm going to start pouring time in trying to make this work, I was wondering if you, more experienced coders with Vanilla, would reckon if it was possible or not.
Thinking out loud, I'd guess I would start off with making three pull down menu's that get added at the user profile. That way they can select the 3 badges they would like to show off. And then somehow, I need to retrieve the 3 selections they make and let that show up with every post.
I guess it would add a lot of work for the server tho, retrieving those badge selections with every post... Is that correct as well?
Comments
Check this out:
http://vanillaforums.org/addon/symboledit-plugin
Thanks! I'll check it out!
Hmmm! The disadvantage of that plugin is that the images get picked from a folder rather than check if a user has "unlocked" the badge. But its a good start ^_^
Sure it is possible. Here is how I would do it:
1. search a plugin that builds an profile settings screen to see how this works (I have done that before but do not remember which plugin that was)
2. Take that plugin as a start and build a profile setting page. In class.form.php there are some really useful functions. I think using CheckBoxList would be a start. If you are using checkboxes, you should create a script that ensures that only 3 items will be checked. The UI question is up to you. I'm not good at that.
3. Save that array in the user tables Attributes column
4. Look at that plugin to find out how to get badges http://vanillaforums.org/discussion/26835/possible-to-show-only-the-last-3-badges#latest
5. Look at plugins that insert information right at the place you want to see it or use the plugin Eventi to find it out yourself.
6. Ask for help whenever you get stuck
This could be a really cool plugin reminiscent of steam's community profile page. Bookmarking for exploring when I have more time and Yaga is 1.0.
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
Thanks RJ! I'll try to look in to that this week and see if I can persuade my programmer friend to help me out gehehe.
@hgtonight cool! Curious to see how you will implement it
I've started work on this for a days (nothing to do at work
) and I did manage to get all the badges a person has earned, displayed on a menu in the edit profile area.
But, to try and get them to save from there seemed like a tough job. So right now I have settled to remodel the Symbol Edit plugin to be able to at first, display 1 chosen badge.
Right now I've got the pull-down menu filled with the last badge. I'm stuck on how to get all the badges in an array, that can be used to populate a pull down menu, The commented out code showed all the badges a user unlocked. But somehow, it does not work like this for a pull-down menu. I'm guessing it has to do with the fact that the pull-down menu is generated after the foreach did its magic.
Any tips or pointers?
`<?php if (!defined('APPLICATION')) exit();
<?php echo $this->Form->Close(T('Save')); ?>`
Oh woeps that was easy :P Fixed.
That's a really cool idea because it would increase investment in your achievements on the forum. However doing this UI well would be really challenging.
Right now, I'm going to make it so that there are 3 pulldown menu's. Not the best way to do it, but its something that I can pull off I think. As it is literally modding the symboledit plugin. I hope I can let the plugin check if theres a badge that is selected in more than one menu and give a message about that.
I think the ideal way would be to have all your badges appear with a checkbox in front of them (showing the name and possibly the description only) and check 3 that you want to display.
look at the ignore plugin as well. it will give you some ideas - using profile and selecting things.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
What about something like that with a little drag&drop magic?
Would be even more awesome, but even more complicated for me to build.
Right now I've got one pull-down menu, that will output badge names for the user, and stores the badge id in a table in the database when saving.
To get it to work, now I need to change this, which displays all awarded badges with a forum post:
To a code that looks at the badge ID number from the pulldown menu, and only outputs that specific badge. Nearly there!! But I just cant wrap my head around it yet gehehe.
[edited]
please see below
SaYou can look up those functions here:
https://github.com/vanilla/vanilla/blob/2.1/applications/dashboard/models/class.usermodel.php#L2919
https://github.com/vanilla/vanilla/blob/2.1/applications/dashboard/models/class.usermodel.php#L2841
Having said that, I've looked myself and saw that I've done it wrong...
Thanks @R_J ! I already have the stored badge_id being returned.
I've got a collumn in the users database that stores the badge_id that I've selected.
Now I can bring the badge_id back with the variable: $SymbolUser
So what I need is a way to tell the Yaga::BadgeAwardModel(); to only show the badge, that corresponds with the badge_id that comes out of $SymbolUser.
Since there is not many Yaga plugins I hope I can find something that can get me going in the Yaga application. Or maybe, someone on here can give me some pointers
where? in the profile?
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
No in the post area.
The code I posted above, shows all the awarded badges. The first 4 lines do that. But I need to put something in that area, that only shows the Badge ID that corresponds with the one in the database and gets the correct url, id and name with the code below.
I think its something really basic, but I'm not that good of a programmer so I'm stuck right now :P Going to google some more and look through files while hoping one of you can help me out
you could get the array or badges from the Symbols (however you do it)
and just put an if $Badge in symbol array
depending on how you store the symbol badges by name or id in an array
get the symbolbadges names or ids and put it in $SymbolBadgesArray
echo...
otherwise don't.
or just
not sure where you are having problem or what you have got working or not.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.