Page Index Toggle Pages: 1
Topic Tools
Normal Topic Different user ID and display name (Read 5,371 times)
Jet Li
Legacy Dev Team
Development Team
****
Offline



Posts: 6,588
Location: Hong Kong
Re: Different user ID and display name
Reply #9 - Aug 14th, 2010 at 11:47am
Post Tools
New
Admin/Maintenance.pl
in CVS.
  

PM me for YaBB Installation Service
Back to top
WWWGTalkFacebook  
IP Logged
 
Carsten
Ex Member


Re: Different user ID and display name
Reply #8 - Aug 13th, 2010 at 11:46am
Post Tools
Just found an issue when rebuilding memberlist:

In Maintenance.pl find
Code
Select All
		&LoadUser($member); 


and add after
Code
Select All
		&FromChars(${$uid.$member}{'realname'}); 

  
Back to top
 
IP Logged
 
Carsten
Ex Member


Re: Different user ID and display name
Reply #7 - Aug 5th, 2010 at 1:36pm
Post Tools
Yeah i know - what i ment to say was that compared to the way it was done there's no additional load - the difference is that now the 'load' results in correct information (or no info and 'load' if the user removes content from a field). Instead of passing text variables and graphics through plain js i found this solution more 'elegant'. We are talking 'small' content and no additional checking in the Register/Profile edit page - not heavy handling of large amount of data on a busy page. If you have a better way you are of course free to implement that.
« Last Edit: Aug 5th, 2010 at 1:38pm by »  
Back to top
 
IP Logged
 
Unilat
Development Team
Theme Team
****
Offline



Posts: 1,047
Location: Columbus Ohio, USA
Re: Different user ID and display name
Reply #6 - Aug 5th, 2010 at 10:14am
Post Tools
Yea its ajax so it calls another page remotely which processes the data and then sends it back. Which is excessive because the javascript alone can check if the two boxes are the same.
  
Back to top
 
IP Logged
 
Carsten
Ex Member


Re: Different user ID and display name
Reply #5 - Aug 4th, 2010 at 10:14pm
Post Tools
Unilat wrote on Aug 4th, 2010 at 10:02pm:
Why was this necessary to put in the perl code?

Just check with the same onchange event whether or not the value is equal to the other box's value. Would be plain javascript and no ajax or additional page load....

?? not sure i understand what you are talking about - there's no additional page load. It is using the same onchange event - the only thing added to the perl code is passing the value of the '$name_cannot_be_userid' var to tell  javascript whether or not different user ID / display name is required.
  
Back to top
 
IP Logged
 
Unilat
Development Team
Theme Team
****
Offline



Posts: 1,047
Location: Columbus Ohio, USA
Re: Different user ID and display name
Reply #4 - Aug 4th, 2010 at 10:02pm
Post Tools
Why was this necessary to put in the perl code?

Just check with the same onchange event whether or not the value is equal to the other box's value. Would be plain javascript and no ajax or additional page load....
  
Back to top
 
IP Logged
 
Jet Li
Legacy Dev Team
Development Team
****
Offline



Posts: 6,588
Location: Hong Kong
Re: Different user ID and display name
Reply #3 - Aug 4th, 2010 at 8:53pm
Post Tools
New
Sources/Profile.pl
in CVS.
  

PM me for YaBB Installation Service
Back to top
WWWGTalkFacebook  
IP Logged
 
Carsten
Ex Member


Re: Different user ID and display name
Reply #2 - Aug 4th, 2010 at 8:26pm
Post Tools
Forgot about Profile change display name:

In Profile.pl find:

Code
Select All
	&LoadLanguage('Register');
	$showProfile   .= qq~
<form action="$scripturl?action=$scriptAction;username=$useraccount{$INFO{'username'}};sid=$INFO{'sid'}" method="post" name="creator"> 



and add after:

Code
Select All
<input type="hidden" id="regusername" value="$user" /> 



then find:

Code
Select All
		<td align="left"><input type="text" maxlength="30" onchange="checkAvail('$scripturl',this.value,'display')" name="name" id="name" size="30" value="${$uid.$user}{'realname'}" /><div id="displayavailability"></div></td> 



and replace it with:

Code
Select All
		<td align="left"><input type="text" maxlength="30" onchange="checkAvail('$scripturl',this.value,'display','$name_cannot_be_userid')" name="name" id="name" size="30" value="${$uid.$user}{'realname'}" /><div id="displayavailability"></div></td> 


  
Back to top
 
IP Logged
 
Jet Li
Legacy Dev Team
Development Team
****
Offline



Posts: 6,588
Location: Hong Kong
Re: Different user ID and display name (Ajax)
Reply #1 - Aug 4th, 2010 at 5:17pm
Post Tools
Nice Carsten. Smiley Works great.

New
cgi-bin/yabb2/Admin/Admin.pl
cgi-bin/yabb2/Languages/English/Register.lng
cgi-bin/yabb2/Sources/Register.pl
cgi-bin/yabb2/Sources/UserSelect.pl

public_html/yabbfiles/ajax.js

in CVS.
« Last Edit: Aug 4th, 2010 at 5:18pm by Jet Li »  

PM me for YaBB Installation Service
Back to top
WWWGTalkFacebook  
IP Logged
 
Carsten
Ex Member


Different user ID and display name
Aug 4th, 2010 at 3:08pm
Post Tools
While working on the fix for unicode characters in display name bug i noticed another problem/bug in the user ID - display name ajax check. If different user ID/display name is required the check still claims that the names are available even when they are equal.

Also if a user types something in a field and then removes it you get wrong info.

This fix requires the 'unicode fix' found here should be installed first:

http://www.yabbforum.com/community/YaBB.pl?num=1248766323/8#8

------------------

In Admin.pl find:

Code
Select All
     <td width="70%" class="windowbg"><input type="text" name="regusername" id="regusername" onchange="checkAvail('$scripturl',this.value,'user')" size="30" maxlength="18" /><input type="hidden" name="_session_id_" id="_session_id_" value="$sessionid" /><input type="hidden" name="regdate" id="regdate" value="$regdate" /><div id="useravailability"></div></td> 



and replace it with:

Code
Select All
     <td width="70%" class="windowbg"><input type="text" name="regusername" id="regusername" onchange="checkAvail('$scripturl',this.value,'user','$name_cannot_be_userid')" size="30" maxlength="18" /><input type="hidden" name="_session_id_" id="_session_id_" value="$sessionid" /><input type="hidden" name="regdate" id="regdate" value="$regdate" /><div id="useravailability"></div></td> 



then find:

Code
Select All
     <td width="70%" class="windowbg"><input type="text" name="regrealname" id="regrealname" onchange="checkAvail('$scripturl',this.value,'display')" size="30" maxlength="30" /><div id="displayavailability"></div></td> 



and replace it with:

Code
Select All
     <td width="70%" class="windowbg"><input type="text" name="regrealname" id="regrealname" onchange="checkAvail('$scripturl',this.value,'display','$name_cannot_be_userid')" size="30" maxlength="30" /><div id="displayavailability"></div></td> 



------------------

In Register.pl find:

Code
Select All
			<input type="text" name="regusername" id="regusername" onchange="checkAvail('$scripturl',this.value,'user')" size="30" value="$tmpregname" maxlength="18"$regstyle /> * 



and replace it with:

Code
Select All
			<input type="text" name="regusername" id="regusername" onchange="checkAvail('$scripturl',this.value,'user','$name_cannot_be_userid')" size="30" value="$tmpregname" maxlength="18"$regstyle /> * 



then find:

Code
Select All
			<input type="text" name="regrealname" id="regrealname" onchange="checkAvail('$scripturl',this.value,'display')" size="30" value="$tmprealname" maxlength="30" /> * 



and replace it with:

Code
Select All
			<input type="text" name="regrealname" id="regrealname" onchange="checkAvail('$scripturl',this.value,'display','$name_cannot_be_userid')" size="30" value="$tmprealname" maxlength="30" /> * 



------------------

In UserSelect.pl find:

Code
Select All
     } elsif ($INFO{'type'} eq "user") { 



and add before:

Code
Select All
     } elsif ($INFO{'type'} eq "nouserid") {
 	    $type = $register_txt{'110'};
	    $taken = "notuserid";
     } elsif ($INFO{'type'} eq "nodisplay") {
 	    $type = $register_txt{'111'};
	    $taken = "notdisplay"; 



then find:

Code
Select All
 	    $avail = qq~<img src="$imagesdir/cross.png">&nbsp;&nbsp;<span style="color:#dd0000">$type$register_txt{'113'}</span>~; 



and add after:

Code
Select All
     } elsif ($taken eq "notuserid") {
 	    $avail = qq~<img src="$imagesdir/cross.png">&nbsp;&nbsp;<span style="color:#dd0000">$type$register_txt{'117'}</span>~;
	    $INFO{'type'} = "user";
     } elsif ($taken eq "notdisplay") {
 	    $avail = qq~<img src="$imagesdir/cross.png">&nbsp;&nbsp;<span style="color:#dd0000">$type$register_txt{'116'}</span>~;
	    $INFO{'type'} = "display"; 



------------------

In Register.lng find:

Code
Select All
'115' => 'is reserved.', 



and add after:

Code
Select All
'116' => 'is the same as your user ID.',
'117' => 'is the same as your display name.', 



------------------

In ajax.js find:

Code
Select All
function checkAvail(scripturl,val,type) { 



and replace it with:

Code
Select All
function checkAvail(scripturl,val,type,namenotid) {

	document.getElementById(type + "availability").innerHTML = '';
	if (val == '') return;

	var tmptype = type;
	if (namenotid == 1) {
		if (type == 'user')    { if (val == document.getElementById('regrealname').value) tmptype = 'nouserid'; }
		if (type == 'display') { if (val == document.getElementById('regusername').value) tmptype = 'nodisplay'; }
	} 



then find:

Code
Select All
	xmlHttp.open("GET", scripturl + "?action=checkavail;type=" + type + ";" + type + "=" + urivalstr, true); 



and replace it with:

Code
Select All
	xmlHttp.open("GET", scripturl + "?action=checkavail;type=" + tmptype + ";" + type + "=" + urivalstr, true); 

« Last Edit: Aug 4th, 2010 at 3:17pm by »  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Topic Tools
 
  « Board Index ‹ Board  ^Top