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