MyBB Community Forums

Full Version: Adapt Administration Activation email
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all,

I set up a new privat forum with mybb Version 1.8.10. To ensure only people we know have access to the forum I selected registration method "Email Verification & Administrator Activation". In principle that works well but in detail there are a few things I want to adapt and cannot handly on my own as my PHP skills are very basic Blush . Therefore I hope some of you might help me with the following:

1) Include customized fields from registration in the email that informs admin(s) about new registration: If a new customer registers an email that a new user is pending admin activation is sent to the admin(s). I already figured out, where to change the text of this email (inc > languages > deutsch-du > member-lang.php -> $l['newregistration_message'] =) and adapted it. In addition to text changes I also want to include some more information about the user:
  • I defined some custom fields for registration form (e.g. surname, last name) that are only relevant for approval by admin and will not be displayed in the users profile. The custom field data from users are stored in the table "mybb_userfields"
  • I want to include the values from fields "fid4, fid5, fid6" from table "mybb_userfields" in the e-mail to the admin(s) defined in "member-lang.php" ($l['newregistration_message'] =)
  • There are already some variables named {1}, {2}, {3} included in the e-mail. I figured out (but may be wrong...) that they are defined in the "member.php" in the root directory, starting line 494:
$q = $db->simple_select('users', 'uid,username,email,language', $sqlwhere);
                                while($recipient = $db->fetch_array($q))
                                {
                                        // First we check if the user's a super admin: if yes, we don't care about permissions
                                        $is_super_admin = is_super_admin($recipient['uid']);
                                        if(!$is_super_admin)
                                        {
                                                // Include admin functions
                                                if(!file_exists(MYBB_ROOT.$mybb->config['admin_dir']."/inc/functions.php"))
                                                {
                                                        continue;
                                                }

                                                require_once MYBB_ROOT.$mybb->config['admin_dir']."/inc/functions.php";

                                                // Verify if we have permissions to access user-users
                                                require_once MYBB_ROOT.$mybb->config['admin_dir']."/modules/user/module_meta.php";
                                                if(function_exists("user_admin_permissions"))
                                                {
                                                        // Get admin permissions
                                                        $adminperms = get_admin_permissions($recipient['uid']);

                                                        $permissions = user_admin_permissions();
                                                        if(array_key_exists('users', $permissions['permissions']) && $adminperms['user']['users'] != 1)
                                                        {
                                                                continue; // No permissions
                                                        }
                                                }
                                        }

                                        // Load language
                                        if($recipient['language'] != $lang->language && $lang->language_exists($recipient['language']))
                                        {
                                                $reset_lang = true;
                                                $lang->set_language($recipient['language']);
                                                $lang->load("member");
                                        }

                                        $subject = $lang->sprintf($lang->newregistration_subject, $mybb->settings['bbname']);
                                        $message = $lang->sprintf($lang->newregistration_message, $recipient['username'], $mybb->settings['bbname'], $user['username']);
                                        my_mail($recipient['email'], $subject, $message);
                                }
  • I have no idea if I am on the right path and if so how to define also the fields "fid4, fid5, fid6" from table "mybb_userfields" as variables I can the use in the e-Mail  Huh
2) Send a confirmation email after somebody is approved by admin: Right now the new user only receivs an email to confirm registration but not after approval by admin. All I found is https://community.mybb.com/thread-155769...val+e-mail where it says the function is already available with MyBB 1.8. Is there anything I need to configure to send out this confirmation email?

I hope the information are sufficient - otherwise please let me know what is needed in addition. It would be great if someone could help me with these issues.

Best regards
Kati