inherit
229025
0
Nov 14, 2023 7:52:45 GMT -8
bigwoot
9
February 2016
bigwoot
|
Post by bigwoot on Jun 26, 2016 10:37:50 GMT -8
I need to dynamically create a new thread and post in a specific board. Currently we have to copy and paste game rankings from our stats page into new thread. I would like to do this via plugin or custom page (either way is fine but prefer custom page). I would also like to lock the thread when post is completed. I have looked at just about everything in forums but nothing stood out.
Is this possible and anyone know how to do it or where I need to look?
|
|
inherit
Official Code Helper
65613
0
1
Apr 15, 2024 17:01:41 GMT -8
Chris
"'Oops' is the sound we make when we improve"
8,870
December 2005
horace
|
Post by Chris on Jun 29, 2016 5:33:06 GMT -8
Not quite sure what you are requesting here, are you asking for a plugin to auto-fill the post for you with some sort of data stored elsewhere?
|
|
inherit
229025
0
Nov 14, 2023 7:52:45 GMT -8
bigwoot
9
February 2016
bigwoot
|
Post by bigwoot on Jun 29, 2016 6:04:20 GMT -8
Thank you for responding. I figured out how to do what I needed using javascript:
windows.location = "/board/1/boardname" followed by window.location = "/thread/new/1";
This automatically starts new thread in desired board. We still have to paste data in but that's OK. If there is a BETTER way (more in-line with proboards methods), please let me know.
Again THANKS!!!
|
|
inherit
Official Code Helper
65613
0
1
Apr 15, 2024 17:01:41 GMT -8
Chris
"'Oops' is the sound we make when we improve"
8,870
December 2005
horace
|
Post by Chris on Jun 29, 2016 6:10:39 GMT -8
Where is the data coming from is what I am asking, how is this data that is being pasted being fetched?
|
|
inherit
229025
0
Nov 14, 2023 7:52:45 GMT -8
bigwoot
9
February 2016
bigwoot
|
Post by bigwoot on Jun 29, 2016 7:38:44 GMT -8
I query our stats server using jQuery/Ajax, parse the returned XML into an array, build the BBCode for a table tag using the array, put that string in a texarea tag, then using javascript copy it to clipboard (user must click copy button). When user clicks copy button, data is put on clipboard, location is changed to desired board and new thread is started. User can now paste into new thread.
EDIT: Love your avatar!
|
|
inherit
Official Code Helper
65613
0
1
Apr 15, 2024 17:01:41 GMT -8
Chris
"'Oops' is the sound we make when we improve"
8,870
December 2005
horace
|
Post by Chris on Jun 29, 2016 8:18:28 GMT -8
Thanks So the process of converting the XML response to a BBCode table is done programmatically or by manual input? Does the user choose the board in which to post or is this based on the returned data or some other criteria? Is the endpoint url you use to grab the stats something you want everyone to see (and maybe [ab]use for their own purposes) or are you concerned with keeping it somewhat private? Is everyone able to use this feature or just a select few (e.g. just staff)?
|
|
inherit
229025
0
Nov 14, 2023 7:52:45 GMT -8
bigwoot
9
February 2016
bigwoot
|
Post by bigwoot on Jun 29, 2016 9:17:02 GMT -8
Thanks So the process of converting the XML response to a BBCode table is done programmatically or by manual input? Does the user choose the board in which to post or is this based on the returned data or some other criteria? Is the endpoint url you use to grab the stats something you want everyone to see (and maybe [ab]use for their own purposes) or are you concerned with keeping it somewhat private? Is everyone able to use this feature or just a select few (e.g. just staff)? 1. The process is all done by code except pasting into new thread. Would love to be able to paste from code but the code is opening another location so JS goes away therefore does not know when the new locations document is ready.
2. The board to be posted to is always the same (selected in code based on which stats where copied or more specifically, which copy button was clicked). Could be as many as 4 different textareas with copy button below each.
3. No one has direct access to the endpoint url. It is an API that queries a database located on the gameMe Stats server.
4. Only a select few upper admins have access to this feature.
|
|
inherit
Official Code Helper
65613
0
1
Apr 15, 2024 17:01:41 GMT -8
Chris
"'Oops' is the sound we make when we improve"
8,870
December 2005
horace
|
Post by Chris on Jun 29, 2016 10:14:20 GMT -8
You don't have to do the two-step since the board identifier is already in the create thread url is basically saying to create a thread in the board that has the id of "1". You can do the hustle and also add the subject and message to the url so it is already filled in when the user gets there, for example would create a new thread in board 96 ("Plugin Development" on this forum) with the subject and message prepopulated. ( try it ) Can you use this to pass your values without requiring user to carry over through copy and paste?
|
|
inherit
229025
0
Nov 14, 2023 7:52:45 GMT -8
bigwoot
9
February 2016
bigwoot
|
Post by bigwoot on Jun 29, 2016 11:15:01 GMT -8
Yes, I can use this to pass values without copy/paste! EXACTLY what I needed ... THANKS!
|
|
inherit
Official Code Helper
65613
0
1
Apr 15, 2024 17:01:41 GMT -8
Chris
"'Oops' is the sound we make when we improve"
8,870
December 2005
horace
|
Post by Chris on Jun 29, 2016 11:33:31 GMT -8
You're welcome.
As for the automatic locking of threads you can also append "&lock=1" to the resulting url but that would depend on whether the user making the post has the ability to lock the thread to begin with. Also it is a good idea to use encodeURIComponent() when adding the table markdown to the url since some browsers might balk at invalid characters.
|
|
inherit
229025
0
Nov 14, 2023 7:52:45 GMT -8
bigwoot
9
February 2016
bigwoot
|
Post by bigwoot on Jul 4, 2016 5:50:09 GMT -8
Everything is working as I needed. Is there something I can add that will "Create Thread" (equivalent to clicking "Create Thread" after inserting string)? That is: /thread/new/96/?subject=test&message=[table][tr][td]test[/td][/tr][/table]&lock=1 &createthread
Here is the actual code as it is now:
var postStr = "?subject=" + encodeURI("Congrats " + topPointsName + " - 50K Winner") + "&message=" + encodeURIComponent(sendPoints); window.location = "/thread/new/" + boardNumber + postStr + "&lock=1";
|
|
inherit
217348
0
Jul 27, 2022 7:26:44 GMT -8
Lynx
5,781
January 2015
msg
|
Post by Lynx on Jul 4, 2016 6:19:41 GMT -8
Plugins are not allowed to automatically create threads in that fashion. It would be a violation of ToS and Plugin Developer Guidelines. The Create Thread button will still have to be manually clicked.
|
|
inherit
229025
0
Nov 14, 2023 7:52:45 GMT -8
bigwoot
9
February 2016
bigwoot
|
Post by bigwoot on Jul 4, 2016 6:40:36 GMT -8
This isn't a plugin - custom page but I suspect same applies.
THANKS ... Good to know.
|
|