PDA

View Full Version : Mini Mods - Display latest blog post in postbit using Magpie RSS


pmkb
08-26-2007, 10:00 PM
This mod borrows extensively from the work vauge (https://vborg.vbsupport.ru/member.php?u=65969) did for vB 3.5 (as found here (https://vborg.vbsupport.ru/showthread.php?t=93457)) and from the work nevetS (https://vborg.vbsupport.ru/member.php?u=85226) did for a similar mod using CaRP RSS (https://vborg.vbsupport.ru/showthread.php?t=91781).

I did PM vauge requesting permission to update his mod as many people were having difficulty implementing it, but s/he hasn't been online in several months and didn't respond to my PM for over a week now, so I decided to go ahead and post the mod.

This mod will allow forum members to add their blog's RSS feed URLs to their profile and have the forum display a link to their latest blog post next to their username every time they post in the forum.

I had been using nevetS's CaRP mod for this for a long time, but the Magpie RSS reader is actually more powerful (can parse Atom feeds too) and flexible. Also, I don't know if anyone can find the free download for CaRP anymore.

Installation: Download Magpie RSS (http://magpierss.sourceforge.net/) and install on your server. Magpie is a free, open source RSS reader with caching. It consists of 4 .php files plus one external library file. I recommend you create a directory called magpie in your domain's root directory and upload the files there.

Be sure when installing to create a cache sub-directory inside the magpie directory and CHMOD it to 777. In your vB ACP, add a new user profile field. I used the following:Title: Blog Feed
Description: Do you write a blog? Post the RSS/XML feed for the blog here and a link to your latest blog post will show in the forums next to your name with every post.
Max Length: 200
Type: Single Line
Required: No
Editable: Yes
Private: No * Must be No if you want guests and registered members to see the blog links
Searchable/Shown on memberlist: NoAfter saving, go to the User Profile Field Manager and note what the Name column displays for your new field. It should be field5 or field6 or something like that. Open the attached magpierss.xml file in your favorite text editor and modify the paths for the MAGPIE_DIR and MAGPIE_CACHE_DIR variables to match your server's directory structure. You can adjust the value for the MAGPIE_CACHE_AGE if you like. It's set to update the cache every 4 hours by default. Last, update the field5 to your field # in two places in the postbit_display_start section. Save the file. Import your updated magpierss.xml file using the Add/Import Product link in the Manage Products page. Edit your postbit template. Find $template_hook[postbit_userinfo_left] and add just before it:<if condition="$post['field5']"><div class="smallfont">Recent Blog: <a href="$blogLink" target="_blank">$blogTitle</a></div></if>You should change the field # in that code to match your field # of course. You can also add rel="nofollow" to the link code if you are so inclined.

That's it. :)

P.S. Updated per Marco van Herwaarden's suggestions for better performance and security. :)

P.P.S. If anyone knows how to fix the XML file so that it injects the template code into the postbit_userinfo_left hook so folks don't have to make a manual template edit, by all means please share. :)

P.P.P.S Unfortunately, there appears to be a conflict with the magpie code and vBulletin's AJAX code which is beyond my coding skills to fix. See page two of this thread for more details.

Ratman2050
08-27-2007, 03:08 PM
Reserved.

P.S. My First Reserve :D

yahoooh
08-27-2007, 05:39 PM
any demo?

pmkb
08-27-2007, 06:31 PM
I added a screenshot. :)

Hornstar
08-28-2007, 12:38 PM
When I read the title of this mod, I thought vb must have released its blog ^^ but then I got my hopes up too fast lol. nice mod tho.

pmkb
08-28-2007, 02:32 PM
Sorry about that! It's hard to describe some mods in just a few words.

Triky
08-29-2007, 08:40 AM
Installed.
I will use this feature in the future.
Really thanks, pmkb.

Marco van Herwaarden
08-29-2007, 08:56 AM
Is the magpie rss_fetch.inc file needed on each vBulletin page? You are currently loading it unconditionally in the "global_start" hook. This might lead to more overhead then needed.

if ($post['field5']){
$num_items = 1;
$rss = fetch_rss($post['field5']);
if($rss) {
$items = array_slice($rss->items, 0, $num_items);
foreach ( $items as $item ) {
$blogTitle = $item['title'];
$blogLink = $item['link'];
}
}
}

As you overwrite $blogTitle and $blogLink each time you go thru the loop, only the last value will ever be displayed (assuming you can have more then 1 entry, otherwise the loop does also not make sense).

gforce75
08-29-2007, 09:09 AM
Good catch Herwaarden. Nice mod, but will wait till see a demo :p

pmkb
08-29-2007, 11:04 AM
gforce, what do you mean by a demo? I posted a screenshot of what it does from my own forum (see sig) where this mod is working. I have the mod installed on 3 forums and it works great.

pmkb
08-29-2007, 11:42 AM
OK. I've updated the plugin per Marco van Herwaarden's suggestions to improve performance and security. :)

FreshFroot
08-29-2007, 07:07 PM
When I read the title of this mod, I thought vb must have released its blog ^^ but then I got my hopes up too fast lol. nice mod tho.
umm vb just released vblog right now :D

Michael2
08-29-2007, 10:58 PM
Will this work with the vBulletin blog or is there an easier way to set this up? I'd rather it be done automatically and not have users be responsible for adding their RSS feed (which most probably won't do).

pmkb
08-30-2007, 01:15 AM
This was designed to let users who have their own blogs on their own sites display the latest blog post by their name. From what I saw of the vB Blog announcment, it offers RSS feeds, so it could be used to display the latest vB Blog post, but users would need to put the blog feed URL in their profile.

