vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Use BBCode in usertitle (https://vborg.vbsupport.ru/showthread.php?t=319864)

Dave Strider 08-14-2015 04:41 AM

Use BBCode in usertitle
 
What I would like to do is allow specific usergroups to be able to use BBCode to format their usertitle. Is there a way to do this via plugin?

Andr? Noberto 09-01-2015 12:06 AM

I guess you could try something like this

PHP Code:

require_once(DIR '/includes/class_bbcode.php');
$newUserTitle $post['usertitle'];
    
//Use [c] for [color], it will save some characters from the usertitle limit.
$newUserTitle preg_replace('#\[c(.*?)\](.*?)\[\/c\]#','[color\1]\2[/color]',$newUserTitle);
    
$bbcode_parserx = new vB_BbCodeParser($vbulletinfetch_tag_list());
$newUserTitle $bbcode_parserx->do_parse($newUserTitle truefalsetrue falsefalsefalse);
    
$post['usertitle'] = $newUserTitle

You could use hooks like:
postbit_display_complete
profile_complete
etc...

The hook will change according to the location you want to enable it.

I'm not sure if this is going to work, as I haven't tried but please post your results here after testing.

Dave Strider 09-21-2015 08:37 PM

Sorry for the late reply, been a tab busy these days. As for the code, it does work in threads, however, it doesn't work in profiles. In profiles it will just simply display the code that was entered in the User Control Panel.

Andr? Noberto 09-24-2015 03:40 PM

Have you created a plugin for each hook?

Dave Strider 09-25-2015 10:29 PM

Yeah, I tried that, and sadly no luck. I even tried replacing $post['usertitle'] with $prepared['usertitle'] since that's what used to call the usertitle in the MEMBERINFO template.

Andr? Noberto 09-26-2015 07:00 PM

Try adding a new plugin with same code with the hook location: member_complete and fetch_userinfo.

It's supposed to work after this.
Try it.


All times are GMT. The time now is 03:16 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.01566 seconds
  • Memory Usage 1,719KB
  • 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_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)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