Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 04-15-2012, 01:26 AM
Aaron310012 Aaron310012 is offline
 
Join Date: Jan 2012
Posts: 14
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default vBulletin Blog - Limit RSS Feed Text

Hello,

I am searching for a way to limit the amount of text for the Blog RSS feed. Right now the feed is displaying the entire contents of each and all blog posts and I would like to find a way to limit this to a preview. I found the thread below and still have been unable to get this working on the Blog portion of the site:

https://vborg.vbsupport.ru/showthread.php?t=166703

This uses a plugin with an external_query hook location.

Code:

unset($vbulletin->GPC['fulldesc']);
$vbulletin->options['threadpreview'] = 250;
$hook_query_fields .= ",LEFT(post.pagetext,400) AS message";

I have created this plugin for the vBulletin, vBulletin Blog, and vBulletin CMS products and have enabled all three.

However, while this seems to have worked for the Forum & CMS, the Blog feed still displays the entire contents of every Blog post. Interestingly, I've found that even if I enable only the CMS plugin, it will shorten the feed for the CMS and Forum, but I can't find a way to limit the RSS feed text for the Blog.

Does anyone know of a way or modification to this plugin that might work?

Any advice or thoughts on the issue would really be appreciated!
Reply With Quote
  #2  
Old 04-20-2012, 01:19 AM
Aaron310012 Aaron310012 is offline
 
Join Date: Jan 2012
Posts: 14
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Just wondering if anyone might have any thoughts? Thanks!
Reply With Quote
  #3  
Old 04-24-2012, 10:25 PM
Aaron310012 Aaron310012 is offline
 
Join Date: Jan 2012
Posts: 14
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I just found that there is also a specific blog_external_query template hook and tried that, but am receiving a database error when trying to subscribe to the RSS feed while the plugin is enabled.
Reply With Quote
  #4  
Old 04-27-2012, 01:25 AM
Aaron310012 Aaron310012 is offline
 
Join Date: Jan 2012
Posts: 14
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

By chance, does anyone have any idea why I might get this database error with this template hook? I'm thinking that finding the solution to the error might point me down the path towards resolution.

Or perhaps there is a better approach to limit the RSS feed of the blog?

Again thanks for any input on this one!
Reply With Quote
  #5  
Old 04-27-2012, 01:26 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What is the exact hook and code you are using and the exact database error?
Reply With Quote
  #6  
Old 04-27-2012, 02:23 AM
Aaron310012 Aaron310012 is offline
 
Join Date: Jan 2012
Posts: 14
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Lynne,

Thank you for your response. Just to recap, I have enabled RSS in the VB options. I then found this thread about limiting the RSS feed:

https://vborg.vbsupport.ru/showthread.php?t=166703

So at this point, I am using the plugin code:

unset($vbulletin->GPC['fulldesc']);
$vbulletin->options['threadpreview'] = 250;
$hook_query_fields .= ",LEFT(post.pagetext,400) AS message";

And I have created 3 separate plugins; 1 for the CMS product, 1 for the Forum product, and 1 for the Blog product.

This has worked great for the CMS and Forum, those RSS feeds are limited. However, I have tried both the external_query and the blog_external_query hooks using the code above but the blog RSS feed is not limited. Additionally, when using the blog_external_query hook only, I receive the database error when clicking the RSS icon from within the blog. Here is the database error:

Database error in vBulletin 4.1.12:

Invalid SQL:

SELECT blog.*, blog_text.*, user.*
,LEFT(post.pagetext,400) AS message
FROM blog AS blog
INNER JOIN blog_text AS blog_text ON (blog.firstblogtextid = blog_text.blogtextid)
INNER JOIN blog_user AS blog_user ON (blog_user.bloguserid = blog.userid)
LEFT JOIN user AS user ON (user.userid = blog_text.userid)


WHERE 1=1
AND blog.state = 'visible'
AND blog.dateline <= 1335495900
AND blog.pending = 0
AND blog_user.options_guest & 1
AND ~blog.options & 8



ORDER BY blog.dateline DESC
LIMIT 15;

MySQL Error : Unknown column 'post.pagetext' in 'field list'
Error Number : 1054
Request Date : Thursday, April 26th 2012 @ 09:05:00 PM
Error Date : Thursday, April 26th 2012 @ 09:05:00 PM
Script : http://www.mysite.com/blog_external.php?type=RSS2
Referrer : http://www.mysite.com/blog.php
IP Address : ***.**.***.***
Username : Unregistered
Classname : vB_Database
MySQL Version :

Any thoughts would be highly appreciated, I would really like to enable RSS for the blog, however I would prefer that the RSS feed only be a preview to the full content which could be found directly on my site if at all possible.
Reply With Quote
  #7  
Old 04-27-2012, 04:25 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try this plugin code:

Code:
unset($vbulletin->GPC['fulldesc']);
$vbulletin->options['threadpreview'] = 250;
$hook_query_fields .= ",LEFT(blog_text.pagetext,400) AS pagetext";
Reply With Quote
  #8  
Old 04-27-2012, 04:26 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

^^ what he said. There is no post table being called in the query, so you can't do what you did.
Reply With Quote
  #9  
Old 04-28-2012, 01:01 AM
Aaron310012 Aaron310012 is offline
 
Join Date: Jan 2012
Posts: 14
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Kevin & Lynne - That worked, thanks! Very highly appreciated! Now if I can only figure out how to add a "..." or something similar after the truncated text I'll be all set, but this has been extremely helpful and obviously solved the main concern!
Reply With Quote
Reply


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 10:32 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.04314 seconds
  • Memory Usage 2,233KB
  • Queries Executed 11 (?)
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)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)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
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete