MyBB Community Forums
How would I go about making a user script? - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Extensions (https://community.mybb.com/forum-201.html)
+--- Forum: Plugins (https://community.mybb.com/forum-73.html)
+---- Forum: Plugin Support (https://community.mybb.com/forum-72.html)
+---- Thread: How would I go about making a user script? (/thread-206571.html)



How would I go about making a user script? - HelloPookie - 2016-12-11

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?


How would I go about making a user script? - Matt - 2016-12-11

Moved to Plugin Support.


RE: How would I go about making a user script? - HelloPookie - 2016-12-13

Thanks for moving the thread. Wasn't sure exactly where it should go.


RE: How would I go about making a user script? - Whiteneo - 2016-12-13

There are many awards plugins

What plugin do you have ?


RE: How would I go about making a user script? - HelloPookie - 2016-12-14

(2016-12-13, 09:46 PM)Dark Neo Wrote: There are many awards plugins

What plugin do you have ?

It's called myAwards .


RE: How would I go about making a user script? - Whiteneo - 2016-12-14

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.


RE: How would I go about making a user script? - fizz - 2016-12-14

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


RE: How would I go about making a user script? - HelloPookie - 2016-12-15

(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


RE: How would I go about making a user script? - fizz - 2016-12-15

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.