vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   vBulletin Blog - Limit RSS Feed Text (https://vborg.vbsupport.ru/showthread.php?t=281572)

Aaron310012 04-15-2012 12:26 AM

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!

Aaron310012 04-20-2012 12:19 AM

Just wondering if anyone might have any thoughts? Thanks!

Aaron310012 04-24-2012 09:25 PM

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.

Aaron310012 04-27-2012 12:25 AM

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!

Lynne 04-27-2012 12:26 AM

What is the exact hook and code you are using and the exact database error?

Aaron310012 04-27-2012 01:23 AM

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.

kh99 04-27-2012 03:25 AM

Try this plugin code:

Code:

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


Lynne 04-27-2012 03:26 PM

^^ what he said. There is no post table being called in the query, so you can't do what you did.

Aaron310012 04-28-2012 12:01 AM

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!


All times are GMT. The time now is 06:36 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.01520 seconds
  • Memory Usage 1,730KB
  • 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
  • (1)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete