Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
  #1  
Old 08-23-2016, 10:41 PM
Outlaw Mantis Outlaw Mantis is offline
 
Join Date: Nov 2013
Location: Manchester, UK
Posts: 59
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default /me support?

Back on my MyBB board I had support for /me. For instance...

[high]* Outlaw Mantis is eating a sandwich
[/high]
Becomes...
Outlaw Mantis is eating a sandwich

Kind of pointless but fun feature. I can't find such a plugin. Is it possible on vBulletin? I know it probably is with BBcode but that's a bit cumbersome for a lot of users.
Reply With Quote
  #2  
Old 08-23-2016, 11:06 PM
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Location: St. Augustine, FL
Posts: 3,853
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That would be easy to do with a plugin...do you want the string /me to be changed to the username of the author of the post, or to the name of the user viewing the post?

--------------- Added [DATE]1472006810[/DATE] at [TIME]1472006810[/TIME] ---------------

To have "/me" replaced with the username of the post author and "/you" replaced with the username of the user viewing the post, create a plugin hooked at "postbit_display_complete" with the PHP code:

PHP Code:
$post['message'] = str_replace(array('/me''/you'), array($post['username'], $vbulletin->userinfo['username']), $post['message']); 
Reply With Quote
2 благодарности(ей) от:
blind-eddie, Brandon Sheley
  #3  
Old 08-24-2016, 01:16 AM
Outlaw Mantis Outlaw Mantis is offline
 
Join Date: Nov 2013
Location: Manchester, UK
Posts: 59
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

[high]* Outlaw Mantis works great. I'm just waiting on another member to test /you. One thing is that the /you text appears blank to the poster, but that's no big deal if it works with other members.[/high]

Thanks, you're a genius.
Reply With Quote
  #4  
Old 08-24-2016, 01:18 AM
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Location: St. Augustine, FL
Posts: 3,853
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The string "/you" should show your username, even if you are the author of the post. That's what it does on my local dev site at least.
Reply With Quote
  #5  
Old 08-24-2016, 01:30 AM
Outlaw Mantis Outlaw Mantis is offline
 
Join Date: Nov 2013
Location: Manchester, UK
Posts: 59
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Could it be to do with the execution order?




Knowing me I've done something stupid.
Reply With Quote
  #6  
Old 08-24-2016, 02:31 AM
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Location: St. Augustine, FL
Posts: 3,853
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I used the default of 5.

--------------- Added [DATE]1472022341[/DATE] at [TIME]1472022341[/TIME] ---------------

This plugin code is more robust:

PHP Code:
$post['message'] .= ' ';

$post['message'] = preg_replace('/\/you([^A-Za-z_])/i'$vbulletin->userinfo['username'] . "$1"$post['message']);

$post['message'] = preg_replace('/\/me([^A-Za-z_])/i'$post['username'] . "$1"$post['message']); 
It will ignore strings like "/meat" and "/yourname" for example.
Reply With Quote
  #7  
Old 08-24-2016, 06:07 PM
Outlaw Mantis Outlaw Mantis is offline
 
Join Date: Nov 2013
Location: Manchester, UK
Posts: 59
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I updated the code, but the problem persists. I'll PM you a link so perhaps you can inspect the source. Thanks.
Reply With Quote
Reply

Thread Tools
Display Modes

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 01:31 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.04631 seconds
  • Memory Usage 2,226KB
  • Queries Executed 13 (?)
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
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (2)post_thanks_box_bit
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete