Jump to content

Convert name to WikiName


jcanker

Recommended Posts

I'm trying to create a web page that registers users in our internal php tools db table, our xmb forum members table, and our wiki authors table with one registration form.  The wiki uses wikinames as the login, so I need to convert the created username into a wikiname.  Registration is turned off to the public, so our board managment will be creating the users.  Generally, the usernames will be firstnamelastname, but that will not always be the case eg hyphenated last names.  The username will ALWAYS start with the first name, however.

 

I'm trying to write a function to convert the username to a wiki name (2 words run together; each word is capitalized.)  The user "Test Dude" would have a username of "testdude" but needs a wikiname of TestDude.

 

Here's what I've been experimenting with: (fname is the first name from the form and $longname is the username entered on the form...they're created from the $_POST data earlier in the code...

$length = strlen($fname);
    $length = $length++;
$wikiname = ucfirst($longname);
strtoupper($wikiname[$length]);
return $wikiname;

 

This is converting the first letter fine with the ucfirst, but the first letter of the last name is not working properly.  It is returning Testdude instead of TestDude.

I'm sure it's a simple fix.  Can anyone tell my why it's not working?

Link to comment
https://forums.phpfreaks.com/topic/65659-convert-name-to-wikiname/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.