Please login or register. Welcome to the Studio, guest!


Quick Links:


newBookmarkLockedFalling

Chris

Chris Avatar

******
Head Coder

19,519


June 2005
==================================================

Users Modify Usernames
By: CDDude229

==================================================

Description:
This mod allows users to modify their existing username via an
option in their profile, but it also changes their login name.

==================================================

Files to modify:
- usercp.php
- templates/usercp_profile_edit.tpl

==================================================

- Open usercp.php

- Find this line:
if(isset($_POST['r_usertext'])) $r_usertext = trim($_POST['r_usertext']);

- Add this after that line:
// Start display name
if(isset($_POST['send']) && isset($_POST['r_username']) && $_POST['r_username']!="" && $_POST['r_username']!=" " && !preg_match("/ /",$_POST['r_username'])){
$r_username = $_POST['r_username'];
$r_username = str_replace("<","<",$r_username);
$r_username = str_replace(">",">",$r_username);
$r_username = str_replace('"',""",$r_username);
$r_username = str_replace("'","'",$r_username);

$meh3 = true;
$meh = $db->query("SELECT * FROM bb".$n."_users ORDER BY username DESC");

$usernamecheck = mysql_numrows(mysql_query("SELECT * FROM bb".$n."_users WHERE username='".$r_username."'"));
if($usernamecheck!="0") {
$meh3 = false;
}

if($meh3){
$db->query("UPDATE bb".$n."_users SET username = '$r_username' WHERE userid = '$wbbuserdata[userid]'");
$db->query("UPDATE bb".$n."_posts SET username = '$r_username' WHERE userid = '$wbbuserdata[userid]'");
$db->query("UPDATE bb".$n."_threads SET starter = '$r_username' WHERE starterid = '$wbbuserdata[userid]'");
$db->query("UPDATE bb".$n."_threads SET lastposter = '$r_username' WHERE lastposterid = '$wbbuserdata[userid]'");
$db->query("UPDATE bb".$n."_boards SET lastposter = '$r_username' WHERE lastposterid = '$wbbuserdata[userid]'");
}
}
// End display name mod

- Save and close usercp.php

==================================================

- Open templates/usercp_profile_edit.tpl

- Find these lines:
<tr id="tableb" bgcolor="{tablecolorb}">
<td><normalfont><b>Email Address:</b></font></td>
<td><normalfont><input type="text" class="input" name="r_email" value="$r_email" maxlength="150"></font></td>
</tr>

- And this after those lines
<tr id="tableb" bgcolor="{tablecolora}">
<td><normalfont><b>Display Name:</b></font><br><smallfont>Only edit if you want to change your name.<br>Editing this will also change your login name.<br>So when you login, you must now use this.</font></td>
<td><normalfont><input type="text" class="input" name="r_username" value="$wbbuserdata[username]" maxlength="30"></font></td>
</tr>

- Save and close usercp.php

==================================================

You have now installed the Users Modify Username mod. ;)
I hope you enjoy this mod. If you happen to find any glitches, errors,
etc. Please report them on the forum in the mod's thread. If you need
to contact me, I'm cddude229 on the forum, and you can find my
contact information their.
- CDDude229

newBookmarkLockedFalling