Adding a small feature which should be default in SMF

Started by PLAYBOY, October 10, 2018, 03:46:15 PM

Previous topic - Next topic


When people ask to become a member in your forum and you go to their profile and click on "Approve", they don`t get an email notification saying their membership has been approved. So they dont know about the approval and not participate in the forum.

However if you go through the admin panel and approve the member there, then they get a notification email.

So can someone please help me to copy & paste the code from admin panel to the profile page so when you click on the approve button on the profile page the person gets an email notification about the approval of their membership?

I don`t understand the reason why they didn`t add this in the default settings like who would NOT want to notify the member upon approving their membership from their profile?


In Profile-Actions.php // function activateAccount($memID), find this code:

       // Make sure we update the stats too.
        updateStats('member', false);

Add this directly after the above code, but before the } bracket that closes the parent conditional statement

        // Send approval email
        global $scripturl;

        // Needed for email template function
        require_once($sourcedir . '/Subs-Post.php');

        $replacements = array(
            'NAME' => $user_profile[$memID]['member_name'],
            'USERNAME' => $user_profile[$memID]['real_name'],
            'PROFILELINK' => $scripturl . '?action=profile;u=' . $memID,
            'FORGOTPASSWORDLINK' => $scripturl . '?action=reminder',
        $emaildata = loadEmailTemplate('admin_approve_accept', $replacements, $member['language']);
        sendmail($user_profile[$memID]['email_address'], $emaildata['subject'], $emaildata['body'], null, null, false, 0);

Let me know if that works. The code I got the email stuff from was ManageMembers.php, around lines 1130 - 1238.

I don't have time to test it, but it looks like it should work.


It worked!!!

Thank you very much dude!


SMF 2.1.4

I know its an old Post.  :-[

I used this code in SMF 2.0.19 and it works perfect, but in SMF 2.1.4 it didnt.

Any idea to make this ("Accounts Approved via Member Profile") working in SMF 2.1.4 ?

I found @GL700Wing code Accounts Approved via Member Profile

But I didnt need all that stuff, ... just this litte trick that @vii posted above.  ;)

Thank you for your effort.