Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.5 > vBulletin 3.5 Add-ons

Reply
 
Thread Tools
Latest Blog Feed in Postbit using Carp RSS Details »»
Latest Blog Feed in Postbit using Carp RSS
Version: 1.00, by nevetS nevetS is offline
Developer Last Online: Oct 2008 Show Printable Version Email this Page

Version: 3.5.0 Beta 3 Rating:
Released: 07-06-2005 Last Update: 07-06-2005 Installs: 34
Uses Plugins Template Edits
 
No support by the author.

I just posted this over at vbWebmaster Forums. I'm all excited because this is my first plugin and I know pretty much nothing about vbulletin. I got the idea from Shawn's forum at Digital Point

I just put this together for 3.5 using carp.

Step 1) Add a custom profile field for the RSS link. In my setup it was field5.
Step 2) Edit your postbit template as follows:
PHP Code:
<if condition="$post['field5']">
<
div class="smallfont">Recent Blog$blogentry</div>
        </if> 
Step 3) Create a new plugin. I named mine: Carp Configuration. Attach it to the "global_start" hook location.
Here is the code:
PHP Code:
require_once '/path/to/carp/carp.php';
CarpConf('cacheinterval',120);
/** You may want to set a cachepath specifically for your forum **/
CarpConf('cachepath','/where/you/want/your/cache/files/');
CarpConf('cacherelative',0);
/** You can omit the above two lines without a problem **/
CarpConf('cborder','');
CarpConf('poweredby','');
CarpConf('maxitems',1);
CarpConf('iorder','link'); 
Step 4) One more plugin. This one I called: Get Users Blog Entry
Attach this to hook location: postbit_display_start
PHP Code:
ob_start();
CarpCacheShow($post[field5]);
$blogentry ob_get_contents();
ob_end_clean(); 
That's it... away you go. If you don't have carp, you can check it out at: http://www.geckotribe.com/rss/carp/
I'm not sure if this will work with the free version, as I have the paid version.

I'm thinking about using grouper to set it up so I can parse atom files, but I don't know how important that will be.

Note: carp allows you to enter local paths and http paths for rss feeds. I've tried entering both in my user profile field successfully. You may want to disallow users from entering a local path just to be on the safe side. I don't have any code for that right now, but I'm sure there are some examples for field validation out there.

Carp has an option to store it's output in a variable ($carpoutput), but it didn't seem to work for me. That's why I used the ob_start and end_clean functions. If anybody has any feedback as to how this may be improved, I'm willing to listen.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #62  
Old 08-02-2007, 05:55 AM
jerrygad jerrygad is offline
 
Join Date: Sep 2006
Location: In Front Of My PC!
Posts: 114
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry for dugging this old topic, but just want to let you all know that this hack working correctly even with 3.6.8.
Reply With Quote
  #63  
Old 11-19-2007, 05:37 PM
gotlinks's Avatar
gotlinks gotlinks is offline
 
Join Date: Sep 2007
Location: USA, San Antonio, Texas
Posts: 61
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I keep getting this error?

[CaRP] Can't open cache file.

[CaRP] Failed to open file: /home/thrdgami/public_html/bzimage/rss/carp/autocache/58fae8eb72e8579438002f3ea9fd5c09

[CaRP] Can't open remote newsfeed.
Reply With Quote
  #64  
Old 11-27-2007, 12:14 PM
gotlinks's Avatar
gotlinks gotlinks is offline
 
Join Date: Sep 2007
Location: USA, San Antonio, Texas
Posts: 61
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Here is how to fix this mod! And it works perfect on my forum at www.bzimage.org


Quote:

First of all download carp from here: http://www.geckotribe.com/rss/carp/

I am using the free version and it works perfectly.

Unzip the carp archive (zip) and upload the carp folder to your forums home directory.

Upload the carpsetup.php to the same directory as of your showthread.php (forums home) folder.

Run the setup file, it will give you two choices..

1) directory cache and the other.. mysql cache. I am using directory cache and I recommend you to try this one.

When you hit next, carp will install cache folders to your carp/ directory. If you don't see any errors here then the setup is complete, you should now delete the carpsetup.php from the forum home directory and carpsetupinc.php from your forums/carp/ directory. If you encountered any errors here then it's highly likely that you need to change the directory permissions for you /carp folder in order allow the script to create cache directories.

Now the rest of the process is fairly simple.

Open your admincp (vb) and create a custom profile field. It should be Single-Line text box. Click next and fill the fields. Give it an appropriate title/description, i.e:

For title: Blog Feed
For description: Enter your Blog's RSS feed URL here i.e. http://myblog.com/rss.xml

Leave the default value field empty. Change max length allowed for user input to 200. Field should be editable by user, not a private field, not searchable on member list and do not show on member list. Leave the regular expressions field blank. In the Display page option below, set it to Edit profile and click save.

Now add two plugins in your admincp's Plugins and Products >> Add new plugin. For the first plugin: Selected "global_start" as your hook location, give it an appropriate title (can be anything) and paste the following php code in the plugin php code area:


