1: <?php
2:
3: 4: 5: 6: 7: 8: 9: 10:
11: $plugin_is_filter = 5 | ADMIN_PLUGIN;
12: $plugin_description = gettext("Emails a password reset request to a newly created user.");
13: $plugin_author = "Stephen Billard (sbillard)";
14:
15:
16: zp_register_filter('save_user', 'email_new_user::save');
17: zp_register_filter('edit_admin_custom_data', 'email_new_user::edit_admin', 9999);
18:
19: class email_new_user {
20:
21: static function save($savemsg, $userobj, $what) {
22: global $_zp_gallery;
23: if ($what == 'new' && ($mail = $userobj->getEmail())) {
24: $ref = Zenphoto_Authority::getResetTicket($adm = $userobj->getUser(), $userobj->getPass());
25: $msg = "\n" . sprintf(gettext('You are receiving this e-mail because a user code (%1$s) has been created for you on the Zenphoto gallery %2$s.'), $adm, $_zp_gallery->getTitle()) .
26: "\n" . sprintf(gettext('To set your Zenphoto User password visit: %s'), FULLWEBPATH . "/" . ZENFOLDER . "/admin-users.php?ticket=$ref&user=$adm") .
27: "\n" . gettext("This ticket will automatically expire in 3 days.");
28: $err_msg = zp_mail(gettext("Zenphoto user created"), $msg, array($mail));
29: if (!empty($err_msg)) {
30: $savemsg .= $err_msg;
31: }
32: }
33: return $savemsg;
34: }
35:
36: static function edit_admin($html, $userobj, $i, $background, $current) {
37: if ($userobj->getValid()) {
38: $user = $userobj->getUser();
39: if (empty($user)) {
40: $result = '<tr' . ((!$current) ? ' style="display:none;"' : '') . ' class="userextrainfo">
41: <td colspan="2" ' . ((!empty($background)) ? ' style="' . $background . '"' : '') . ' valign="top"><p class="notebox">' . gettext('New users will be mailed a password set link') . '</p></td>
42: </tr>' . "\n";
43: $html = $result . $html;
44: }
45: }
46: return $html;
47: }
48:
49: }
50:
51: ?>