SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Change Account Status From Profile

Started by vbgamer45, December 28, 2008, 01:05:31 PM

Previous topic - Next topic


Link to Mod

Change Account Status From Profile

SMF Version: 2.0.X and 1.1.X
Mod Version: 2.0

This Mod allows you to activate of deactivate an account via the accounts profile.

Thanks go to Blue Dream for giving permission to release this tip as a mod. Original thread can be found at

Updated for 2.0.3 and 1.1.17

Initial Release

Why Not Visit:
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more! -  Paid Modifications for SMF

EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro


So you can deactivate an activated account?
Do NOT give admin and/or ftp details to just anybody, see if they are trust worthy first!!  Do your homework ;)


Quote from: Sabre™ on December 29, 2008, 12:41:11 AM
So you can deactivate an activated account?

thats exactly what i wanna ask. If you can activate any account and deactivate it anytime, i think its then a very great mod against spambots.
another questions is....can members activate and deactivate too or just the admin?


Looks like this could be a very handy mod to have, as long as the user can not just use their activation code again.


Do NOT give admin and/or ftp details to just anybody, see if they are trust worthy first!!  Do your homework ;)


This is a really great idea, but, from my testing in 1.1.7, the mod simply resets the member's status back to 'Awaiting Activation' and the user is able to reactivate their account using the old activation code they were sent.
That logic doesn't really make sense to me - why would you want to do that other than an occasion where the administrator mistakenly changes a member's record in the database, in which case the solution is surely to reset that mistake?

Where this mod would be really useful is that I seem to have a habit of activating or approve-require-activation the wrong registrant and would love this mod to stop me having to do laborious SQL edits to correct the mistake.
I therefore suggest the following as an more logical improvement:
Allow the user to be in, and to be changed to, 3 states that match the Manage Members screen:
  $txt['pending'] = 'Awaiting Activation';
  $txt['activated'] = 'Activated';
  $txt['approval'] = 'Awaiting Approval';
If a member is changed to any of these statuses IS_ACTIVATED is set to the relevant value, but in addition, VALIDATION_CODE is set to null so that any previously emailed validation codes become null-and-void.
>>>> As a result of this, if the user is set to 'Awaiting Activation' they will be given a 'You need to activate you account' message when they try to login; if they try to use their old code it won't work so they are forced to select the 'request new activation code option'
This allows the administrator to correctly change the member's status from their Profile page (mimicking the Manage Members page) but also allows administrator errors to be correctly reverted without the member being able to override them via the previously emailed verification code email.
The necessary code is as follows:
// Change Account Status From Profile Mod
//Account Status needed for the "Change Account Status From Profile" Mod
$txt['accountstatus'] = 'Account Status:';
$txt['pending'] = 'Awaiting Activation';
$txt['activated'] = 'Activated';
$txt['approval'] = 'Awaiting Approval';

   // Change Account Status From Profile Mod
   // Maybe we are changing the account status?
   if($user_info['is_admin'] && isset($_POST['account_status']))
      $profile_vars['is_activated'] = $_POST['account_status'];
      $profile_vars['validation_code'] = '\'\'';

   // Now call the sub-action function...

                        <!-- Change Account Status From Profile Mod -->
                        <td><input type="text" name="posts" size="4" value="', $context['member']['posts'], '" /></td>
                        <td><b>', $txt['accountstatus'],'</b></td>
                           <select name="account_status">
                              <option value="0"', $context['member']['is_activated'] == 0 ? ' selected="selected"' : '', '>', $txt['pending'],'</option>
                              <option value="1"', $context['member']['is_activated'] == 1 ? ' selected="selected"' : '', '>', $txt['activated'],'</option>
                              <option value="3"', $context['member']['is_activated'] == 3 ? ' selected="selected"' : '', '>', $txt['approval'],'</option>
                        <!-- End Change Account Status From Profile Mod -->

Marcus Forsberg

Swedish translation:

//Account Status needed for the "Change Account Status From Profile" Mod
$txt['accountstatus'] = 'Kontots status:';
$txt['pending'] = 'Väntande';
$txt['activated'] = 'Aktiverat';


How would I add a deactivated members option to this?


Hi vbgamer45

I've just installed this mod on my smf 2.0.7, but I've a problem.

When a user require an email to revalidate his own account, the email generated is not completed

E.g of email:

QuoteGrazie per esserti registrato su my forum. Il tuo username è Lucky Star. Se dimentichi la tua password, puoi resettarla visitando myforumforum/index.php?action=reminder.

Prima di poter effettuare il login, devi attivare il tuo account. Per farlo, segui questo link:


Se riscontri problemi nell'attivazione, visita myforum/forum/index.php?action=activate;u=110 ed insert code "".

my forum

So users cannot activated own account.

I Think the code is missing.....

any help?