Support Forum
Ok, this has taken me forever to get to...
A while back I copied all my articles that included comments over to the forum as forum posts. ( https://simple-press.com/suppo.....g-linking/ )
Now, I'd like to move the comments that are on those articles over to the forum, so I have posts and comments on the forum.
I'm thinking I need to do something along these lines, but I'm not fluent enough in php/mysql to write it myself (probably could, but it would take me another three months!).
--------------------------
grab row from wp_comments
//hold that info in array as a var
//pull out comment_post_ID as a var
from table wp_sflinks get forum_id and topic_id where post_id = comment_post_ID
//hold forum_id as a var
insert into wp_sfposts
post_id //needs to increment from previous existing
post_content // comment_content from wp_comments
post_date //comment_date from wp_comments
topic_id // topic_id from wp_sflinks
user_id //user_id from wp_comments
forum_id //forum_id from wp_sflinks
guest_name //comment_author from wp_comments
guest_email //
post_status //
post_pinned //
post_index //hmmm, need to increment from the previous with the same topic_id, maybe make this whole thing a while statement (while comment_post_ID loop through rows and increment this?)
post_edit //
poster_ip //
comment_id //
source //
//need to put a limit on the script so it doesn't crash server trying to move 5000+ comments.
Is there anyone available to write this? Not sure I have all the working parts in place, so it will have to be thought out to make sure.
***
News For Shoppers is seeking consumer reporters,
consumer advocates, and entertainment writers:
visit: NewsForShoppers.com/write/
You are OK up to the part where you want to create the new forum data - i.e, the post record. There is a little more to it than just writing to the one table.
i would suggest you take a look at the code file /simple-press/forum/library/sp-post.php. This sets everything up to create a new topic and/or post record. It goes through the major steps for you. If you check the data requirements you will be able to trace through the new post action.
This code obviously uses POST variables but it should be pretty straightforward to adapt it for, say, using an AJAX call for each record. That gets you over the timeout issue as well of course. The main thing is to fill the required values and then pass control over to the post class.
Could we do it? I have to say straight off that certainly not very quickly or soon...
YELLOW
SWORDFISH
|
Thank you... are there any freelancers that know SP well enough to do this that you would recommend?
***
News For Shoppers is seeking consumer reporters,
consumer advocates, and entertainment writers:
visit: NewsForShoppers.com/write/
I'm sorry - but to be perfectly honest I do not know anyone. We always hoped that one or two people might materialise and we do know that some people do perform some customisation work on their own site, but we have never been asked to keep anyones name for such queries.
YELLOW
SWORDFISH
|
I'm looking through simple-press/forum/library/sp-post.php but don't see what data I need to put into what tables. I see the validation checks, and then the part where it says it is saving to the database, but not what data is being added to what tables....
Still studying it -
***
News For Shoppers is seeking consumer reporters,
consumer advocates, and entertainment writers:
visit: NewsForShoppers.com/write/
You would need to look at the sp-api-class-post.php file (in sp-api folder) - at the top are the variable declarations that make up the 'newpost' array.
YELLOW
SWORDFISH
|
Actually forget that - I am being dumb.
Open up the file /librtary/sp-linking-comments.php.
Find the function sp_create_post_from_comment().
That function does what you want to do - saves a comment as a forum post. You wont be able to call it as is but you should be able to rewrite for your requirements.
YELLOW
SWORDFISH
|
That function almost looks like if I made an edit in a comment it should add that comment as a post to the forum if it's linked.
I edited a comment (from the wp admin) and it didn't do anything though....
On a larger scale, I was wondering if I could 'trick' the script into thinking a number of comments were edited so I could enter a bunch at a time.... just brainstorming since I don't quite understand the code enough to really know what it's doing. I'm picking through it though and may be able to figure it out -
***
News For Shoppers is seeking consumer reporters,
consumer advocates, and entertainment writers:
visit: NewsForShoppers.com/write/
Opps, I was looking at the function that followed the one you mentioned when I wrote that - sorry, don't think that applies.
***
News For Shoppers is seeking consumer reporters,
consumer advocates, and entertainment writers:
visit: NewsForShoppers.com/write/
you dont think the function Andy provided will work??
Visit Cruise Talk Central and Mr Papa's World
1 Guest(s)