Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
  #1  
Old 01-31-2011, 02:49 AM
David Karol David Karol is offline
 
Join Date: Jan 2011
Posts: 43
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Show Real Names on Forum

We recently converted in FUDforum. We have always required "Real Names" in order to post in the forum. Here, there is no field for an Alias to display throughout the site.

Searching through the forums, I found multiple posts on having a custom profile field's entry display above each specific post. Is there a way to replace any display of a username throughout the entire site with that custom profile field's entry? (Display Name or Real Name)

Thanks
Reply With Quote
  #2  
Old 01-31-2011, 06:14 AM
Xencored Xencored is offline
 
Join Date: Sep 2008
Location: UK, Scuny
Posts: 1,337
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Not without mass editing all your templates (and i do mean mass editing there would be alot)
Thats the only way i could think of doing this
Reply With Quote
  #3  
Old 01-31-2011, 08:16 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You could try creating a replacement variable.
Reply With Quote
  #4  
Old 01-31-2011, 11:02 AM
David Karol David Karol is offline
 
Join Date: Jan 2011
Posts: 43
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Boofo View Post
You could try creating a replacement variable.
What is a replacement variable?
Reply With Quote
  #5  
Old 01-31-2011, 01:20 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by David Karol View Post
What is a replacement variable?
Admin CP -> Styles & Templates -> Style Manager -> Replacement Variables
Reply With Quote
  #6  
Old 01-31-2011, 09:20 PM
David Karol David Karol is offline
 
Join Date: Jan 2011
Posts: 43
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Boofo View Post
Admin CP -> Styles & Templates -> Style Manager -> Replacement Variables
Thanks, I'm looking at that now. So when I create a user defined field, I'm guessing that it would be a certain "variable," so every time the user-name variable comes up, it would be replaced with the "variable" of my choosing?

What is the user-name variable called right now?

Thanks
Reply With Quote
  #7  
Old 01-31-2011, 10:24 PM
your24hourstore your24hourstore is offline
 
Join Date: Feb 2010
Posts: 1,226
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

<a href="https://vborg.vbsupport.ru/showthread.php?t=228961" target="_blank">https://vborg.vbsupport.ru/showthread.php?t=228961</a>
Reply With Quote
  #8  
Old 01-31-2011, 11:23 PM
David Karol David Karol is offline
 
Join Date: Jan 2011
Posts: 43
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by your24hourstore View Post
Thanks for the link. We are looking for it to display all over the site instead of the actual username. Is that possible, instead of having it display along with the post count?

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

Quote:
Originally Posted by David Karol View Post
Thanks, I'm looking at that now. So when I create a user defined field, I'm guessing that it would be a certain "variable," so every time the user-name variable comes up, it would be replaced with the "variable" of my choosing?

What is the user-name variable called right now?

Thanks
Using Replacement Variables, to test the idea, I tried replacing $bbuserinfo[username] with $bbuserinfo[userid]. It did not replace the username outside of a post I created containing "$bbuserinfo[username]". So from that, I assume Replacement Variables only affect message content.
Reply With Quote
  #9  
Old 02-17-2011, 04:18 PM
jcorall jcorall is offline
 
Join Date: Feb 2011
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Not sure if what I did will be of help for this topic. Hopefully someone else will get some use out of it. It works great for my environment. I'm using vBulletin 4.1.2

I wanted users to login with their email addresses, but have their names display when they post on the forum. For my message board, I will be registering all my users. So in username, I just put their full name. But when they log in all they will have to do is enter their email address. (Instead of logging in as "Art Vandelay", just avandel@domain.com)

I went into phpMyAdmin and created a new table in my vbulletin database called 'user_alias'. 'user_alias' has two fields - 'login' and 'display'.


I then edited vBulletin's code. I added a statement in the registration code so the alias will be inserted into my newly created table whenever I add a new user in admincp. So open admincp/user.php and around line 1060 right before
Code:
// save data
	$userid = $userdata->save();
I added

Code:
        /**add user alias*/
        $emailAddress = $vbulletin->GPC['user']['email'];
	$displayName = $vbulletin->GPC['user']['username'];

        //make sure not already in user_alias
        $result = mysql_query("select * from user_alias where displayName = '$displayname'");
        if ( mysql_num_rows($result) == 0){
          mysql_free_result($result);
          $useralias_query = "insert into user_alias(display,login) values('$displayName','$emailAddress')";
          $result = mysql_query($useralias_query) or die("failed to insert username alias");
        }
        mysql_free_result($result);


I then added some php to another vBulletin file to query the database and lookup the user's alias whenever someone logs in. The file is 'login.php' around line 100, right before
Code:
// can the user login?
	$strikes = verify_strike_status($vbulletin->GPC['vb_login_username']);
I added:

Code:
	//change login name to display name
	$login_name = $vbulletin->GPC['vb_login_username'];
	$useralias_query = "select display from user_alias where login = '$login_name'";
	$result = mysql_query($useralias_query) or die("failed alias name lookup");
	$row = mysql_fetch_array($result, MYSQL_NUM);
	if(! empty($row[0])){
          $vbulletin->GPC['vb_login_username'] = $row[0];
	}
        mysql_free_result($result);

So now when someone logs in they use their email, but it actually will log them in as their fullname.

This of course can be customized a bunch of different ways. For instance if everyone on the messageboard will have the same domain name "@whatever.com" you could have them login with just the first part of their email.

Or you could edit the user registration instead of the admin registration to do this. Just follow the first php edit except find a way to do it in register.php located in the root of the website.

-Joe Corall
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 05:35 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.04040 seconds
  • Memory Usage 2,246KB
  • 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
  • (4)bbcode_code
  • (5)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)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
  • 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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete