News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Prevent Username change

Started by TonyJ, March 02, 2020, 05:33:42 PM

Previous topic - Next topic

TonyJ

Hopefully the last bit I need to change ...

Can anyone tell me what I need to edit to remove the 'Change' link (Prevent changes to Username) next to the Username in the Profile page?

      // The username is not always editable - so adjust it as such.
      'member_name' => array(
         'type' => allowedTo('admin_forum') && isset($_GET['changeusername']) ? 'text' : 'label',
         'label' => $txt['username'],
         'subtext' => allowedTo('admin_forum') && !isset($_GET['changeusername']) ? '(<a href="' . $scripturl . '?action=profile;u=' . $context['id_member'] . ';area=account;changeusername" style="font-style: italic;">' . $txt['username_change'] . '</a>)' : '',
         'log_change' => true,
         'permission' => 'profile_identity',
         'prehtml' => allowedTo('admin_forum') && isset($_GET['changeusername']) ? '<div class="alert">' . $txt['username_warning'] . '</div>' : '',
         'input_validate' => create_function('&$value', '

Thanks again.
I want to die in my sleep like my Grandfather. Not kicking and screaming like his passengers!

Antechinus

It's this bit:

'subtext' => allowedTo('admin_forum') && !isset($_GET['changeusername']) ? '(<a href="' . $scripturl . '?action=profile;u=' . $context['id_member'] . ';area=account;changeusername" style="font-style: italic;">' . $txt['username_change'] . '</a>)' : '',


This should get rid of it:

'subtext' => '',

TonyJ

Legend, you are. Working, it be!  :)

Thanks again.  :D
I want to die in my sleep like my Grandfather. Not kicking and screaming like his passengers!

Kindred

you do realize that what you did only removes the link -- not the ability?
anyone who could change the username (which, IIRC was only admins anyway) can still do it by going to the URL directly.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Antechinus

Members can change their username if that's not disabled in admin.

Kindred

Username, no
Display name, yes
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Advertisement: