vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Hello [username]! (https://vborg.vbsupport.ru/showthread.php?t=93145)

i-Xp 07-29-2005 05:13 PM

Hello [username]!
 
Wherever I put this tag in my title, post or sig your logged in username will appear. If you're not logged in then something else pre-defined will show up.

I have seen this in action on a live board. How can I do it? I searched this forum but I haven't had a lot of luck :(

Thank you.

Andreas 07-29-2005 05:17 PM

Hookname: global_complete
PHP Code:

$output str_replace('[username]'$vbulletin->userinfo['username'], $output); 

Please note that this replace takes place EVERYWHERE.

i-Xp 07-29-2005 05:23 PM

Ok, couple of questions.

So, I can start a topic that says "Hi [username], how are you today?" and it will output for instance, "Hi KirbyDE, how are you today?"

What file does this go in to?

Andreas 07-29-2005 05:40 PM

1) Yes
2) No File - Hook global_complete

i-Xp 07-29-2005 05:43 PM

Thank you :)

What would it display to a user who is not logged in?

How can it be : "Guest" ?

Andreas 07-29-2005 05:56 PM

Unregistered User or smth. like that.

bchertov 07-29-2005 06:18 PM

<off topic>

KIRBY!
Please contact me ASAP! I need the a file you changed for me.
It's URGENT!

Barry@waccobb.net

Boofo 07-29-2005 11:00 PM

How do we make the plug-in for this?

Shy 07-31-2005 08:24 AM

It doesn't work with 3.5.0 RC 1 for me.
Any idea why?

Andreas 07-31-2005 10:03 AM

Just tested, works fine for me on RC 1

Boofo 07-31-2005 10:31 AM

Any way to get it to work with editpost?

Andreas 07-31-2005 10:32 AM

It works everywhere, just like replacement Variables.

Boofo 07-31-2005 10:36 AM

Quote:

Originally Posted by KirbyDE
It works everywhere, just like replacement Variables.

LOL You're right. I guess I didn't test editing a post. Great job, sir! ;)

Blows the one I did for vb3 all to you-know-what. One less I have to mess with. ;)

Boofo 08-01-2005 12:06 PM

But it doesn't work in the archive. Any way to fix that?

Andreas 08-01-2005 12:14 PM

Not without a File edit ...

Boofo 08-01-2005 12:54 PM

And what would that be?

Andreas 08-01-2005 12:58 PM

Easiest way:
At start of index.php put
PHP Code:

ob_start(); 

At the end put
PHP Code:

$output ob_get_contents();
ob_end_clean();
echo 
str_replace('[username'], $vbulletin->userinfo['username'], $output); 


Boofo 08-01-2005 01:02 PM

Then that should cover it for the whole site, right?

Andreas 08-01-2005 01:04 PM

For the whole archive, yes.

Boofo 08-01-2005 01:09 PM

For some reason, that didn't work. :(

Andreas 08-01-2005 01:10 PM

Hmm .. it should.
You edited the correct index.php (rember there are three of them), right?

Boofo 08-01-2005 01:13 PM

The archive index.php, right?

Andreas 08-01-2005 01:16 PM

Yes. Just tested, does work for me.

Boofo 08-01-2005 01:24 PM

Ok, where exactly did you put it? I did it right after the opening php tag and right before the ending one.

Andreas 08-01-2005 01:26 PM

Above
PHP Code:

// #######################################################################
// ######################## START MAIN SCRIPT ############################
// ####################################################################### 

And above the closing Tag.

Boofo 08-01-2005 01:31 PM

Damn! It still shows the actual [you] tag and not the username in the archive post. I did the edit exactly as you said, too. :(

Boofo 08-01-2005 01:34 PM

Scratch that last post. It works. ;)

I'm too embarrassed to admit what I did so that will be MY secret (like the thread creationtime?) ;)

Boofo 08-01-2005 01:40 PM

This line is giving me fits:

PHP Code:

 echo str_replace('[username'], $vbulletin->userinfo['username'], $output); 

I am getting an error with it.

EDIT:

I changed it to this and I no longer get any errors.

PHP Code:

 echo str_replace('[username]'$vbulletin->userinfo['username'], $output); 

But it's just not working. I can still see the tag in the past in the archive. :(

Andreas 08-01-2005 02:11 PM

Yeah, that was a typo :)
Hmm, don't know why it isn't working for you - works for me.

Boofo 08-01-2005 02:14 PM

Is there another way to do it then? It's got me stumped.

Andreas 08-01-2005 02:18 PM

Think so. But IMHO the way I posted is the easiest.

PM me FTP details and i'll take a look.

Boofo 08-02-2005 12:22 PM

I found the problem. I was using [username] in the first variable where I should have been using [you]. DUH on me! ;)

It works like a charm now. ;)

Thank you, sir. ;)

Brandon Sheley 08-17-2005 06:48 AM

hm, i can't seem to get it. i just put the php code in the arcive.index and it shoudl show the userid when [username] is typed ? in the title and in the body ? cuz it doesn't show for me. do i have to activate something ?

havefun 10-14-2005 01:02 PM

working fine, THX kirby :)

Extreme John 10-25-2005 04:34 AM

Wow first time working with code like this and it was a charm, you rock Andreas thank you, I have been looking for this forever for both versions.

Nutz 10-27-2005 11:54 PM

Quick question; how come when you use quick edit and enter [username] it is displayed as "[username]" not "KerbyDE"?

Thanks,
Mat

WiBu 01-31-2006 02:44 PM

Very nice. Could be very useful in a lot of situations.

TheMusicMan 02-05-2006 07:35 PM

When I edit the post, then save, it shows [username] and not themusicman or whatever???

Borgs8472 02-05-2006 09:20 PM

^ ^
yeah.

If you 'go advanced' it gets fixed, however it's no longer dynamic...

TheMusicMan 02-16-2006 02:12 PM

^ Thanks.

Is there any way this can be enhanced so as only Admins/Smods/Mods can use it? Is there a conditional I can wrap around the php code to effect this?

Cheers.


All times are GMT. The time now is 04:52 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.02641 seconds
  • Memory Usage 1,788KB
  • 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
  • (6)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
  • (40)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