8
Doh, <<<<<<(Homer Simpson Voice)
Why remake when it is already part of the core.
The popup from the case friend in the misc.php is nice and clean.
Just change the language file to what you want.
xoops_root/language/english/misc.php
Quote:
define("_MSC_YOURNAMEC","Your Name: ");
define("_MSC_YOUREMAILC","Your Email: ");
define("_MSC_FRIENDNAMEC","Friend Name: ");
define("_MSC_FRIENDEMAILC","Friend Email: ");
define("_MSC_RECOMMENDSITE","Recommend this Site to a Friend");
// %s is your site name
define("_MSC_INTSITE","Interesting Site: %s");
define("_MSC_REFERENCESENT","The reference to our site has been sent to your friend. Thanks!");
define("_MSC_ENTERYNAME","Please enter your name");
define("_MSC_ENTERFNAME","Please enter your friend's name");
define("_MSC_ENTERFMAIL","Please enter your friend's email address");
define("_MSC_NEEDINFO","You need to enter required info!");
define("_MSC_INVALIDEMAIL1","The email address you provided is not a valid address.");
define("_MSC_INVALIDEMAIL2","Please check the address and try again.");
I guess instead of having to hardcode the friend popup link we could make a basic module using the friend case:
http://Xoops_Root/misc.php?action=showpopups&type=friend&op=sendform&t=1068755097Quote:
if ( !isset($HTTP_POST_VARS['op']) || $HTTP_POST_VARS['op'] == "sendform" ) {
if ( $xoopsUser ) {
$yname = $xoopsUser->getVar("uname", 'e');
$ymail = $xoopsUser->getVar("email", 'e');
$fname = "";
$fmail = "";
} else {
$yname = "";
$ymail = "";
$fname = "";
$fmail = "";
}
printCheckForm();
echo '
\n";
$closebutton = 0;
} elseif ($HTTP_POST_VARS['op'] == "sendsite") {
$myts =& MyTextsanitizer::getInstance();
if ( $xoopsUser ) {
$ymail = $xoopsUser->getVar("email");
} else {
$ymail = isset($HTTP_POST_VARS['ymail']) ? $myts->stripSlashesGPC(trim($HTTP_POST_VARS['ymail'])) : '';
}
if ( !isset($HTTP_POST_VARS['yname']) || trim($HTTP_POST_VARS['yname']) == "" || $ymail == '' || !isset($HTTP_POST_VARS['fname']) || trim($HTTP_POST_VARS['fname']) == "" || !isset($HTTP_POST_VARS['fmail']) || trim($HTTP_POST_VARS['fmail']) == '' ) {
redirect_header(XOOPS_URL."/misc.php?action=showpopups&type=friend&op=sendform",2,_MSC_NEEDINFO);
exit();
}
$yname = $myts->stripSlashesGPC(trim($HTTP_POST_VARS['yname']));
$fname = $myts->stripSlashesGPC(trim($HTTP_POST_VARS['fname']));
$fmail = $myts->stripSlashesGPC(trim($HTTP_POST_VARS['fmail']));
if (!checkEmail($fmail) || !checkEmail($ymail)) {
$errormessage = _MSC_INVALIDEMAIL1."
"._MSC_INVALIDEMAIL2."";
redirect_header(XOOPS_URL."/misc.php?action=showpopups&type=friend&op=sendform",2,$errormessage);
exit();
}
$xoopsMailer =& getMailer();
$xoopsMailer->setTemplate("tellfriend.tpl");
$xoopsMailer->assign("SITENAME", $xoopsConfig['sitename']);
$xoopsMailer->assign("ADMINMAIL", $xoopsConfig['adminmail']);
$xoopsMailer->assign("SITEURL", XOOPS_URL."/");
$xoopsMailer->assign("YOUR_NAME", $yname);
$xoopsMailer->assign("FRIEND_NAME", $fname);
$xoopsMailer->setToEmails($fmail);
$xoopsMailer->setFromEmail($ymail);
$xoopsMailer->setFromName($yname);
$xoopsMailer->setSubject(sprintf(_MSC_INTSITE,$xoopsConfig['sitename']));
//OpenTable();
if ( !$xoopsMailer->send() ) {
echo $xoopsMailer->getErrors();
} else {
echo ""._MSC_REFERENCESENT."
";
}
//CloseTable();
}
Some small rewrite and it will work.
Then the link to tell a friend would show in the menu block and take you to a single page tell a friend mod.
No reason to covert from nuke, it already in the core.
I have been wandering through the core files and am loving it. Once I get more familar I will make more than the basic mods..
AAINC