PHP Code:
require_once 'carp/carp.php';
CarpConf('cacheinterval',120);
/** You may want to set a cachepath specifically for your forum **/
CarpConf('cachepath','carp/');
CarpConf('cacherelative',0);
/** You can omit the above two lines without a problem **/
CarpConf('cborder','');
CarpConf('poweredby','');
CarpConf('maxitems',1);
CarpConf('iorder','link'); 
Set the plugin to active and click save. Now it's time to add the second plugin:

Attach it to postbit_display_start as the hook location, give it a title & paste the following code in the plugin php code area:


PHP Code:
ob_start();
CarpCacheShow($post[field5]);
$blogentry ob_get_contents();
ob_end_clean(); 
Set the plugin to active and click save.

Now open your postbit template:

FIND

PHP Code:
<if condition="$post['usertitle']"><div class="smallfont">$post[usertitle]</div></if> 
ABOVE ADD

PHP Code:
<if condition="$post['field5']">
<
div class="smallfont">Recent Blog$blogentry</div>
</if> 
Save your template. Now to test it, go to your usercp> edit profile and scroll down, you will see the Blog Feed option there, add your blog's rss feed and hit save changes. Now go to your forums and look for any of your post.. you will see the latest blog link below your username.

If you encounter any problems then post a message here and I will try to fix it accordingly.
Reply With Quote
  #65  
Old 01-23-2008, 04:29 AM
jamestl2 jamestl2 is offline
 
Join Date: Aug 2007
Posts: 33
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK,
I downloaded this and everything is working great. The only issue I seem to be having with it is the fact that all the blog post titles have all the quote and apostrophe marks replaced with question marks, anyone know why?
Reply With Quote
  #66  
Old 01-23-2008, 01:14 PM
nevetS nevetS is offline
 
Join Date: May 2005
Location: Sunny California
Posts: 97
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This most likely has to do with the fact that the rss feeds are unicode. Do you have an rss feed exhibiting the problem that I can point to?

I would think that if your forum is displaying unicode and the rss feed is unicode it wouldn't be a problem, but if you have a doctype specifying western characters it will show the western character version - which is usually a question mark, but it depends on the font.

It could be a problem with carp, though.

I may be able to insert a regex to replace the characters appropriately.
Reply With Quote
  #67  
Old 01-23-2008, 02:51 PM
jamestl2 jamestl2 is offline
 
Join Date: Aug 2007
Posts: 33
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well,
my forum I'm using is:
http://www.conspiracy-forums.com/

and the feed for my blog in my postbit is:
http://www.lightningshock.com/feed/

So I'm not exactly sure where the error is turning up.
Reply With Quote
  #68  
Old 01-24-2008, 10:25 AM
nevetS nevetS is offline
 
Join Date: May 2005
Location: Sunny California
Posts: 97
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm just barely starting to look into this - busy work day. I'll get back to you shortly.
Reply With Quote
  #69  
Old 01-24-2008, 10:38 AM
nevetS nevetS is offline
 
Join Date: May 2005
Location: Sunny California
Posts: 97
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

There's definiitely a combination of unicode (UTF-8) (rss feed) and western character sets (ISO-8859-1) (forum page) going on - although I'm actually unsure of a fix at the moment. Looking at the output, there isn't a difference between single and double quotes.

I'll spend some more time this morning checking it out.
Reply With Quote
  #70  
Old 01-24-2008, 01:52 PM
nevetS nevetS is offline
 
Join Date: May 2005
Location: Sunny California
Posts: 97
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK - interesting, but not a solution yet -
If you add the following to your carp configuration, it will output the quotes properly -
Code:
CarpConf('encodingout','UTF-8');
But - it will only work if the document type is UTF-8, otherwise you get garbled characters.

This is typically done by having a meta tag in the header as follows:
Code:
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
but that isn't working on my forum. Firefox is still showing the page as ISO-8859-1.

I am a bit concerned that fixing this problem might just break some other things.

There is another option in CarpConf
Code:
CarpConf('fixentities',1);
but that only seems to fix your opening quote, not your closing quote or the single quote.
Reply With Quote
  #71  
Old 01-24-2008, 02:18 PM
nevetS nevetS is offline
 
Join Date: May 2005
Location: Sunny California
Posts: 97
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK... so here we go. Beware that this may potentially cause some problems because we're changing character encoding. I don't know what kind of problems it might cause but there seems to be a lot of discussion about UTF-8 and I personally don't know a heck of a lot about it.

My mindset is to give it a shot, and be prepared to roll back these changes if they affect anything else.

In your carp configuration plugin - the one that has a hook on global_start
add:
Code:
CarpConf('encodingout','UTF-8');
Then go into your admincp and go to languages.

select language manager, then edit the US English settings. Change the character set from ISO-8859-1 to UTF-8 and then it should work.

The things I would be concerned about testing right off the bat would be any add-ons you have that involve javascript. I don't think this change updates the database at all, so the underlying database tables probably still have a character set of ISO-8859-1. Try posting and searching text that includes unicode characters - maybe copy/paste from http://www.revfad.com/flip.html
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 07:33 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.04732 seconds
  • Memory Usage 2,342KB
  • Queries Executed 27 (?)
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
  • (4)bbcode_code
  • (7)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)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_postinfo_query
  • fetch_postinfo
  • 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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete