2013-12-05, 05:40 PM
I am making a plugin, and when i activate it, for some reason its not automatically creating the field.
I tried setting the CHMOD permission, but for some reason it not making the field in the user table.
I tried setting the CHMOD permission, but for some reason it not making the field in the user table.
function dispname_activate() {
global $db, $mybb;
// close the board for a sec
if(!$mybb->settings['boardclosed']) {
dispname_close_board(1);
$unclose_board = true;
}
$db->write_query('ALTER TABLE `'.$db->table_prefix.'users` ADD COLUMN `loginname` varchar(120) NOT NULL default ""');
$db->write_query('UPDATE `'.$db->table_prefix.'users` SET loginname=username');
$db->write_query('ALTER TABLE `'.$db->table_prefix.'users` ADD UNIQUE KEY `loginname` (`loginname`)');
require MYBB_ROOT.'inc/adminfunctions_templates.php';
foreach(dispname_template_mods() as $src => $dest)
find_replace_templatesets('member_register', '~'.preg_quote($src).'~', $dest);
if($unclose_board) dispname_close_board(0);
}