PDA

View Full Version : Need some advice on CMS Article + Forum Comment Threads


Webbstre
01-14-2012, 06:38 AM
Ok, here's my situation. For the past year and a half I've been using Use Original Thread for Comments (https://vborg.vbsupport.ru/showthread.php?t=230417) to have a merged set of comments between my cms articles and their duplicates within my forums. I have two sets of news sub-forums (one for my site's news and one for the news of the games we cover).

If anyone knows how to make any of these options work, it'll make life much easier for me!

The problem is simple: I'm tired of having to make duplicate posts (via Promote to Article) for every news article. I'm tired of having to maintain two posts for every correction or typo or update that comes up. Yet I still want the convenience for my users to be able to view news from the forums, as many of them stick around in the forums.

I'm thinking about trying to make things simpler, in one of three ways:

1- Installing a new modification that will either make articles that will automatically make the appropriate "copy" comments thread in the forum it should be in (or if posted in the forums first, make the copy of the first post in the correct article section). I thought I had something with Article Forums (https://vborg.vbsupport.ru/showthread.php?t=237116), but that makes a different content type, not CMS articles. The problem here is I can't find a modification that actually does this.

2- Merge my two News Sub-forums, make it the default CMS Comments forum (and just accept that the first post won't look like the article and just be a link to the article), and Prefix the comments posts somehow so that it's obvious to users what kind of article it is. The problem here is that I can't find a way to merge two long-existing forums into one.

3- Make one of my news forums the default CMS Comments forum, and just manually move the comments thread whenever I have to post site news. The problem here is that if a comment thread is moved you become unable to see comment updates from the CMS section (though you can see it from within the forum).

--------------- Added 1326597356 at 1326597356 ---------------

Ok, I have an update on this with how I solved most of my problem, and just wanted to share, as well as ask for help on something hopefully simpler.

First, I found my solution in Number 2, listed above. I discovered that you can Mass Move Threads via the Admin panel, or in the admincp under Threads and Posts > Move. I solved my prefix problem by using Change Threads' Prefixes Inline (https://vborg.vbsupport.ru/showthread.php?t=227861), which requires one minor hook location edit to make work, but that's easy to do. I added prefixes to my news forum threads en mass, and then mass moved them all over. Then I changed my CMS Comments forum to point at my news forum. Now I only need to make a news post via the CMS, and it automatically makes the thread in my news forum. I just have to manually add a prefix to the comments thread, but that's easy enough.

Now I want to do two more things to make this perfect.
1- Stop the word "Article:" from appearing at the beginning of every comments thread.
2- Include a limited preview of the article within the first post of the comments thread. I see there's a way to make the full post show up (in a slightly limited manner) via Lynne's post here (https://vborg.vbsupport.ru/showthread.php?t=254333), but I really only want it to show the preview of the article, similar to the CMS homepage. It wouldn't need to have the thumbnails made though.

Webbstre
01-16-2012, 11:27 AM
Edit: I bumped it, then found the answer to half my problem! Here is how to remove or change the "Article:" from all CMS Comment Threads:

1- Go into admincp
2- Go to Languages and Phrases > Search in Phrases
3- Search for the word "Article:" (Without the quotes)
4- You should see "comment_thread_title" near the top
5- Edit it from saying "Article: {1}" to just "{1}" for all languages
6- You're done! This won't change any past comment threads though.

Now to just figure out how to make that first post show a preview of the article (but not the whole article)

Lynne
01-16-2012, 05:03 PM
Use My post here (https://vborg.vbsupport.ru/showthread.php?t=254333) and grab cms_article.previewtext instead of the pagetext.

Webbstre
01-17-2012, 12:09 PM
Thanks for the response Lynne! Unfortunately I'm not having any luck with it :( I get the asterisks, but nothing below it. I tried turning cms_article.pagetext to cms_article.previewtext, and tested a post, then tried changing all instances of pagetext to previewtext, but in every case I end up with an empty comments thread post below the asterisks.

...I know you said you're not providing support beyond the initial post, so should I go elsewhere for help? :/

Lynne
01-17-2012, 11:04 PM
What is your exact plugin code right now after the changes?

Webbstre
01-18-2012, 12:12 PM
Ok, here's what I've tried so far:

My first try, I used this:
if (THIS_SCRIPT == 'showthread' AND $this->thread['forumid'] == $this->registry->options['vbcmsforumid'] AND $this->post['postcount'] == 1) {

$result = $this->registry->db->query_first("
SELECT cms_article.previewtext, cms_article.threadid, cms_article.htmlstate
FROM " . TABLE_PREFIX . "cms_article AS cms_article
INNER JOIN " . TABLE_PREFIX . "cms_node AS cms_node ON (cms_node.contentid = cms_article.contentid)
INNER JOIN " . TABLE_PREFIX . "cms_nodeinfo AS cms_nodeinfo ON (cms_nodeinfo.nodeid = cms_node.nodeid)
WHERE cms_nodeinfo.associatedthreadid = ". $this->thread['threadid']. "
");

$bbcode_parser = new vBCms_BBCode_HTML(vB::$vbulletin, vBCms_BBCode_HTML::fetchCmsTags());

$pagetext = fetch_censored_text($bbcode_parser->do_parse($result['pagetext'],true,$result['htmlstate']));

$find = 'type="submit"';
$replace = 'type="submit" disabled';
$pagetext = str_replace ($find, $replace, $pagetext);

$result['previewtext'] = $pagetext;
$this->post['message'] .= '<br />*********<br />'. $result['previewtext'];
}

Then I tried changing all instances of pagetext to previewtext:
if (THIS_SCRIPT == 'showthread' AND $this->thread['forumid'] == $this->registry->options['vbcmsforumid'] AND $this->post['postcount'] == 1) {

$result = $this->registry->db->query_first("
SELECT cms_article.previewtext, cms_article.threadid, cms_article.htmlstate
FROM " . TABLE_PREFIX . "cms_article AS cms_article
INNER JOIN " . TABLE_PREFIX . "cms_node AS cms_node ON (cms_node.contentid = cms_article.contentid)
INNER JOIN " . TABLE_PREFIX . "cms_nodeinfo AS cms_nodeinfo ON (cms_nodeinfo.nodeid = cms_node.nodeid)
WHERE cms_nodeinfo.associatedthreadid = ". $this->thread['threadid']. "
");

$bbcode_parser = new vBCms_BBCode_HTML(vB::$vbulletin, vBCms_BBCode_HTML::fetchCmsTags());

$previewtext = fetch_censored_text($bbcode_parser->do_parse($result['previewtext'],true,$result['htmlstate']));

$find = 'type="submit"';
$replace = 'type="submit" disabled';
$previewtext = str_replace ($find, $replace, $previewtext);

$result['previewtext'] = $previewtext;
$this->post['message'] .= '<br />*********<br />'. $result['previewtext'];
}

...but they both had the same result:
You can view the page at http://test.mydomain.com/content.php?r=1281-Forum-Thread-Preview-Text-Test-2
*********

Thanks in advance for any help you can give me.

Lynne
01-18-2012, 06:36 PM
Ah, sorry about that - previewtext is actually only in there if a preview break was set. So, you need to see if it's NULL and if not, then you need to create it.

Webbstre
01-20-2012, 12:17 PM
Thanks for the help Lynne. I ended up giving up and using your original code for the full news posts. Originally I thought it was just going to post a copy of the news post in the first page of the comments, but now that I have seen it working I see it just draws directly from the CMS, which is better in any case! :) I was afraid I would have to maintain the preview post if I had to update it, so I wanted to keep it short, but it turns out I was trying something unnecessary.

Anyways, thanks again for trying to help. You're an awesome admin for vb.org :)