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)

krustyx 01-31-2012 01:20 AM

THIS IS THE BEST MOD EVER... thank you very much

This is how it should be integrated in CMS/VBulletin... seriously!

Thank you again!

Mark.B 02-06-2012 11:43 PM

Thanks for this Lynne;

I have done some tweaks (as usual!) and come up with this, which sort of sets the article into a post within its own box, so to speak.

http://www.bowlandcentral.com/forum/...ad.php?t=98178

Lynne 02-07-2012 12:38 AM

Very nice, Mark. I always enjoy seeing your tweeks. I am like you with modifications - I never use one straight out of the box. :)

starman? 02-07-2012 01:30 PM

Quote:

Originally Posted by Mark.B (Post 2297032)
...sets the article into a post within its own box, so to speak.

Very nice it is too. Would you be willing to share?

Mark.B 02-08-2012 01:19 AM

Quote:

Originally Posted by Lynne (Post 2297042)
Very nice, Mark. I always enjoy seeing your tweeks. I am like you with modifications - I never use one straight out of the box. :)

Yep, I always use them as a basis to build upon. Some need very little but I almost always change bits and bobs, it's good practice too..."oh, this bit of code does THAT!....." :)

Mark.B 02-08-2012 01:22 AM

Quote:

Originally Posted by starman™ (Post 2297151)
Very nice it is too. Would you be willing to share?

Have a play with this....

Change the plugin code to the below (the attachments part is commented out here, uncomment if you want attachments to embed)

Code:

if (THIS_SCRIPT == 'showthread' AND $this->post['postcount'] == 1 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::$vbulletin, vBCms_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;
   
$result['previewtext'] = $pagetext;
$this->post['message'] .= '<br /><br /><div class="blockhead"><a href="content.php?r='. $result ['nodeid'] . '"><b>' . $this->thread['title'] .'</b></a></div><div class="article_post">'. $result['previewtext'];   
        $this->post['message'] .= fetch_censored_text($bbcode_parser->do_parse($result['pagetext'], true, $result['htmlstate']));
$this->post['message'] .= '</div>';

           
    } 
}

Then add this to additional.css:
Code:

.article_post
{
border: {vb:stylevar mid_border};
border-top: 0;
background: {vb:stylevar postbit_userinfo_background};
padding: 6px;
}

The only issue I have at present is that the CMS Article URL doesn't have the SEO part after it. Also my URL formatting will probably only work with "standard" URLs and not the "Friendly" URL system, as I have never worked with that. Shouldn't take much tweaking though, I just don't know how any of that works.

starman? 02-10-2012 04:08 PM

Cheers my friend. I shall have a play this weekend.

C.Birch 02-12-2012 08:48 AM

Great edit Mark!

darrenjdoc1 02-15-2012 11:48 AM

Is it possible when someone clicks the url of the article or Read More it takes them straight to the forum post?

darrenjdoc1 02-15-2012 03:15 PM

Got it sorted :)

deverill2010 02-26-2012 11:06 PM

This seems to of stopped working for me.

If I move the article out of my dedicated vbcms forum it reverts back to the link and the article disappears out of the post?

Mark.B 02-26-2012 11:26 PM

Quote:

Originally Posted by deverill2010 (Post 2303753)
This seems to of stopped working for me.

If I move the article out of my dedicated vbcms forum it reverts back to the link and the article disappears out of the post?

I think the code is specific to the CMS comments forum - it isn't designed to work if the thread is moved elsewhere.

deverill2010 02-27-2012 04:09 AM

Quote:

Originally Posted by Mark.B (Post 2303758)
I think the code is specific to the CMS comments forum - it isn't designed to work if the thread is moved elsewhere.

Now that is really annoying lol.

It's fine I'll just delete it, post it as thread then promote it. Sigh, bleeding CMS.

Mark.B 02-27-2012 06:30 AM

You could always amend the code:

Code:

