Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: vbgamer45 on December 28, 2008, 01:05:31 PM

Title: Change Account Status From Profile
Post by: vbgamer45 on December 28, 2008, 01:05:31 PM
Link to Mod (https://custom.simplemachines.org/mods/index.php?mod=1577)

Change Account Status From Profile


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

Description:
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 http://www.simplemachines.org/community/index.php?topic=256305.0

Changelog:
v2.0
Updated for 2.0.3 and 1.1.17

v1.0
Initial Release

Why Not Visit:
http://www.smfhacks.com (http://www.smfhacks.com)
Title: Re: Change Account Status From Profile
Post by: Sabre™ on December 29, 2008, 12:41:11 AM
So you can deactivate an activated account?
Title: Re: Change Account Status From Profile
Post by: Afro on December 30, 2008, 02:31:53 PM
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?
Title: Re: Change Account Status From Profile
Post by: vagrant on December 31, 2008, 06:28:51 AM
Looks like this could be a very handy mod to have, as long as the user can not just use their activation code again.
Title: Re: Change Account Status From Profile
Post by: Sabre™ on January 04, 2009, 03:38:49 PM
Quote from: Sabre™ on December 29, 2008, 12:41:11 AM
So you can deactivate an activated account?
Title: Re: Change Account Status From Profile
Post by: floydpink on January 19, 2009, 07:43:20 AM
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:
./Themes/default/languages/Modifications.english.php
// 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';

./Sources/Profile.php
   // 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...

./Themes/default/Profile.template.php
                        <!-- Change Account Status From Profile Mod -->
                        <td><input type="text" name="posts" size="4" value="', $context['member']['posts'], '" /></td>
                     </tr>
                     <tr>
                        <td><b>', $txt['accountstatus'],'</b></td>
                        <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>
                           </select>
                        </td>
                        <!-- End Change Account Status From Profile Mod -->
                       
Title: Re: Change Account Status From Profile
Post by: Marcus Forsberg on January 30, 2009, 05:53:40 PM
Swedish translation:

//Account Status needed for the "Change Account Status From Profile" Mod
$txt['accountstatus'] = 'Kontots status:';
$txt['pending'] = 'Väntande';
$txt['activated'] = 'Aktiverat';
Title: Re: Change Account Status From Profile
Post by: flamechica on January 15, 2013, 07:12:57 PM
How would I add a deactivated members option to this?
Title: Re: Change Account Status From Profile
Post by: Alex_Ita on June 09, 2014, 04:48:45 AM
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:

myforum/forum/index.php?action=activate;u=110;code=

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

Saluti,
my forum

So users cannot activated own account.

I Think the code is missing.....

any help?
Thanks.
Title: Re: Change Account Status From Profile
Post by: Alex_Ita on June 17, 2014, 10:13:15 AM
Up