• Welcome to Simple Machines Community Forum. Please login or sign up.
December 08, 2021, 05:50:10 AM

News:

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


Change Account Status From Profile

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

Previous topic - Next topic

vbgamer45

Link to Mod

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
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

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

Sabre™

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 ;)


Afro

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?

vagrant

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

Sabre™

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


floydpink

January 19, 2009, 07:43:20 AM #5 Last Edit: January 19, 2009, 09:28:54 AM by floydpink
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 -->
                       

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';

flamechica

How would I add a deactivated members option to this?

Alex_Ita

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.


Advertisement: