vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   Show Thread Enhancements - Show Full CMS Article in Comments Thread (https://vborg.vbsupport.ru/showthread.php?t=254333)

Morrus 06-02-2013 07:05 PM

This is great - been using it for a while. One issue is that inline image attachments do not show in the thread - you just get a URL link instead.

[Edit - ah, I see this has been mentioned plenty of times!]

RichieBoy67 06-05-2013 02:45 PM

I love this but am having a major issue.

I want to have certain article previews appear in other forums instead of the main forum but when I more the threads they automatically go back to default. Is there any way to get the previews to show in other forums as well?

After looking at the code I see I may be able add an array and list the forums but will this add a query for each forum I add for every page load or just when someone opens that forum? Will this change the forums the articles are posted in?

RichieBoy67 06-05-2013 02:49 PM

Quote:

Originally Posted by Lynne (Post 2141413)
That is because of the condition I have at the top:
Code:

if (THIS_SCRIPT == 'showthread' AND $this->thread['forumid'] == $this->registry->options['vbcmsforumid'] AND $this->post['postcount'] == 1)
I have it set to only check for this in the specified vbcms comments forum. You could remove that part of the condition and see if it works. (Do you always move the threads to a specific other forum? If so, enter that forumid instead.)

Sorry I missed this--will try this.

Thanks guys


This has worked but I want to do a couple more things. if anyone has already done this please share.

#1 - I want to only show a preview and not the entire article..

#2 - I want to make the preview content not crawlable. I do not want it indexed from both the article page and the forum.(I don't think this is an issue because the content is being generated from the cms and not actually posted as a regular thread so disregard number 2--

#3 - Being able to add the images would also be cool..

Thanks--Love this!

Toorak Times 06-05-2013 05:50 PM

Glad I found this. Applied it tonight, Lynne's and the latest version, cheers!

It works very well with text on my 4.2.1 site, first few I looked at the pics didn't come through, and I don't expect the vBTubes to come thru but when I looked deeper pics were being feed into the thread.

It has fixed up hundreds of posts that NOW I can call an archive, wonderful, I'll definitely keep an eye on this thread hoping for further shared enhancements.

I was starting to build an archive in the CMS as the links didn't allow me to delete some of the dated. I presume I can delete the dated content from the CMS now as we have copy in this plugin.

Thanks again.

Lynne 06-05-2013 09:57 PM

Quote:

Originally Posted by Toorak Times (Post 2425992)
I was starting to build an archive in the CMS as the links didn't allow me to delete some of the dated. I presume I can delete the dated content from the CMS now as we have copy in this plugin.

Thanks again.

No, you cannot delete the CMS article. If you do that, then there will be no text in the post. This modification does not actually copy it from the CMS part of the database into the post, it just shows the CMS content in place of the existing post.

Toorak Times 06-06-2013 08:37 AM

Quote:

Originally Posted by Lynne (Post 2426016)
No, you cannot delete the CMS article. If you do that, then there will be no text in the post. This modification does not actually copy it from the CMS part of the database into the post, it just shows the CMS content in place of the existing post.

Thanks Lynne, I learnt today when I tried to edit one of them to replace the pictures the content also disappears.

Morrus 06-07-2013 02:21 PM

So I've done something silly, and I think it may have messed up something.

I had changed the phrase which says "You can view the page at X" a while back to something else. Yesterday, I went to change it again, and deleted the translation and saved it. Now I can't find the phrase! I usually find phrases by just searching for them, but I can't search for " ".

How do I find that phrase again? Does it have a Phrase Variable Name I can search for instead of the text?

--

Additionally, at the exact same time (it might be coincidence, but it might be linked to the above) the CMS has stopped putting the comment thread in the CMS comments forum altogether, and despite comments being set to YES in the article edit page, comments appear to be remaining switched off. I don't know if that's somehow connected to me accidentally removing a phrase (it seems unlikely, but the timing was pretty much exact).

Lynne 06-07-2013 04:32 PM

Quote:

Originally Posted by Morrus (Post 2426394)
So I've done something silly, and I think it may have messed up something.

I had changed the phrase which says "You can view the page at X" a while back to something else. Yesterday, I went to change it again, and deleted the translation and saved it. Now I can't find the phrase! I usually find phrases by just searching for them, but I can't search for " ".

How do I find that phrase again? Does it have a Phrase Variable Name I can search for instead of the text?

The phrase name is "comment_thread_firstpost".

Quote:

Originally Posted by Morrus (Post 2426394)
Additionally, at the exact same time (it might be coincidence, but it might be linked to the above) the CMS has stopped putting the comment thread in the CMS comments forum altogether, and despite comments being set to YES in the article edit page, comments appear to be remaining switched off. I don't know if that's somehow connected to me accidentally removing a phrase (it seems unlikely, but the timing was pretty much exact).

I can't see how the two are related.

Morrus 06-07-2013 04:38 PM

Quote:

Originally Posted by Lynne (Post 2426431)
The phrase name is "comment_thread_firstpost".

Got it - thanks!


Quote:

I can't see how the two are related.
They definitely are in some way, because reverting that phrase immediately turned comments back on again! Everything is working correctly again!

I just tested it and removed and then re-added the phrase again. Removing it immediately switches off CMS comments threads (and therefore comments); adding it back restores the functionality.

RichieBoy67 06-09-2013 05:12 AM

Quote:

Originally Posted by TiKu (Post 2363964)
Here's another improvement:
Add a plugin called "Quote Full CMS Article", hook newreply_quote.
Code:

if (THIS_SCRIPT == 'ajax' AND $quote_post['forumid'] == $vbulletin->options['vbcmsforumid']) {
    $is_first_post = false;
    $result = $vbulletin->db->query_first("SELECT postid FROM " . TABLE_PREFIX . "post WHERE threadid=" . $quote_post['threadid'] . " ORDER BY dateline LIMIT 1");
    if($result) {
        $is_first_post = ($result['postid'] == $quote_post['postid']);
    }

    if($is_first_post) {
        $result = $vbulletin->db->query_first("
          SELECT cms_article.pagetext, cms_article.threadid, cms_node.nodeid, cms_node.userid
          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 = ". $quote_post['threadid']. "
        ");

        if($result) {
            bootstrap_framework();
            $contenttypeid = vb_Types::instance()->getContentTypeID('vBCms_Article');
            $allow_html = vBCMS_Permissions::canUseHtml($result['nodeid'], $contenttypeid, $result['userid']);

            $bbcode_parser = new vBCms_BBCode_HTML($vbulletin, vBCms_BBCode_HTML::fetchCmsTags());
            $pagetext = $bbcode_parser->get_preview(fetch_censored_text($result['pagetext']), $vbulletin->options['default_cms_previewlength'], $allow_html);
        }
    }
}

This makes quotes of the first post of the comments thread quote the article's preview text instead of the link to the article.

Just what I needed!! Thanks!

Any clue how to get the image to display?

MissKalunji 07-07-2013 01:06 AM

Great! it works, :) thank you!

MissKalunji 07-10-2013 02:04 AM

i have uncached template...how do i cache it? :)

Lynne 07-10-2013 02:13 AM

This modification doesn't use a template. So what template is it that you need to cache?

MissKalunji 07-10-2013 11:51 PM

scratch that comment lol I think i was just too tired last night lol i could swear I saw a comment something template uncached. ^_^ sorry

RichieBoy67 10-11-2013 04:54 PM

Has anyone figured out how to get images from the cms imported to show here as well?

DemOnstar 11-09-2013 09:03 AM

Quote:

Originally Posted by RichieBoy67 (Post 2452264)
Has anyone figured out how to get images from the cms imported to show here as well?

Not sure if I know what you mean but I interpreted it to mean this..

https://vborg.vbsupport.ru/showpost....5&postcount=36

Hope that helps..

Toorak Times 12-29-2013 04:54 AM

Quote:

Originally Posted by brad_irc (Post 2244655)
Thanks for your snippet Lynne. I do many vB mods that are never published, but your code snippet helped -- so here is the solution for users wanting [ATTACH] bbcode parsed properly. :D

Let me explain so users can better understand the code and why it appears as a link.

Deep inside /includes/class_bbcode.php, line 2581 "if (!empty($this->attachments["$attachmentid"]))" checks if the $bbcode_parser object has an array defined with details about the image attachment (ie; size, contenttype, placement, thumbnail, etc). If that data is not present, it defaults to creating a link to the attachment.

I backtracked through the function where CMS article calls the bbcode parser, see file /packages/vbcms/item/content/article.php, line 428 which shows how it fetches the attachment data using the content nodeid.

The snippet below has nodeid added to the query, and the block populating the $attachments array. Enjoy :)

Also to be noted, Tapatalk users cannot view articles on main page, now they will be able to view the content using the forum

PHP Code:

if (THIS_SCRIPT == 'showthread' AND $this->post['postcount'] == AND $this->thread['forumid'] == $this->registry->options['vbcmsforumid']) {

$result $this->registry->db->query_first("
       SELECT cms_article.pagetext, cms_article.threadid, cms_article.htmlstate, cms_node.nodeid  
    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']. "
        "
);

    if(
$result) {
        
$bbcode_parser = new vBCms_BBCode_HTML(vB::$vbulletinvBCms_BBCode_HTML::fetchCmsTags());;
        
        
$attach = new vB_Attach_Display_Content(vB::$vbulletin'vBCms_Article');
        
$attachments $attach->fetch_postattach(0$result['nodeid']);
        
$bbcode_parser->attachments $attachments;
        
$bbcode_parser->unsetattach true;
        
        
$this->post['message'] = fetch_censored_text($bbcode_parser->do_parse($result['pagetext'], true$result['htmlstate']));
            
    }  


PS: If anyone else has noticed that [ATTACH] is not properly parsed in RSS feeds, I will find a solution and post it in the next couple days.

That worked a treat!

I have an issue where if someone makes a comment the CMS article disappears but the this Forum remains intact, not sure if 2 are connected


All times are GMT. The time now is 09:29 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01245 seconds
  • Memory Usage 1,823KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)bbcode_php_printable
  • (10)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (17)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete