MyBB Community Forums

Full Version: How would I go about making a user script?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm interested in making a user script that allows users to re-arrange their awards on forums that use the myAwards plugin so that they can see the changes, and anyone else with the script can see the changes.

I'm not looking for step by step, just a point in the right direction. Is something like this even possible?
Moved to Plugin Support.
Thanks for moving the thread. Wasn't sure exactly where it should go.
There are many awards plugins

What plugin do you have ?
(2016-12-13, 09:46 PM)Dark Neo Wrote: [ -> ]There are many awards plugins

What plugin do you have ?

It's called myAwards .
Where did you get it ?

Do you have any preview ?

There are no plugin with that name here, so we hace todo know where fid you get the file.
When you say rearrange do you mean an actual like click and drag and have them all shuffle around the screen? Or do you want sort of a simple grid where they can click up/down/left/right on each award kinda thing
(2016-12-14, 02:53 AM)fizz Wrote: [ -> ]When you say rearrange do you mean an actual like click and drag and have them all shuffle around the screen? Or do you want sort of a simple grid where they can click up/down/left/right on each award kinda thing

Simplicity is fine. Even if it were just a plain-text list. I just want users to be able to re-arrange the awards.

(2016-12-14, 02:28 AM)Dark Neo Wrote: [ -> ]Where did you get it ?

Do you have any preview ?

There are no plugin with that name here, so we hace todo know where fid you get the file.

http://www.mybbcentral.com/thread-8418.html
Shouldn't be too hard then, but it won't be a little 10 minute edit either. Here's how I'd do it (admittedly with no knowledge of how MyAwards actually displays the awards):
Create a new column in the users table, call it myawards_order or something similar and make it a VARCHAR. This column is going to store a comma (or whatever delimiter you want) separated list of the award order by award id. You'll then need to modify MyAwards to display user awards in the order of the myawards_order column.

As far as the user's ability to edit the order, I'd probably just make a new page that links from the MyAwards page or usercp, whichever is more convenient/more obvious to the user. The absolute simplest way would be to display all of their awards with the appropriate award ID next to them, and have the user fill in a simple text box with a comma separate list of the ids in the order they want and submit that. Take that input, sanitize it obviously, do basic validation to make sure its all numeric and all the awards exist and belong to the user, and throw it in the db and give em a simple success/fail message.