View Single Post
  #1  
Old 03-17-2011, 11:55 PM
Andr? Noberto Andr? Noberto is offline
 
Join Date: Feb 2011
Location: Brazil
Posts: 58
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default bbcode with html on user title of all groups

hello guys, I have a very complicated question....
would enable the user vbulletin title for everyone, and it's obviously possible. but wanted everyone to use html in the user title, but this is only possible to administrators....
some time ago I saw a discussion on the topic in a forum not tied to vbulletin, and a user would have posted a part of the solution can not remember which was more the site will post more information obtained on that topic if it will help someone look at the topic.

is necessary to create three plugins.

First Plugin

1- Hook Location: "postbit_display_comple"
2- Title: Postbit
3- Plugin code:
Code:
global $vbulletin;

if($vbulletin->options['usertitlebbcode_enabled'] AND !empty($post['usertitle']))
{
	require_once(DIR . '/includes/class_bbcode.php');
	$text = $post['usertitle'];
	
	if($vbulletin->options['usertitlebbcode_banned_tags'])
	{
		$banned_tags = explode(",", $vbulletin->options['usertitlebbcode_banned_tags']);
		
		$bannedtags = array();
		
		foreach($banned_tags as $banned_tag)
		{
			$bannedtags[] = "#\[".$banned_tag.".*?\]#i";
			$bannedtags[] = "#\[/".$banned_tag."\]#i";
		}
		
		$text = !empty($bannedtags) ? preg_replace($bannedtags,'',$text) : $text;
	}
	// [c] for [color]
	$text = preg_replace('#\[c(.*?)\](.*?)\[\/c\]#','[color\1]\2[/color]',$text);
	
	// [bl] for [blink]
	$text = preg_replace('#\[bl\](.*?)\[\/bl\]#','[blink]\1[/blink]',$text);
	
	// [mq] for [marquee]
	$text = preg_replace('#\[mq\](.*?)\[\/mq\]#','[marquee]\1[/marquee]',$text);
	
	$bbcode_parserx = new vB_BbCodeParser($vbulletin, fetch_tag_list());
	$text = $bbcode_parserx->do_parse($text, true, false, true , false, false, false);
	
	$text = preg_replace("#\[n\]#","<br \/>",$text,1);
	
	$post['usertitle'] = $text;
}
Second Plugin:

1- Hook Location: "fetch_userinfo"
2- Title: Userinfo
3- Plugin code:
Code:
if($vbulletin->options['usertitlebbcode_enabled'] AND !empty($user['usertitle']))
{
	require_once(DIR . '/includes/class_bbcode.php');
	$text = $user['usertitle'];
	
	if($vbulletin->options['usertitlebbcode_banned_tags'])
	{
		$banned_tags = explode(",", $vbulletin->options['usertitlebbcode_banned_tags']);
		
		$bannedtags = array();
		
		foreach($banned_tags as $banned_tag)
		{
			$bannedtags[] = "#\[".$banned_tag.".*?\]#i";
			$bannedtags[] = "#\[/".$banned_tag."\]#i";
		}
		
		$text = !empty($bannedtags) ? preg_replace($bannedtags,'',$text) : $text;
	}

	// [c] for [color]
	$text = preg_replace('#\[c(.*?)\](.*?)\[\/c\]#','[color\1]\2[/color]',$text);
	
	// [bl] for [blink]
	$text = preg_replace('#\[bl\](.*?)\[\/bl\]#','[blink]\1[/blink]',$text);
	
	// [mq] for [marquee]
	$text = preg_replace('#\[mq\](.*?)\[\/mq\]#','[marquee]\1[/marquee]',$text);

	$bbcode_parserx = new vB_BbCodeParser($vbulletin, fetch_tag_list());
	$text = $bbcode_parserx->do_parse($text, true, false, true , false, false, false);

	$text = preg_replace("#\[n\]#","<br />",$text,1);

	$user['usertitle'] = $text;
}
Third Plugin

1- Hook Location: "forumdisplay_announcement"
2- Title: Announcement
3- Plugin code:
Code:
if($vbulletin->options['usertitlebbcode_enabled'] AND !empty($announcement['usertitle']))
{
	require_once(DIR . '/includes/class_bbcode.php');
	$text = $announcement['usertitle'];
	
	if($vbulletin->options['usertitlebbcode_banned_tags'])
	{
		$tags1 = $vbulletin->options['usertitlebbcode_banned_tags'];
		$tags1 .= ",color";
		$tags1 .= ",c";
		$tags1 .= ",blink";
		$tags1 .= ",bl";
		$tags1 .= ",mq";
		$tags1 .= ",b";
		$tags1 .= ",marquee";

		$banned_tags = explode(",", $tags1);
		
		$bannedtags = array();

		foreach($banned_tags as $banned_tag)
		{
			$bannedtags[] = "#\[".$banned_tag.".*?\]#i";
			$bannedtags[] = "#\[/".$banned_tag."\]#i";
		}
		
		$text = !empty($bannedtags) ? preg_replace($bannedtags,'',$text) : $text;
	}
	// [c] for [color]
	$text = preg_replace('#\[c(.*?)\](.*?)\[\/c\]#','[color\1]\2[/color]',$text);
	
	// [bl] for [blink]
	$text = preg_replace('#\[bl\](.*?)\[\/bl\]#','[blink]\1[/blink]',$text);
	
	// [mq] for [marquee]
	$text = preg_replace('#\[mq\](.*?)\[\/mq\]#','[marquee]\1[/marquee]',$text);

	$bbcode_parserx = new vB_BbCodeParser($vbulletin, fetch_tag_list());
	$text = $bbcode_parserx->do_parse($text, true, false, true , false, false, false);
	
	$text = preg_replace("#\[n\]#"," / ",$text,1);
	
	$announcement['usertitle'] = $text;
}
these are the only good information developed at the time, most also seem to be a functional part, if any can help me finish this work would be grateful.
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01804 seconds
  • Memory Usage 1,793KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • 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
  • showpost_complete