Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.