Support Forum
Hey All,
I'm not quite sure how this would work but I'm trying to call the api from a standalone page and do the following:
Check if current user has posted in subforum "autoposts"
If they haven't got a post in that subforum with the title: "Username's Set" then it needs to create a post with that title and post the contents of $postcontents to it.
If they have got a post in that subforum with the title: "Username's Set" then it should reply to that topic with the replies post content being $postcontents.
That's it, pretty simple but I can't work it out, I've found sph_post_create and I've had a look under spFunctions.php but nothing helps :/
Any ideas?
not exactly sure what you want to do, but lets try breaking into pieces and build up to it... so first, how to check if user has posted in forum 'autoposts'...
no api per se, but you can query the db:
sp_forum_api_support(); # lets load some more api stuff global $spThisUser; # access current user $data = spdb_query('SELECT * FROM '.SFPOSTS." WHERE user_id=$spThisUser->ID AND forum_id=x"); # replace x with appropriate forum id if ($data) { # user has posted in forum } else { # user has not posted in forum }
and let me suggest some reading for creating a forum post... you will want to use our post class.. just instantiate it, fill it with data and submit...
Take a look at the our sp-post.php file in simple-press/forum/library... will give you example of using the class... or for more focused, smaller example, see
post multiple plugin, file post-multiple/library/sp-post-multiple-components.php around line 104
blog linking plugin, file blog-linking/library/sp-linking-blog.php around line 108
for a couple of examples of plugins we use the post class... there are more too if you search for "= new spPost"
so get started and come on back with any more questions...
Visit Cruise Talk Central and Mr Papa's World
requirements checks for pemissions will be in force... you can bypass those by using hooks... or posting as an admin, then changing the poster after creating it...
Visit Cruise Talk Central and Mr Papa's World
1 Guest(s)