to prevent users from changing their username >
open xoops_version.php
find >
$modversion['config'][21]['name'] = 'allow_chgmail';
$modversion['config'][21]['title'] = '_PROFILE_MI_ALLOWCHGMAIL';
$modversion['config'][21]['description'] = '_PROFILE_MI_ALLOWCHGMAIL_DESC';
$modversion['config'][21]['formtype'] = 'yesno';
$modversion['config'][21]['valuetype'] = 'int';
$modversion['config'][21]['default'] = 0;
$modversion['config'][21]['category'] = 'settings';
add right after: $modversion['config'][22]['name'] = 'allow_chguname';
$modversion['config'][22]['title'] = '_PROFILE_MI_ALLOWCHGUNAME';
$modversion['config'][22]['description'] = '_PROFILE_MI_ALLOWCHGUNAME_DESC';
$modversion['config'][22]['formtype'] = 'yesno';
$modversion['config'][22]['valuetype'] = 'int';
$modversion['config'][22]['default'] = 0;
$modversion['config'][22]['category'] = 'settings';
save & close
open smartprofile/edituser.php
find >
$edituser->setVar('uname', $myts->stripSlashesGPC(trim($_POST['uname'])));
replace with: if ($xoopsUser->isAdmin() || $xoopsModuleConfig['allow_chguname'] == 1) {
$edituser->setVar('uname', $myts->stripSlashesGPC(trim($_POST['uname'])));
}
save & close
open smartprofile/include/forms.php
find (around line 376ish)
$elements[0][] = array('element' => new XoopsFormText(_PROFILE_MA_USERNAME, 'uname', 25, 75, $user->getVar('uname', 'e')), 'required' => 1);
$weights[0][] = 0;
replace with: if ($user->isNew() || $xoopsUser->isAdmin() || $xoopsModuleConfig['allow_chguname'] == 1) {
$elements[0][] = array('element' => new XoopsFormText(_PROFILE_MA_USERNAME, 'uname', 25, 75, $user->getVar('uname', 'e')), 'required' => 1);
$weights[0][] = 0;
} else {
$elements[0][] = array('element' => new XoopsFormLabel(_PROFILE_MA_USERNAME, $user->getVar('uname')));
$weights[0][] = 0;
}
save & close
open smartprofile/language/english/modinfo.php
find
define("_PROFILE_MI_ALLOWCHGMAIL", "Allow users to change email address?");
define("_PROFILE_MI_ALLOWCHGMAIL_DESC", "");
add right after: define("_PROFILE_MI_ALLOWCHGUNAME", "Allow users to change their username?");
define("_PROFILE_MI_ALLOWCHGUNAME_DESC", "");
save & close
now goto admin and update the smartprofile module by clicking update module..
now users can't edit their username unless you set 'yes' to allow users to change username in preferences.