<?php
$plugins->add_hook("usercp_do_changename_end","UsernameChanged");
<?php
$plugins->add_hook("usercp_do_changename_end","UsernameChanged");
<?php
function UsernameChanged(){
global $mybb, $db;
$db->write_query("INSERT INTO `".TABLE_PREFIX."tlfUsernames` VALUES ('', '".$mybb->user['uid']."', '".$mybb->user['username']."','".time()."')");
}
<?php
function UsernameChanged(&$data){
if((count($data->user_update_data) < 1 && empty($data->data['user_fields'])) || count($data->user_update_data) < 1 || !isset($data->data['username']))
{
return;
}
global $db;
$db->insert_query('tlfUsernames', array(
'uid' => (int)$data->data['uid'],
'uName' => $db->escape_string($mybb->user['username']),
'lastChanged' => TIME_NOW,
));
}