if (THIS_SCRIPT == 'showthread' AND $this->post['postcount'] == 1 AND $this->thread['forumid'] == $this->registry->options['vbcmsforumid']) {
I imagine if you took the last bit out of that it might work....
Code:

if (THIS_SCRIPT == 'showthread' AND $this->post['postcount'] == 1) {

deverill2010 02-27-2012 07:16 AM

Thank you mark works perfectly :)

Now If only I'd known that ages ago lol.

Kaishi 03-01-2012 05:29 PM

anyone know how to get this to work with 4.1.11 now that the comments are made to forums other than the cms comments forum?

Lynne 03-01-2012 05:47 PM

You can remove this from the if statement:
AND $this->thread['forumid'] == $this->registry->options['vbcmsforumid']

Unfortunately, there isn't any flag in the thread table to say the thread is an articles comment thread. I suppose you may be able to look at the thread title and see if it has the word"Article:" at the beginning and use that in the if statement so the query isn't run for every thread.

Kaishi 03-02-2012 05:25 PM

You know what's funny? Promoting from a thread to article only worked once for me. It worked and kept the original thread and prefixed it with Article:. After that 1 time, whenever I try to promote another thread, it would refuse to keep the original thread. I'm stumped.

Lynne 03-03-2012 05:17 PM

Quote:

Originally Posted by Kaishi (Post 2305414)
You know what's funny? Promoting from a thread to article only worked once for me. It worked and kept the original thread and prefixed it with Article:. After that 1 time, whenever I try to promote another thread, it would refuse to keep the original thread. I'm stumped.

This isn't really a suppor thread for the new CMS options. You do have three new settings on the page that you need to select before you promote the article if you want it to keep the original thread, so don't forget to set those correctly.

If you have more problems, you really should post over on vbulletin.com.

whitedd 03-17-2012 12:03 AM

...;)...now is perfect ;) ;) ;) ....thnx ;)

CAG CheechDogg 03-19-2012 08:26 PM

Quote:

Originally Posted by Mark.B (Post 2303812)
You could always amend the code:

Code:

