View Full Version : Administrative and Maintenance Tools - Username Change Alert
MarkFL
06-16-2016, 09:00 PM
Overview:
This product allows you to designate a forum in which a thread is created and posted to in order to serve as a log of changed usernames. You set the title of the thread and the format of the posts within the thread.
You may also select usergroups whose members can change their own usernames in the UserCP, on the "Edit Profile" page:
https://vborg.vbsupport.ru/attachment.php?attachmentid=155154&stc=1&d=1466323274
Updates:
Version 1.1:
Added setting to allow members of selected usergroups to change their own usernames.
Version 1.2:
Added new username verification.
Compatibility:
Tested and working on vB 4.2.x and may work on all 4.x.x versions of vBulletin.
Backup/Warning:
This product does not alter your database, however it is always good practice to make regular backups and you should make a backup before installing ANY new mod.
As always, products are USE AT YOUR OWN RISK. I will provide support and do my best to help but no absolute guarantee is offered.
To Install:
Download and extract the attached .zip file.
Follow AdminCP -> Plugins & Products -> Manage Products -> Add/Import Product.
Click on "Choose File" and browse to the product .xml file that was packaged in the .zip file.
Click "Import."
You MUST enable the product in the settings before it will function.
Configure the remaining settings to your liking. Each setting has a detailed explanation of its use.
https://vborg.vbsupport.ru/attachment.php?attachmentid=155153&stc=1&d=1466323274
Support for this product can be found here:
MHB - Username Change Alert (http://mathhelpboards.com/vbulletin-products-61/username-change-alert-21793.html)
TAZ - Username Change Alert (https://theadminzone.com/threads/username-change-alert.145029/)
hazem_aliraqi
06-17-2016, 09:13 PM
thank u mark
can you add in thread title the name of user like Hazem change his name
or i change my name to ... ?
MarkFL
06-17-2016, 09:30 PM
thank u mark
can you add in thread title the name of user like Hazem change his name
or i change my name to ... ?
The thread is designed to be a log of all name changes, regardless of which admin changes a user's username. It doesn't create a new thread each time a username is changed. :)
hazem_aliraqi
06-17-2016, 10:07 PM
The thread is designed to be a log of all name changes, regardless of which admin changes a user's username. It doesn't create a new thread each time a username is changed. :)
That's perfect
I thought its create a new thread for all username changed
Elixar
06-19-2016, 03:12 AM
Just wanted to check, will this work with other mods that offer the ability to the member to change their username? :)
Awesome idea Mark. :)
MarkFL
06-19-2016, 03:17 AM
Just wanted to check, will this work with other mods that offer the ability to the member to change their username? :)
Awesome idea Mark. :)
No, this product's main plugin is hooked at "useradmin_update_save" so it only generates a post when an admin changes a user's username in the "User Manager." :)
Elixar
06-19-2016, 03:42 AM
No, this product's main plugin is hooked at "useradmin_update_save" so it only generates a post when an admin changes a user's username in the "User Manager." :)
Thanks for the swift reply. :)
MarkFL
06-19-2016, 03:50 AM
Thanks for the swift reply. :)
There would really be no way that I know of catch a name change facilitated by another product as this could be done many different ways. ;)
MarkFL
06-19-2016, 06:04 AM
Update - Version 1.1:
Added setting to allow members of selected usergroups to change their own usernames.
MarkFL
06-19-2016, 04:16 PM
Update - Version 1.2:
Added new username verification.
blind-eddie
06-19-2016, 05:26 PM
Update - Version 1.1:
Added setting to allow members of selected usergroups to change their own usernames.
4.2.2 allows members to change their own name or this addon allows members to change their own username via usercp?
MarkFL
06-19-2016, 05:30 PM
4.2.2 allows members to change their own name or this addon allows members to change their own username via usercp?
This product auto-edits the "modifyprofile" template to add a username field at the top of the form. vB 4.2.x doesn't allow users to change their usernames out of the box.
This will take some work to port to vB 3.8.x since the format of the template is different, but I will get this working soon. For the time being, I have removed the statement about it working on vB 3.8.x. :)
blind-eddie
06-20-2016, 12:55 AM
Thank's Mark
BrettC Frontier
07-12-2016, 03:31 AM
Hi Mark, I looked through the code but did not see this... is there any chance of the addon having a cooldown and no-reuse period?
Cooldown: User cannot change their username no less than X days (abuse prevention).
No-reuse: Utilize the vBulletin4 option called "usernamereusedelay" in the User Registration Options section.
BrettC Frontier
12-14-2017, 08:39 AM
Minor bug found...
- Username input is not being fully sanitized. Input does not encode/escape special characters or non-alphanumeric characters such as ' " ` and so forth. The ' and " on input especially makes vBulletin unhappy, and throws SQL errors to the user and to the email configured for forum admins.
Invalid SQL:
UPDATE vb_user
SET username = 'New'userName'
WHERE username = 'CurrentUserName';
MySQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'userName'
WHERE username = 'CurrentUserName'' at line 2
Error Number : 1064
MarkFL
12-14-2017, 11:55 AM
Thanks...I just fixed that and it will be part of a major update I am working on for this product. :)
tuRiver
12-22-2017, 02:41 PM
is it possible to make it just post the alert? Because im handling username changes using a dbtech plugin. Thanks
MarkFL
12-22-2017, 04:06 PM
is it possible to make it just post the alert? Because im handling username changes using a dbtech plugin. Thanks
Not without knowing how the other product works. :)
jagtpf
01-24-2018, 08:49 AM
I have a suspicion that this product is preventing me adding a new user manually?
I have an error that appears unrelated to the 'normal' software ....
Database error in vBulletin 4.2.3 Release Candidate 1:
Invalid SQL:
SELECT thread.*
FROM thread AS thread
WHERE title = 'Username Changes'
AND forumid =;
MySQL Error : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 4
Error Number : 1064
Request Date : Wednesday, January 24th 2018 @ 09:17:52 AM
Error Date : Wednesday, January 24th 2018 @ 09:17:52 AM
Script : http://cccccccccc/admi....php?do=update
Referrer : https://ccccccccccccc/adm...ser.php?do=add
IP Address : xxxxxxxxxxxx
Username : xxxxxxxx
Classname : vB_Database_MySQLi
MySQL Version : 5.6.38
MarkFL
01-24-2018, 01:04 PM
Yes, as a hot fix for this issue, replace the code in the plugin titled "Generate Alert On Username Change (by admin)" with the following:
if ($vbulletin->options['markfl_uca_active'] AND $vbulletin->GPC['userid'])
{
$original = fetch_userinfo($vbulletin->GPC['userid']);
if ($vbulletin->GPC['user']['username'] != $original['username'])
{
require_once(DIR . '/includes/functions_databuild.php');
if ($vbulletin->options['markfl_uca_destination'])
{
$mforumid = $vbulletin->options['markfl_uca_destination'];
}
else
{
$mforumid = $vbulletin->options['rpforumid'];
}
if (!$vbulletin->options['markfl_uca_title'])
{
$title = 'Username Changes';
}
else
{
$title = $vbulletin->options['markfl_uca_title'];
}
if (!$vbulletin->options['markfl_uca_reportformat'])
{
$report = 'I have changed the following username:' . PHP_EOL . PHP_EOL . 'Old: [OLD]' . PHP_EOL . PHP_EOL . 'New: [NEW]';
}
else
{
$report = $vbulletin->options['markfl_uca_reportformat'];
}
$find = array('[OLD]', '[NEW]');
$replace = array($original['username'], $vbulletin->GPC['user']['username']);
$report = str_replace($find, $replace, $report);
$threads = $vbulletin->db->query_read("
SELECT thread.*
FROM " . TABLE_PREFIX . "thread AS thread
WHERE title = '" . $title . "'
AND forumid = " . $vbulletin->options['markfl_uca_destination']
);
$report_thread = $db->fetch_array($threads);
$muserid = $vbulletin->userinfo['userid'];
$mpostip = "";
$mallowsmilie = '1';
$mvisible = 1;
$showsig = 1;
if ($report_thread['threadid'])
{
$mpost =& datamanager_init('Post', $vbulletin, ERRTYPE_ARRAY, 'threadpost');
$reportthreadinfo = fetch_threadinfo($report_thread['threadid']);
$mpost->set_info('thread', $reportthreadinfo);
$mpost->set_info('is_automated', true);
$mpost->setr('threadid', $report_thread['threadid']);
$mpost->setr('userid', $muserid );
$mpost->setr('pagetext', $report);
$mpost->set('allowsmilie', $mallowsmilie);
$mpost->set('visible', $mvisible);
$mpost->set('ipaddress', $mpostip);
$mpost->set('showsignature', $showsig);
$mpost->pre_save();
if (count($mpost->errors) < 1 AND count($mthread->errors) < 1)
{
$mpost->save();
unset($mthread);
unset($mpost);
}
else
{
print "Error making new post! " . $mthread->errors[0] . $mthread->errors[1] . $mthread->errors[2] ;
}
build_forum_counters($mforumid);
mark_thread_read($reportthreadinfo, fetch_foruminfo($mforumid), $vbulletin->userinfo['userid'], TIMENOW);
}
else
{
$mthread =& datamanager_init('Thread_FirstPost', $vbulletin, ERRTYPE_ARRAY, 'threadpost');
$reportforuminfo = fetch_foruminfo($mforumid);
$reportthreadinfo = array();
$mthread->set_info('forum', $reportforuminfo);
$mthread->set_info('thread', $reportthreadinfo);
$mthread->set_info('is_automated', true);
$mthread->set_info('skip_floodcheck', true);
$mthread->set_info('mark_thread_read', true);
$mthread->setr('forumid', $mforumid);
$mthread->setr('userid', $muserid );
$mthread->setr('pagetext', $report);
$mthread->setr('title', $title);
$mthread->set('allowsmilie', $mallowsmilie);
$mthread->set('visible', $mvisible);
$mthread->set('ipaddress', $mpostip);
$mthread->set('showsignature', $showsig);
$mthread->pre_save();
if (count($mthread->errors) < 1)
{
$threadid = $mthread->save();
build_thread_counters($mthread);
unset($mthread);
}
else
{
print "Error making new thread! " . $mthread->errors[0] . $mthread->errors[1] . $mthread->errors[2] ;
}
build_forum_counters($mforumid);
}
}
}
jagtpf
01-24-2018, 02:21 PM
Thank you Sir....
jagtpf
01-26-2018, 05:28 AM
Confirmed as Solved. Thank you Mark.
TTayfun
01-26-2018, 02:38 PM
thanks Mark.
MarkFL
03-19-2018, 12:52 PM
I've published a major update to this product at the sites in my signature. :)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.