I imagine that vB will update their vB Blog at some point to include this feature, but as far as I can tell, right now it just shows a number indicating the number of blog posts instead of a title/link to the latest post.

XManuX
08-30-2007, 04:01 PM
Any ideas why only admins on my boards can view the "My Blog:" infos ? Any other usergroups can't !

pmkb
08-30-2007, 05:10 PM
Yes, I made a boo boo in the instructions (fixed now) :o. In your profile manager, change the Blog Feed field Privacy setting to No and all users who are allowed to see the thread/post will see the blog link.

XManuX
08-30-2007, 05:45 PM
thanks for your fast answer ! :up:

Riccardo83
09-16-2007, 04:41 AM
Great,works like a charm, only one problem.

http://www.alizee-forum.com/profile.php?do=editprofile&langid=1

all the descriptions of occupation, location etc all 3 fields above lost their description? hows that happening? 5th field is rss feed

Riccardo83
09-16-2007, 07:51 AM
Anyway I think I can fix that myself, BIGGEST PROBLEM is that quick reply wont work after installing plugin.

It releads the whole page, and sometimes says double entry. If i disable ur plugin it works properly.

pmkb
09-17-2007, 11:24 AM
I couldn't see the profile page - it requires being a logged in member. Are you using the default template for that page? I haven't noticed any problems in the profiles on my forums.

I'll investigate the quick reply.

pmkb
09-17-2007, 12:42 PM
From what I can see, the Quick Reply function and edit functions using AJAX still work, but they don't clean up the page they way they should when you click the submit/ok buttons. Looks like the problem lies in the Magpie fetch_rss function. It's beyond my coding skills to diagnose/fix this problem. :(

basketmen
09-22-2007, 02:18 AM
i am using this hack with 3.6.5

i have problem too with quick reply each time i am using quick reply i get error message but the reply is saving,

if i disable the plugin i dont get error message again

hmm some one must fix this problem

pmkb
09-22-2007, 08:15 PM
Yeah, it's a real shame because Magpie can parse Atom feeds and the CaRP solution does not.

There is something in the Magpie code that is conflicting with the AJAX functions. I'm not familiar enough with vB's system (or php coding) to figure out where the conflict is, but if someone finds it, they can post a solution (please!).

Riccardo83
09-23-2007, 05:36 AM
A shame theres no fix yet....

adnan2007
09-27-2007, 02:53 PM
# Be sure when installing to create a cache sub-directory inside the magpie directory and CHMOD it to 777.
# In your vB ACP, add a new user profile field. I used the following:

Is this necessary, would in not work as 600?

Edit:
Please disregard. I thought u were referring to the files and not the directory.


thx

Riccardo83
11-02-2007, 05:48 AM
still no fix, what a shame, gonna take this mod off then...

azn_romeo_4u
11-20-2007, 03:51 PM
Does this mod work with the vblog?

Jeffro2pt0
11-25-2007, 04:26 AM
Can someone who doesn't have physical or root access to the server actually use this mod or install magpierss to the server?

pmkb
11-28-2007, 12:20 AM
Magpie can be installed in any folder on your server. It doesn't have to be in the server/domain root. I would suggest you try it. Magpie is easy to install/remove IMO.

redraider
01-22-2008, 03:48 PM
resolved.

redraider
01-24-2008, 07:30 PM
I have a problem when I enable this product, no one is able to see private messages anymore. I am using vb368 PL2 so this shouldnt be happening. Could you please guide me in the correct direction?

Brandon Sheley
05-27-2008, 05:16 AM
with the magpir rss, do we really just upload the 4 .inc files and the extib folder, then creat a cache folder and chmod it to 777 inside another folder ?



in the faq's
Installation

1.

How do I install MagpieRSS?

See: http://laughingmeme.org/magpie_blog/?p=80

goes to a dead link :(

I'm trying to test it right here
http://forum.vbulletinsetup.com/custom-pages-blog-test.html

kevcj
06-19-2008, 02:15 AM
with the magpir rss, do we really just upload the 4 .inc files and the extib folder, then creat a cache folder and chmod it to 777 inside another folder ?
in the faq's
Installation

1.

How do I install MagpieRSS?

See: http://laughingmeme.org/magpie_blog/?p=80

goes to a dead link :(

I'm trying to test it right here
http://forum.vbulletinsetup.com/custom-pages-blog-test.html

I downloaded the magpie folder from this link - http://magpierss.sourceforge.net/

unzipped - and then uploaded the entire folder to the forum root. Created the cache folder inside the magpie folder. But if you edit the XML file, and use the forum root cache folder, do you really need another one?

But anyway, this is working fine on my site - VB 3.7.0

Here is a Link - http://www.survivalistboards.com/showthread.php?t=15737

kevcj
06-20-2008, 12:21 AM
Well, I should have read the whole thread on this topic, and I am having the same problem with double post and quick reply.

Wonderful addon, but gonna have to uninstall. :(

pmkb
07-10-2008, 05:34 PM
I've updated the mod description to warn folks who don't read through the thread.

C138 Kaysone
01-22-2009, 01:23 AM
I love this but i wish there was one for 3.8.0

JohorBahru
05-06-2009, 02:05 PM
I downloaded the magpie folder from this link - http://magpierss.sourceforge.net/

unzipped - and then uploaded the entire folder to the forum root. Created the cache folder inside the magpie folder. But if you edit the XML file, and use the forum root cache folder, do you really need another one?

But anyway, this is working fine on my site - VB 3.7.0

Here is a Link - http://www.survivalistboards.com/showthread.php?t=15737

thanks for the info.. just wondering could it be used for 3.7.5
thank you:)

Farman
08-24-2009, 09:38 PM
I wanted this for 3.8.4 But seems to have problem :(