vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Calling out users in thread titles/announcements (https://vborg.vbsupport.ru/showthread.php?t=163489)

MariahMan 11-24-2007 05:50 AM

Calling out users in thread titles/announcements
 
I want to announce some features to my member and was wondering how i could do something like:
"Hey ____! Are you on the member map?"

With the blank being their username to catch their attention. I thought i could do it using the vbulletin phrases and did "Hey $username! Are you on the member map?" but i got exactly that. Could you guys let me know the proper way to do this?

Thanks in advance,

-Ryan

Opserty 11-24-2007 11:53 AM

I doubt you can actually set it in a thread title, since they are stored as in the database and not parsed by any sort of code. There are a number of ways that you may be able to do this, one option would be to:
  1. Create the new thread with the content and title of whatever you would like. (Note: The thread title will be show to guests so make sure it is appropriate)
  2. View the thread and make a note of the threadid it will be the number at the end of the showthread.php URL. (For example: https://vborg.vbsupport.ru/showthread.php?t=163489 it is the number in bold)
  3. Go to the Plugin Manager in the AdminCP and create a new plugin for "threadbit_display" and use the following PHP code:
    PHP Code:

    if(intval($thread['threadid']) == && $vbulletin->userinfo['userid'])
    {
        
    $thread['threadtitle'] = 'Hey '$vbulletin->userinfo['username'] .'! Are you on the member map?';


  4. Remember to change the number 8 to your threadid which you found in step 2
  5. I'm not sure how this will affect performance though since you will be running this check quite often, I don't know if there is a more efficient way to do this.

Mark.B 11-24-2007 12:03 PM

Unduly complex.....there *is* a way to do it easily with a plugin.

*This code is NOT my own, it is posted elsewhere on vbulletin.org, but I have not managed to find it again.

Create a new plugin as follows:

Product: vBulletin
Hook Location: global_complete
Title: Whatever you want to call it
Code:

$output = str_replace('[username]', $vbulletin->userinfo['username'], $output);
Now you simply start a thread with [username] in the title and everyone who views it will see their own username there.

Opserty 11-24-2007 12:21 PM

Won't that also leave it open for people to use wherever they please? For example signatures/posts/threads. I know there isn't much harm in letting other people use the markup but I'd think it would be better to restrict it somewhat.

Mark.B 11-24-2007 12:34 PM

Yes, that is true, it works anywhere and for anyone.

I daresay there will be ways of easily adapting that code to work only in specific circumstances, but I'm no coder so I can't do that.

Of course, other users would need to know the code that generates it, and you can easily amend it from [username] to something completely different just by changing the code I posted.

I used it on my forums a couple of times as a complete joke. It's quite tricky for an average user to suss it out, as it doesn't even show the tag if you quote or edit something. Nobody from my site sussed it, although I cannot say how much anyone was really that bothered!

MariahMan 11-24-2007 06:14 PM

Thanks guys for your responses. I went ahead and used your method Mark B because it was the simplest and did the job, but thanks anyways Osperty. Thanks for helping me out, that did the job perfectly in both announcements and thread titles.

Osperty does bring up an important point that this feature can now be utilized by everyone on your board. I personally am not worried about it because my board is an owners club for a specific boat brand and most of them have had troubles just figuring out how to add photos to the gallery let alone figuring this out.

Thanks guys!


All times are GMT. The time now is 11:50 PM.

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.00962 seconds
  • Memory Usage 1,724KB
  • 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
  • (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