Hi there,
It's me again and weblinks again.
This is a new hack that allow notification admin when a new link is submitted and awaiting for approval and a notification to anonymous users when a link is refused.
Here is how to.
1) New link awaiting for approval:
weblinks/language/english/mail_template/link_awaiting_notify.tpl
Hi,
A new site is waiting for approval.
Please connect to your admin section to check it:
{WAITINGLINKS_URL}
New site's information:
Name: {SITE_NAME}
URL: {SITE_URL}
Email: {SITE_EMAIL}
weblinks/submit.php, add this function at line 47 after the include_once calls
function sendNotificationToAdmin(&$myPost) {
global $xoopsConfig;
global $MODULE_URL;
$xoopsMailer =& getMailer();
$xoopsMailer->useMail();
$xoopsMailer->assign("WAITINGLINKS_URL", $MODULE_URL."/admin/index.php?op=listNewLinks");
$xoopsMailer->assign("SITE_NAME", $myPost['title']);
$xoopsMailer->assign("SITE_URL", $myPost['url']);
$xoopsMailer->assign("SITE_EMAIL", $myPost['mail']);
$xoopsMailer->assign("UNAME", '');
$xoopsMailer->assign("ULINK", '');
$xoopsMailer->setTemplateDir(XOOPS_ROOT_PATH."/modules/weblinks/language/".$xoopsConfig['language']."/mail_template/");
$xoopsMailer->setTemplate("link_awaiting_notify.tpl");
$xoopsMailer->setFromEmail($myPost['mail']);
$xoopsMailer->setFromName($xoopsConfig['sitename']);
$xoopsMailer->setToEmails($xoopsConfig['adminmail']);
$xoopsMailer->setSubject(_WLS_LINKSWAITING);
$success = $xoopsMailer->send();
}
Now after line 157/159
// bug fix: approve notify mail dont send
$notification_handler->subscribe('link', $modify_newid, 'approve', XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE);
}
add this code
// Notification to admin when a new link is waiting for approval, added by SnAKes
if($_POST['uid'] == 0 && !empty($_POST['mail'])) sendNotificationToAdmin($_POST);
This should look like this
if ($notify)
{
include_once XOOPS_ROOT_PATH . '/include/notification_constants.php';
// bug fix: approve notify mail dont send
$notification_handler->subscribe('link', $modify_newid, 'approve', XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE);
}
// Notification to admin when a new link is waiting for approval, added by SnAKes
if($_POST['uid'] == 0 && !empty($_POST['mail'])) sendNotificationToAdmin($_POST);
redirect_header("index.php",2,_WLS_RECEIVED);
2) Link refused notification:
weblinks/language/english/mail_template/links_refused_notify.tpl
Hi,
The site you have submitted had been refused for one of the following reasons:
- its contents does not meet our critera
- its contents is illegal
- it's a redirection URL, we only accept direct access URL
Your site's informations:
Name: {SITE_NAME}
URL: {SITE_URL}
weblinks/english/admin.php, add this line at the end before '?>'
define("_WEBLINKS_LINK_REFUSED", "Your link has been refused");
weblinks/admin/modify.php, add this function at about line 50 after function listNewLinks()
// Notification of refusal to anonymous users, added by SnAKes
function sendRefusalNotificationToAnonymous(&$myPost) {
global $xoopsConfig;
$xoopsMailer =& getMailer();
$xoopsMailer->useMail();
$xoopsMailer->assign("SITE_URL", $myPost["url"]);
$xoopsMailer->assign("SITE_NAME", $myPost["title"]);
$xoopsMailer->assign("UNAME", '');
$xoopsMailer->assign("ULINK", '');
$xoopsMailer->setTemplateDir(XOOPS_ROOT_PATH."/modules/weblinks/language/".$xoopsConfig['language']."/mail_template/");
$xoopsMailer->setTemplate("link_refused_notify.tpl");
$xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
$xoopsMailer->setFromName($xoopsConfig['sitename']);
$xoopsMailer->setToEmails($myPost['mail']);
$xoopsMailer->setSubject(_WEBLINKS_LINK_REFUSED);
$success = $xoopsMailer->send();
}
Now at line 84 in function delNewLink() add this code
// Notification to anonymous users, added by SnAKes
if($_POST['uid'] == 0 && !empty($_POST['mail'])) sendRefusalNotificationToAnonymous($_POST);
With my old post for weblinks hack you should be able to have a weblinks that notify to anonymous user when a link is refused or approved and to admin when a link is awaiting.
Weblinks hack for anonymous email notification when link approvedWeblinks: hardlink plus php support.