Allow username change once?

Discussion in 'Customization & add-ons' started by evevera, May 1, 2011.

  1. evevera

    evevera Member

    Joined:
    Jul 28, 2010
    Messages:
    41
    Is there a way to allow users to only change their username once?

    Main reason is so their username isn't simply defaulted to their email address for forum access. I want them to change it for the forum but only once.

    How can I do this?
  2. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    This can be done as customization only.
    Add variable to user profile for number of login changes.
    Then Modify profile.php and display error when that number was used.
  3. evevera

    evevera Member

    Joined:
    Jul 28, 2010
    Messages:
    41
    Hmm how would you add variable to user profile for number of login changes? In the template or you mean on the profile.php page?
  4. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    No, I mean in aMember CP -> Add fields. Add any member field that will be hidden for user.
  5. evevera

    evevera Member

    Joined:
    Jul 28, 2010
    Messages:
    41
    But that only records the number of profile changes right? Also I don't know how to pull up the value for this new field in the profile.html template.. it seems to be hidden in 'additional_fields_html'
  6. thehpmc

    thehpmc Member

    Joined:
    Aug 24, 2006
    Messages:
    901
    Basically add a field, hidden to the user, which holds a value of 'True' when the username has been changed.

    Then add a conditional 'if' statement so that following log in your members are redirected to a page explaining the need to change username/profile if this field has not been set to 'True'.

    Once username has been changed, and field set, members would proceed normally each time they logged in.

Share This Page