|
Mail message on user activation by admin
|
|
08-21-2008, 03:01 AM
Post: #1
|
|||
|
|||
|
Mail message on user activation by admin
Dear all,
I found a (old) plugin of Schnibble and want to modify that for ver 1.4. But one way or the other I don't get it to work, The hook that I am using is.... $plugins->add_hook("member_activate_accountactivated", "mailoa_start"); function mailoa_start() { global $db, $mybb, $settings, $cache; $query = $db->query("SELECT username, email FROM ".TABLE_PREFIX."users WHERE uid='".intval($mybb->input['uid'])."'"); $user = $db->fetch_array($query); if ($user['email'] != '') { $search = array('{user}','{site}','{url}'); $replace = array($user['username'], $settings['bbname'], $settings['bburl']); $subject = str_replace($search, $replace, $settings['mailoa_subject']); $message = str_replace($search, $replace, $settings['mailoa_body']); my_mail($user['email'], $subject, $message); } } But since the mail never arrives I think the mailoa_start funcyion is never fired. I have checked and I can receiv mail via MyBB (tested with Mass mail feature) And the user has an email address. Thanks for the support. |
|||
|
08-21-2008, 03:03 AM
Post: #2
|
|||
|
|||
|
RE: Mail message on user activation by admin
i think this goes in the plugin modifaction section
|
|||
|
08-21-2008, 03:06 AM
Post: #3
|
|||
|
|||
|
RE: Mail message on user activation by admin
PHP Code: $query = $db->query("SELECT username, email FROM ".TABLE_PREFIX."users WHERE uid='".intval($mybb->input['uid'])."'"); Instead of $mybb->input['uid'] use $user['uid'], because the uid isn't always specified in the request (could be a username). Also check the Mail Logs in the ACP Tools section to see if the mail is being sent. |
|||
|
08-21-2008, 11:17 AM
Post: #4
|
|||
|
|||
|
RE: Mail message on user activation by admin
Thanks for the reply.
But the reason I posted this message because it looks like the hook does not work since I do not get any mail when I activate the user as admin. I have tried to put is some debug info with the echo command to see if the function mailoa_start is executed but I do not see any echo's or other screen blips. |
|||
|
08-21-2008, 03:37 PM
Post: #5
|
|||
|
|||
|
RE: Mail message on user activation by admin
The plugin hook you're using only covers the front-end activation (member activates self).
For admin activation, you need to use this plugin hook: $plugins->run_hooks("admin_user_users_coppa_activate_commit"); You can find it in admin/modules/users/users.php |
|||
|
08-21-2008, 08:35 PM
Post: #6
|
|||
|
|||
|
RE: Mail message on user activation by admin
I really thought this was the solution but I still cannot get it to work
![]() So tried to do some debugging but I could not really find an easy way to get some dbug info on screen or in a file. Any suggestions? Thread that I missed??
|
|||
|
08-21-2008, 08:41 PM
Post: #7
|
|||
|
|||
|
RE: Mail message on user activation by admin
Can you post the plugin file here?
|
|||
|
08-22-2008, 08:23 AM
(This post was last modified: 08-22-2008 02:08 PM by rubenkon.)
Post: #8
|
|||
|
|||
RE: Mail message on user activation by admin
(08-21-2008 08:41 PM)DennisTT Wrote: Can you post the plugin file here? What is the appropriate way to debug plugins. I have tried generating log files but run in a lot of error messages.... Are there some functions available I can use to make it easier? Thanks a lot for the support sofar! EDIT: You have to change the name of the plugin to mailoa.php in order for it to work.... Think i solved it... when using $user_info['uid'] i get the current user. when using $mybb->input['uid'] I get the user the administrator is working on. and that is the uid I want to send a mail that his account is activated. so it should be: Code: $query =$db->simple_select("users", "username, email", "uid=".intval($mybb->input['uid'])."");I'll post the plugin when it is complete..... |
|||
|
08-23-2008, 08:02 AM
Post: #9
|
|||
|
|||
|
RE: Mail message on user activation by admin
Echo or file_put_contents. In MyBB 1.4 there's an error handling class (inc/class_error.php) if you want to use it to log traces...but it's not really designed for debugging use I think.
|
|||
|
« Next Oldest | Next Newest »
|
Search
Member List
Calendar
Help





