inherit
237657
0
Oct 14, 2020 8:58:28 GMT -8
CrushyGreenRen
12
September 2016
itscgryt
|
Post by CrushyGreenRen on Apr 8, 2020 21:08:15 GMT -8
Hello again. I would like to ask how would I go trying to implement a feature where members are able to set their own banners in their threads (in specific boards). I run a test forum before changing the forum I would like to make changes on. Please pardon the silly images. Currently, I have this. I do not know Javascript that much so I just search up things (i know, nasty).
In the forum, we have Wormopolis' Custom Thread Titles plugin for both forums, and an edited version of Retread 's Remove MP from First Post plugin in the test forum in order to achieve this "mod banner" effect.
My first thought was to try editing the first plugin (CTT) in order for both thread list and thread banner to use the same picture, but since the author decided to not make it editable, I tried another thread description plugin (PBMetaDescriptions by Phil) but I don't know Javascript enough to grab data from other plugins and use their values.
So my question is: How would I go allowing members to set their banners without having staff to edit the plugin?
Side question: Is there also a way to make the banner look different if a member hasn't set a banner image?
|
|
inherit
2671
0
May 14, 2013 14:40:03 GMT -8
Peter
🐺
10,615
February 2002
peter3
|
Post by Peter on Apr 9, 2020 1:48:22 GMT -8
So I think the best thing to do when creating a plugin, is to try and break down each part of it. Here is maybe how I would go about developing this plugin.
- Thread key used to store the banner data (URL, or an id from a select list of allowed banners). - Board checking to prevent banners being used in specific boards (route check + plugin settings). - When the user creates the thread (check route), show either a field for them to enter the URL, or a drop down list of allowed banners to select from. - When user submits the thread (check route), save the data into the key. - On thread view (check route), see if there is key data for the thread, if so, display the banner where you need it. - On thread view (check route), if there is no thread data, then display a default banner of your choice. - On thread edit (check route), allow the user to modify the banner.
It's a pretty simple plugin, you need to learn a few things first:
- Reading settings: Plenty of posts on how to grab your settings data from the plugin, or there is a book (see sticky) that covers everything about that. - Routes: pb.data("route") contains good data to determine if we are viewing a thread and what the thread ID is. - Setting keys: There is plenty of posts and a book (see sticky) that covers keys in very good detail. - Manipulating the DOM: This is basic JavaScript using selectors to target / find specific elements. - XSS: If custom URL can be entered, then make sure it is safe to be used when writing to the page (i.e src attribute).
|
|