Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: PLAYBOY on October 10, 2018, 03:46:15 PM

Title: Adding a small feature which should be default in SMF
Post by: PLAYBOY on October 10, 2018, 03:46:15 PM
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?
Title: Re: Adding a small feature which should be default in SMF
Post by: vii on October 10, 2018, 05:40:48 PM
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.
Title: Re: Adding a small feature which should be default in SMF
Post by: PLAYBOY on October 12, 2018, 05:50:31 AM
It worked!!!
You`re AWESOME!

Thank you very much dude!