Support Forum

Understanding Blog Linking

CA Chris_Andrews
Chris_Andrews
Member

Oh, there are many in and outs to this 🙂 

I’ve been reading the codex – do I understand correctly that the Simple-Press forum (topic view) doesn’t actually appear on the wp post page (the article)? I continue to use my normal commenting plugin?  

It’s just that comments are added to the forum and forum posts are added to the comments in the database? 

Is there any way to link already existing posts and their comments? I have some older content I would love to link.

28 Answers

New Answer

YS Yellow Swordfish
Yellow Swordfish
Member

Chris_Andrews said
Oh, there are many in and outs to this 🙂 

I’ve been reading the codex – do I understand correctly that the Simple-Press forum (topic view) doesn’t actually appear on the wp post page (the article)? I continue to use my normal commenting plugin?  

Currently this is correct. You can turn off the commenting options in WP and force the forum to replace it but that will, of course, effect old posts as well so is probably not desirable. We do have a plugin in test that will use the forum to replace the comments (currently being used on our site here) but again – this will only work with already and current blog linked topics.

It’s just that comments are added to the forum and forum posts are added to the comments in the database? 

Yes if that is the option you have set in the blog linking options (in Components section).

Is there any way to link already existing posts and their comments? I have some older content I would love to link.  

Not yet I am afraid. It is on the road map for a future enhancement but that could, I am sorry to say, be a good while off.

CA Chris_Andrews
Chris_Andrews
Member

An importer would be really great. 

In the meantime, I wonder if I could do it manually? I’ll have to dig through the database and try to figure that one out 🙂 

MP Mr Papa
Mr Papa
Member

you can manually go through each wp post and edit it, and at the bottom link it to a forum…

I doubt (though could be wrong) if you are mapping comments to forum replies, that any comments will get carried over… but the linked topic will get created…

CA Chris_Andrews
Chris_Andrews
Member

I’m circling around back to this…

What I would like to do is import my existing published posts into the blog linking, so they show up in the forum, with existing comments. 

First step would be linking so that the old posts show up in the forum, correct? 

As a test I inserted a row into the wp_sflinks table using some new entries as an example, but they did not show up on the forum. So I’m thinking another table most be involved as well. 

Do you have any guidelines on doing this? 

After I get the linking in place, I’ll need to import the existing wordpress comments into simplepress, so thoughts and guidelines on doing that would be great as well 🙂 

My ultimate goal is to have simplepress as both a commenting and forum solution. The forum topic would appear on the article page and readers could read comments and comment there, or they could be in the forum and read/comment there. I know there will be duplicate content of sorts, but I have both a news site and a forum and want them tied together, and I’m not all that concerned over having duplicate content search engine wise. 

CA Chris_Andrews
Chris_Andrews
Member

Ok, looks like I’ll need to import my existing posts into wp_sfposts for them to show up in the forum, the sflinks must be just for the actual hyperlink to the forum topic.

MP Mr Papa
Mr Papa
Member

not sure I follow…  you have a bunch of wp blog posts…  you want to created linked topics, right?

you should be able to edit the wp blog post and just link it at the bottom with the create linked topic section… 

just not sure it will find all the comments – suspect not…  but that would be good start, I think…

importing blog posts into sfposts will be very fragile… you have to have the forum, the topic and then the posts… and some ancillary stuff needs updating…  would not recommend this path…

CA Chris_Andrews
Chris_Andrews
Member

Yep, thank you, updating the post with the link options does work, just time consuming for 5000 posts, so I’ll pick and choose some for now 🙂 

I’m going to need to preserve the post published time though. I have old posts that still get comments and I’d like them to be in the forum…. but if I just update the wp post with the link options, the forum timestamps it at the time I linked it. So if I have a year old post and link it, it looks like it’s just been published in the forum and is fresh content. It really needs to be backdated to a year ago so it’s clear when the original post was published and is in the correct order, time wise, in the forum.

hmm, any thoughts on that?  I looked and don’t see a setting that would adjust that value,

Chris

MP Mr Papa
Mr Papa
Member

glad to help…  afraid no direct setting to change the time…

if you wanted to write a small plugin (or bit of code in your spFunctions.php file) to hook into the blog linking creation process, you might be able to use one of our filters (such as sph_new_topic_pre_data_saved) and update the new topic date to what you want it to be…

CA Chris_Andrews
Chris_Andrews
Member

Slightly beyond my capabilities at the moment…. but not way beyond, maybe I can figure it out 🙂  I’ll be working on this but may be back with questions 🙂 

MP Mr Papa
Mr Papa
Member

Happy to help too. Hope to try the basics soon. Just bad timing with Andy on vacation and me moving this weekend. 

CA Chris_Andrews
Chris_Andrews
Member

Moving, what fun! I’ve been doing a lot of that over the last 6 months, our house was totaled in hurricane matthew and we are rebuilding. Both moving ourselves and helping friends. If I was in your area I’d be happy to come help there too 🙂 

Looking at the code, but not really familiar with hooks and all, it seems like I should be able to temporarily hack sp-linking-support.php and do something like this to add my old posts in with the original publication dates:

Didn’t work though…

////////////////////////////////////

function sp_do_linking_update_blog_post($newpost) {
global $wpdb;
$ID = sp_esc_int($newpost[‘blogpostid’]);
$postcontent = $newpost[‘postcontent’]; # it comes here already filtered
spdb_query(“UPDATE “.$wpdb->prefix.”posts SET post_content = ‘$postcontent’

//post_date = the_date() //didn’t work
//post_date = ‘2016-05-20 11:05:19’ //for testing, didn’t work

WHERE ID = $ID”); }

MP Mr Papa
Mr Papa
Member

well, that couldnt work, because its updating a linked forum topic… in your case, the topic doesnt exist yet..  you would want the routine where the topic is created…  that would be sp_publish_blog_link()…

then in that routine, use the $post->post_date or $post->post_date_gmt to get the blog post date…  and then try setting $p->newpost[‘post_date’] equal to that blog post date…  if your timezone matches the server timezone, think the dates will be fine… but have not tried this…

CA Chris_Andrews
Chris_Andrews
Member

Sorry, it’s over my head…

Do you mean something like this? 

 ———

$p->newpost[‘forumid’] = $forumid;
$p->newpost[‘forumslug’] = $forumslug;
$p->newpost[‘topicname’] = sp_filter_title_save($post->post_title, SFTOPICS, ‘topic_name’);
//added
$p->newpost[‘post_date’] = $post->post_date;

 ———

That didn’t seem to make it into the sql, still uses current date…

MP Mr Papa
Mr Papa
Member

will try to look further tonight (but moving to new house so may be hard)…  I think you want to do the setting of the date later…  in its own query..  or just before the saveData call for the post class…