if (THIS_SCRIPT == 'showthread' AND $this->post['postcount'] == 1 AND $this->thread['forumid'] == $this->registry->options['vbcmsforumid']) {
I imagine if you took the last bit out of that it might work....
Code:

if (THIS_SCRIPT == 'showthread' AND $this->post['postcount'] == 1) {

Man, I did this but when I move it somewhere else it removes the article and only the link shows up. Am I missing something here?

Note: I did use your file Mark.B to have the article in its own box, does affect it at all?

CAG CheechDogg 03-20-2012 01:53 AM

Quote:

Originally Posted by Mark.B (Post 2311155)
To be honest, I wouldn't know....I have not moved to 4.1.11 at this stage, I am still on 4.1.10.

I will probably wait now until 4.1.12, after that I will need to revisit my amendments to this add on and will share what transpires.

Sorry. :(

I am still on 4.1.10 so I don't know why this wouldn't work, I finally gave up and disabled it. Sucks cuz its a pretty cool addon.

BoardWizard 07-12-2012 03:10 PM

is there a way to get "You can view the page at 'url'", so that all it does is just show the article in the preview?

Lynne 07-12-2012 03:33 PM

Huh? I don't understand the question. If you want to remove the line about the url, then just change the plugin to replace the full $pagetext instead of adding to it.

BoardWizard 07-12-2012 03:45 PM

i probably should have proofread my post. i meant get rid of. so where in the code do i replace instead of add to it?

Lynne 07-12-2012 03:57 PM

Just change this line:
PHP Code:

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

to something like this:
PHP Code:

$this->post['message'] = $result['previewtext']; 


BoardWizard 07-12-2012 04:53 PM

thanks but all that did was get rid of the line ******
now it says You can view the page at (Url) then the beginning of the article right next to it.

Lynne 07-12-2012 11:01 PM

Did you may sure to change the .= to a = ?

astdirect 07-13-2012 06:57 AM

Lynne, great addition and i am using it with no problems. Howeve i just want to ask a related question on whether it is possible to do the same for when you promote a blog ?

BoardWizard 07-13-2012 12:39 PM

Quote:

Originally Posted by Lynne (Post 2347436)
Did you may sure to change the .= to a = ?

ah, no i did not. just did and it works now. thanks!

Lynne 07-13-2012 04:03 PM

Quote:

Originally Posted by astdirect (Post 2347494)
Lynne, great addition and i am using it with no problems. Howeve i just want to ask a related question on whether it is possible to do the same for when you promote a blog ?

I'm not sure I understand what you want. If you promote a blog and then have a comments thread for it, then you can do this same sort of thing for that thread. You do need to modify my original code here if you allow comment threads in several forums though. When I originally wrote it, all comments threads were in one forum.

astdirect 07-14-2012 08:05 AM

I am on 4.1.9

When i promote a thread to a blog the thread continues to take comments but the actual blog page only shows the first post. I would like the blog to also be interacting with the thread and contain the comments...... but it doesn't.

Lynne 07-14-2012 04:06 PM

Quote:

Originally Posted by astdirect (Post 2347936)
I am on 4.1.9

When i promote a thread to a blog the thread continues to take comments but the actual blog page only shows the first post. I would like the blog to also be interacting with the thread and contain the comments...... but it doesn't.

This mod will not help with that at all. You will have to code something to do what you want.

jesfro 08-09-2012 07:53 AM

Quote:

Originally Posted by brad_irc (Post 2244655)
Also to be noted, Tapatalk users cannot view articles on main page, now they will be able to view the content using the forum

Hey Brad,
first of all: fantastic work (based on Lynnes)!
It works great in the web browser.
But:
Regarding your Tapatalk statement... this does not work (for us... www.apfeltalk.de). There is no full CMS article in forum via Tapatalk. Anyone else noticed the problem?
Is there something i could set up in the plugin ( hook, order etc.)? Is this a vbulletin or a vbcms?

Thanks a lot in advance ;-)

TiKu 09-03-2012 09:31 PM

I've modified this add-on to display the preview text only. First you need a template called full_cms_in_comments_thread:
Code:

{vb:raw previewtext}<br />
        <span class="cms_article_readmore"><a href="{vb:raw page_url}">{vb:rawphrase read_more_phrase} <img src="{vb:stylevar imgdir_cms}/read_more-{vb:stylevar right}.png" alt="{vb:rawphrase read_more_phrase}" /></a>
        </span>

And this is the new hook code:
Code:

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.pagetext, cms_article.threadid, cms_article.htmlstate, cms_node.nodeid, cms_node.userid, cms_node.url
          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) {
                $contenttypeid = vb_Types::instance()->getContentTypeID('vBCms_Article');
                $allow_html = vBCMS_Permissions::canUseHtml($result['nodeid'], $contenttypeid, $result['userid']);

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

                $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;

                $templater = vB_Template::create('full_cms_in_comments_thread');
                $templater->register('previewtext', fetch_censored_text($bbcode_parser->do_parse($result['previewtext'],true,$result['htmlstate'])));
                $templater->register('page_url', vB_Route::create('vBCms_Route_Content', $result['nodeid'] . ($result['url'] == '' ? '' : '-' . $result['url']))->getCurrentURL());
                $this->post['message'] = $templater->render();
        }
}


Lynne 09-03-2012 10:25 PM

Thanks for sharing!

imported_dfmafia 09-04-2012 03:17 AM

I'm actually trying to get the article/comments forum to post a preview of the thread on vBAdvancec cmps news feed. currently I have been unsuccessful. the comment forums look great with this mod but when I go to cmps it is still displaying "You can view the page at..." instead of the preview

TiKu 09-04-2012 05:28 AM

Quote:

Originally Posted by Lynne (Post 2362374)
Thanks for sharing!

Same to you. :)
One thing I still don't like, is that if you quote the first post of the comments thread, it quotes only the link to the article. This happens because the mod doesn't actually replace the post text in the database - which I like, because this way you don't have to edit the thread if you edit the article.
Does anyone have an idea how we could make quotations work while keeping the current approach of not replacing the post text in the database?

TiKu 09-09-2012 10:10 AM

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.

datoneer 02-01-2013 07:24 PM

Thanks Lynne awesome mod!


All times are GMT. The time now is 01:32 PM.

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.01395 seconds
  • Memory Usage 1,851KB
  • 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
  • (9)bbcode_code_printable
  • (2)bbcode_php_printable
  • (13)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
  • (40)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