vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Template Modifications (https://vborg.vbsupport.ru/forumdisplay.php?f=246)
-   -   New Posting Features - Latest Blog in Postbit Using Carp for vBulletin 4.x (https://vborg.vbsupport.ru/showthread.php?t=234254)

djbaxter 01-26-2010 10:00 PM

Latest Blog in Postbit Using Carp for vBulletin 4.x
 
1 Attachment(s)
This is an update for nevetS' mod for 3.5 at https://vborg.vbsupport.ru/showthread.php?t=91781 and gotlinks' update for 3.6 at https://vborg.vbsupport.ru/showthread.php?t=163718 to make it work in 4.x.

If you already have Carp Free or Carp LE or Carp Evolution, great. If not, you'll have to download a copy from http://carp.docs.geckotribe.com/download.php (Carp Free is now renamed Carp LE). If you need to install Carp first, golinks has some instructions at https://vborg.vbsupport.ru/showthread.php?t=163718 and there are of course more detailed instructions at http://carp.docs.geckotribe.com/

Now, modify your vBulletin installation.

1. Add three custom profile fields - in my setup, they are as follows, but make a note of the field# for later in case yours are different:
  1. Name = Blog RSS Feed (RSS Only!)
    Single-Line Text Box Editable, Searchable, Members field6
    The member enters his blog feed here.
  2. Latest Blog Title
    Single-Line Text Box Searchable, Members field7
    This is filled automatically by Carp with the latest blog post at that feed.
  3. Blog URL
    Single-Line Text Box Searchable, Members field8
    This is the URL to the blog, filled by Carp and used in postbit to make the blog title a live URL.

2. Create a new plugin called Carp Configuration and attach it to hook location: global_bootstrap_init_start

PHP Code:

global $vbulletin;
require_once 
'./carp/carp.php';
CarpConf('carperrors',0);
CarpConf('cacheinterval',3);
CarpConf('cborder','');
CarpConf('poweredby','');
CarpConf('maxitems',1);
CarpConf('iorder','link');
CarpConf('linktarget',1); 

3. Create another plugin called Get Users Blog Entry and attach this to hook location: postbit_display_start

PHP Code:

global $vbulletin;
ob_start();
CarpCacheShow($post[field6]);
$blogentry ob_get_contents();
ob_end_clean();
vB_Template::preRegister('postbit',array('blogentry' => $blogentry)); 


4. Edit postbit (and/or legacy):

Find:

PHP Code:

<vb:if condition="$post['rank']">
                        <
span class="rank">{vb:raw post.rank}</span>
                    </
vb:if> 

Add after:

PHP Code:

<!-- latest blog hack -->
<
vb:if condition="$post['field6']">
<
span class="smallfont">Recent Blog: <a href="{vb:raw post.field8}" target="_blank">{vb:raw blogentry}</a></span>
</
vb:if>
<!-- 
end latest blog hack --> 

Remember to change field6 and field8 to correspond to the numbers of the custom fields for your forum.

For postbit_legacy, use this code instead (thanks to 993ti who posted this here:

PHP Code:

ob_start();  
CarpCacheShow($post[field6]);  
$blogentry ob_get_contents();  
ob_end_clean();  
vB_Template::preRegister('postbit_legacy',array('blogentry' => $blogentry)); 


djbaxter 01-26-2010 11:29 PM

If you wish to restrict the latest blog display to only members in good standing, follow the instructions above but use the following code for postbit:

PHP Code:

<!-- latest blog hack for members in good standing only -->
<
vb:if condition="!in_array($bbuserinfo[usergroupid],array(G1,G2,G3,G4,G5))">
<
vb:if condition="$post['field6']">
<
span class="smallfont">Recent Blog: <a href="{vb:raw post[field8]}" target="_blank">{vb:raw blogentry}</a></span>
</
vb:if>
</
vb:if>
<!-- 
end latest blog hack for members in good standing only --> 

Replace "G1,G2,G3,G4,G5" by the usergroup ID numbers of any groups who should NOT show the latest blog.

For example, I restrict privileges for new members for the first 10 posts so they don't get to display their blogs. Similarly, I don't want blog titles and links displayed for banned members.

Therefore, I disable this for the following groups:
New member (Registered Members): 2
Probation: 22
Banned: 20
Blocked: 30
Post Moderation: 28
so I would use the following code in postbit:

PHP Code:

<!-- latest blog hack for members in good standing only -->
<
vb:if condition="!in_array($bbuserinfo[usergroupid],array(2,20,22,28,30))">
<
vb:if condition="$post['field6']">
<
span class="smallfont">Recent Blog: <a href="{vb:raw post[field8]}" target="_blank">{vb:raw blogentry}</a></span>
</
vb:if>
</
vb:if>
<!-- 
end latest blog hack for members in good standing only --> 


993ti 01-28-2010 07:33 PM

Nice mod, thx, comes in handy on my forum :)
Might want to add that if you use postbit_legacy the plugincode of Get Users Blog Entry should be
Code:

ob_start(); 
CarpCacheShow($post[field6]); 
$blogentry = ob_get_contents(); 
ob_end_clean(); 
vB_Template::preRegister('postbit_legacy',array('blogentry' => $blogentry));

;)

djbaxter 01-28-2010 07:53 PM

Thanks, 993ti. Added in OP and credited to you. :)

ChaibiAlaa 04-19-2010 08:57 PM

I did everything, and the blog rss isn't showing, only the text "Recent Blog :" is showing up, no URL neither RSS title .. I did EVERYTHING without any expetion ! I even changed cache time to 1 minute and still nothing shown from my blog, here is the url of a thread where nothing shown in my profile http://www.blogging-talk.com/showthr...?t=3&p=4#post4

ChaibiAlaa 04-19-2010 09:02 PM

Now working very great when I used the postbit_legacy code :D I was too Dunky first time :p

Tryppnotic69 06-08-2010 04:55 PM

Works great on 4.0.3

Thanks so much for this great mod!

daveaite 08-16-2010 02:00 PM

It works perfectly but it affects my cms when a comment is posted in one of the articles via CMS and not the forums (SUITE Version 4.06), trying to figure out why it causes this error:

Quote:

Fatal error: Call to undefined function CarpCacheShow() in /home/buypoe/public_html/includes/class_postbit.php(284) : eval()'d code on line 2
Is it because CMS does not use postbit and its trying to find it?

djbaxter 08-16-2010 02:19 PM

Try this:
  1. Go into Admin CP | Plugins & Products | Plugin manager
  2. Find and edit the two p[lugins: Carp Configuration and Get Users Blog Entry
  3. Change the hook locations for both to global_complete

djbaxter 08-16-2010 02:45 PM

Apparently, that didn't work for davaeaite.

Until recently, I wasn't using the CMS because it was too buggy. I'm just trying it out now and obviously something needs to be changed to register these variables more globally.

I'll update when/if I can figure it out. For now, it works for forum only.


All times are GMT. The time now is 12:21 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.01353 seconds
  • Memory Usage 1,774KB
  • 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
  • (7)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete