#00AF33
Official Code Helper
19529
0
1
Nov 19, 2012 14:18:28 GMT -8
Todge
**
17,324
January 2004
todge
|
Post by Todge on Mar 8, 2014 12:04:44 GMT -8
Is it possible to find out a thread ID BEFORE it is created?
As in, from the new_thread page, is it possible to find out what the thread ID will be BEFORE the Create Thread button clicked?
|
|
inherit
King Oligochaete
126470
0
Feb 24, 2021 12:23:15 GMT -8
Wormopolis
Stop rating plugins with 1 star that dont deserve it.
20,002
June 2008
tbserialkillers
Wormo's Mini-Profile
|
Post by Wormopolis on Mar 9, 2014 1:04:49 GMT -8
not that I have found. it doesnt get assigned until the POST gets sent, thats why the key API has set_on commands.
I could be wrong though...
|
|
#00AF33
Official Code Helper
19529
0
1
Nov 19, 2012 14:18:28 GMT -8
Todge
**
17,324
January 2004
todge
|
Post by Todge on Mar 9, 2014 4:43:10 GMT -8
That's what I assumed too, hence this question.
I'm trying to use the set_on command to set a super forum key, and I need to add the new thread's ID to it, hence the question. As new threads are 'ID'd' incrementally I could use the key to keep track of new threads and update automatically, but that's asking for trouble, and I'd rather not add another mouse click to set it.
|
|
inherit
King Oligochaete
126470
0
Feb 24, 2021 12:23:15 GMT -8
Wormopolis
Stop rating plugins with 1 star that dont deserve it.
20,002
June 2008
tbserialkillers
Wormo's Mini-Profile
|
Post by Wormopolis on Mar 9, 2014 8:07:21 GMT -8
sending a PM
|
|
inherit
The Dream Crusher (Ret.)
164921
0
Apr 1, 2014 11:00:25 GMT -8
Tim Camara
Teach a man to fish, etc., etc.
1,721
March 2011
tcamara
|
Post by Tim Camara on Mar 10, 2014 8:09:51 GMT -8
not that I have found. it doesnt get assigned until the POST gets sent, thats why the key API has set_on commands. Wormopolis is correct, we don't assign the ID until the thread/post/etc. is created. I'm assuming you're trying to use the not-yet-created ID as part of a key rather than by itself, so I see how using set_on may not be a viable option. I went ahead and added a task to our system to look into various ways of incorporating better functionality into the set_on hooks, to provide greater flexibility in these situations. (Also, if you have any ideas on implementation, leave 'em here for consideration, currently I'm thinking passing in an anonymous function and a key to a set_on call)
|
|
#00AF33
Official Code Helper
19529
0
1
Nov 19, 2012 14:18:28 GMT -8
Todge
**
17,324
January 2004
todge
|
Post by Todge on Mar 10, 2014 11:54:33 GMT -8
Yup, I would like to write the new thread's ID to the key when the thread is created. Which I obviously can't do.
Having the latest thread ID in pb.data may not help either, as threads could be created while you're looking at the thread creation page. Would it be possible to have a kind of 'set_after' type thing, to set the key directly after the thread has been created instead?
|
|
inherit
The Dream Crusher (Ret.)
164921
0
Apr 1, 2014 11:00:25 GMT -8
Tim Camara
Teach a man to fish, etc., etc.
1,721
March 2011
tcamara
|
Post by Tim Camara on Mar 10, 2014 14:25:17 GMT -8
Would something like this work?
pb.plugin.key('test_key').set_after(hook, action, [object_id], [value]); where: - hook is the same as the set_on hook (e.g., the form that's being submitted) - action is one of the existing key operations (push, pop, shift, unshift, increment, decrement, append, prepend, set) - object_id is an optional param that specifies the key's ID (would use the newly created item's ID if it doesn't exist) - value is an optional param that specifies the value to use in the action (would use the newly created item's ID if it doesn't exist)
It obviously still has some limitations, but other than giving people access to execute code on the server (which just isn't happening), I can't see a way to make it more flexible than this.
|
|
inherit
2671
0
May 14, 2013 14:40:03 GMT -8
Peter
🐺
10,615
February 2002
peter3
|
Post by Peter on Mar 10, 2014 14:42:42 GMT -8
Tim Camara, I think that's fine. I just appreciate that you are even implementing some of these things for us, as it opens up doors for new plugin ideas.
|
|
#00AF33
Official Code Helper
19529
0
1
Nov 19, 2012 14:18:28 GMT -8
Todge
**
17,324
January 2004
todge
|
Post by Todge on Mar 10, 2014 16:01:07 GMT -8
That looks good to me too.
So, using that syntax..
pb.plugin.key('test_key').set_after('thread_new', 'push', pb.data('route').params.thread_id);
should add the new thread ID to the current plugin's content, yes?
|
|
inherit
The Dream Crusher (Ret.)
164921
0
Apr 1, 2014 11:00:25 GMT -8
Tim Camara
Teach a man to fish, etc., etc.
1,721
March 2011
tcamara
|
Post by Tim Camara on Mar 11, 2014 8:21:19 GMT -8
Yeah, that would do it. Although in thinking about it, I would probably make the input to the set_after action a hash rather than hardcode the options, that way it's easy to specify a value without specifying an object_id.
|
|
inherit
King Oligochaete
126470
0
Feb 24, 2021 12:23:15 GMT -8
Wormopolis
Stop rating plugins with 1 star that dont deserve it.
20,002
June 2008
tbserialkillers
Wormo's Mini-Profile
|
Post by Wormopolis on Mar 11, 2014 9:02:36 GMT -8
is there an update on where on the list "set_on_edit" lies? to refresh your memory, that was the method to update a key on a post/profile edit to overcome the webkit bug of not allowing AJAX to happen when a form was submitted.
|
|
inherit
The Dream Crusher (Ret.)
164921
0
Apr 1, 2014 11:00:25 GMT -8
Tim Camara
Teach a man to fish, etc., etc.
1,721
March 2011
tcamara
|
Post by Tim Camara on Mar 11, 2014 9:51:02 GMT -8
Okay, it took me way too long to remember what that was. That'll most likely happen at the same time as we implement the set_after function. The list of requests for plugin and key related functionality is quite long at this point, but those are (I think) about third in line, under making plugins run on error pages and the function to pull specific member data. As for where it falls in the overall list, that's a bit harder to say. Obviously the majority of our time is being spent on the big secret new project, so new feature development has slowed to a bit of a crawl. That being said, I'm personally anxious to get back to fixing up the plugin and library stuff, so I wouldn't expect it to be too much longer.
|
|
inherit
217348
0
Jul 27, 2022 7:26:44 GMT -8
Lynx
5,846
January 2015
msg
|
Post by Lynx on Sept 2, 2020 18:41:40 GMT -8
I just came across this old thread - so my apologies for necro'ing a 6-year old thread ... but, was set_after ever implemented, or is it something that will (hopefully) come with V6?
|
|
#00AF33
Official Code Helper
19529
0
1
Nov 19, 2012 14:18:28 GMT -8
Todge
**
17,324
January 2004
todge
|
Post by Todge on Sept 3, 2020 3:47:29 GMT -8
I just came across this old thread - so my apologies for necro'ing a 6-year old thread ... but, was set_after ever implemented, or is it something that will (hopefully) come with V6? Fingers crossed, it will be included with the V6 updtate, unfortunately I never heard anything about the set_after function after this, so I assume it was never implemented.
|
|
inherit
217348
0
Jul 27, 2022 7:26:44 GMT -8
Lynx
5,846
January 2015
msg
|
Post by Lynx on Sept 3, 2020 10:22:49 GMT -8
I just came across this old thread - so my apologies for necro'ing a 6-year old thread ... but, was set_after ever implemented, or is it something that will (hopefully) come with V6? Fingers crossed, it will be included with the V6 updtate, unfortunately I never heard anything about the set_after function after this, so I assume it was never implemented. Thanks for the reply, Todge! Maybe I can give Matej a nudge and see if they know.
|
|