Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Add-ons

Reply
 
Thread Tools
Show Full CMS Article in Comments Thread Details »»
Show Full CMS Article in Comments Thread
Version: 1.00, by Lynne Lynne is offline
Developer Last Online: Oct 2022 Show Printable Version Email this Page

Category: Show Thread Enhancements - Version: 4.0.8 Rating:
Released: 11-26-2010 Last Update: Never Installs: 58
Uses Plugins
Re-useable Code  
No support by the author.

This is more of an example than a modification. I wrote this quick plugin for someone and thought I would share it. It's something someone can take and build on. All it does is if you look at the CMS Article thread in your CMS Comments forum, the content of the CMS Article is shown under the blurb "You can view the page at.....". This is ONLY for Articles - not Static Pages or PHP Direct Evaluation content types. Someone can build on this and do those if they want. The person I wrote this for had forms in their articles and needed the submit button to be disabled, so this plugin does that also.

Like I said - this is more of an example. I don't plan to do anything more with it and I'm not helping with modifying it for your own use. Use it however you want.

This adds one query to the threads in the CMS Comments forum.

To install....

Create a Plugin
Hook Location - postbit_display_complete
Title - Show Full CMS Article
Plugin PHP Code -

PHP 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 
    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'];

CMS Page:

CMS Comment Thread:


If you ONLY want to show the full article to users, not guests, then change this condition (thanks to mattysheff):
PHP Code:
if (THIS_SCRIPT == 'showthread' AND $this->thread['forumid'] ==  $this->registry->options['vbcmsforumid'] AND  $this->post['postcount'] == 1
to this:
PHP Code:
if (THIS_SCRIPT == 'showthread' AND $show['member'] AND  $this->thread['forumid'] == $this->registry->options['vbcmsforumid'] AND $this->post['postcount'] == 1

Download Now

File Type: txt show full cms article.txt (2.0 KB, 137 views)

Screenshots

File Type: png article - cms.png (39.2 KB, 0 views)
File Type: png article - thread.png (63.3 KB, 0 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.
3 благодарности(ей) от:
Paul M, tbworld, Toorak Times

Comments
  #2  
Old 12-13-2010, 10:09 PM
Dr.osamA's Avatar
Dr.osamA Dr.osamA is offline
 
Join Date: Aug 2004
Location: Syrie
Posts: 979
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

installed

but i have broplem with cms as default
Reply With Quote
  #3  
Old 12-13-2010, 10:30 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Dr.osamA View Post
installed

but i have broplem with cms as default
Sorry, but I don't understand what you mean.
Reply With Quote
  #4  
Old 12-30-2010, 01:39 AM
jimfries's Avatar
jimfries jimfries is offline
 
Join Date: Dec 2009
Location: Steel City
Posts: 77
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

After I put in this plug-in, activate it then reload my website I get this Error:
==================
Database error in vBulletin 4.0.1:

Invalid SQL:

SELECT cms_article.pagetext, cms_article.threadid, cms_article.htmlstate
FROM distortedforumscms_article AS cms_article
INNER JOIN distortedforumscms_node AS cms_node ON (cms_node.contentid = cms_article.contentid)
INNER JOIN distortedforumscms_nodeinfo AS cms_nodeinfo ON (cms_nodeinfo.nodeid = cms_node.nodeid)
WHERE cms_nodeinfo.associatedthreadid = 570;

MySQL Error : Unknown column 'cms_article.htmlstate' in 'field list'
Error Number : 1054
Request Date : Wednesday, December 29th 2010 @ 08:37:48 PM
Error Date : Wednesday, December 29th 2010 @ 08:37:48 PM
Script : http://www.distortedguild.com/showth...ate-12-30-2010
Referrer : http://www.distortedguild.com/forumd...p?5-Guild-Chat
IP Address : 76.125.212.129
Username : Guadah
Classname : vB_Database
MySQL Version : 4.1.24-max-log


Here is the code I put into the Plug-in. I just copied and pasted it.
==================
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
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'];
}
Reply With Quote
  #5  
Old 12-30-2010, 03:13 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by jimfries View Post
After I put in this plug-in, activate it then reload my website I get this Error:
==================
Database error in vBulletin 4.0.1:

Invalid SQL:

.....

MySQL Error : Unknown column 'cms_article.htmlstate' in 'field list'
I just wrote this recently, so I've only been able to test it on 4.0.8 and up. There may not have been a field called htmlstate in the cms_article table back in 4.0.1. If so, then I'm not sure if this will work for you without modifying the query and the do_parse call.
Reply With Quote
  #6  
Old 12-30-2010, 03:35 AM
jimfries's Avatar
jimfries jimfries is offline
 
Join Date: Dec 2009
Location: Steel City
Posts: 77
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

oh man, what a bummer.

I'm not sure I can upgrade, I think one or two addons will stop working if I do. I'll backup the website and try to upgrade this weekend when I have time.

Thanks for the work done in it regardless! It's an awesome modification.
Reply With Quote
  #7  
Old 12-30-2010, 04:55 AM
jimfries's Avatar
jimfries jimfries is offline
 
Join Date: Dec 2009
Location: Steel City
Posts: 77
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I removed ", cms_article.htmlstate" and submitted it. The addon is working now

Thank you again for this modification!
Reply With Quote
  #8  
Old 12-30-2010, 11:05 AM
GamerPerfection's Avatar
GamerPerfection GamerPerfection is offline
 
Join Date: Feb 2006
Posts: 389
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Tagged.... will try later today.... hope it works on 4.1.0
Reply With Quote
  #9  
Old 12-30-2010, 04:28 PM
GamerPerfection's Avatar
GamerPerfection GamerPerfection is offline
 
Join Date: Feb 2006
Posts: 389
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It works.

One problem I have though, which is not an issue with it as it is, but more with how I personally do things on my forum. Once I publish an article, I then go to the forum and I move the thread from vBCMS Comments to a more relevant section of the forum. When I move it the article content in the thread disappears and i'm left with the standard "you can view the page here".

The way around it I have at the moment is I copy the content from the auto created thread, then I move the thread, then edit the thread and paste in the content. It works, but it means a little more work on my behalf.
Reply With Quote
  #10  
Old 12-30-2010, 04:58 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by GamerPerfection View Post
It works.

One problem I have though, which is not an issue with it as it is, but more with how I personally do things on my forum. Once I publish an article, I then go to the forum and I move the thread from vBCMS Comments to a more relevant section of the forum. When I move it the article content in the thread disappears and i'm left with the standard "you can view the page here".

The way around it I have at the moment is I copy the content from the auto created thread, then I move the thread, then edit the thread and paste in the content. It works, but it means a little more work on my behalf.
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.)
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:20 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07875 seconds
  • Memory Usage 2,355KB
  • Queries Executed 24 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)bbcode_code
  • (3)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (3)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (3)postbit_attachment
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete