Description: with this plugin you can have a mail form in other skins than the member skin.
| General Plugin info | |
|---|---|
| Author: | Rodrigo Moraes |
| Current Version: | 1.1 |
| Download: | - |
| Code: | plugin_code |
| Demo: | - |
| Forum Thread: | here |
If you use just <%MemberMail%> (without the member id parameter), the mail form will be sent to the blog owner. The blog owner is defined inside the plugin code. Find this inside the code and change according to your needs:
$blog_owner = array (0,"23","12","1");
Explanation: note the first 0. It corresponds to the blog 0 (this blog will never exist, so just forget it). After it comes the definition for the blog 1, which is set to “23”. This means: if NP_MemberMail is placed in the blog 1, the mail form will be sent to member 23.
And the list continues defining all blog owners: after it comes the definition for the blog 2, which is set to “12”. This means: if NP_MemberMail is placed in the blog 2, the mail form will be sent to member 12. After it comes the definition for the blog 3, which is set to “1”. This means: if NP_MemberMail is placed in the blog 3, the mail form will be sent to member 1. Etc etc etc.
If you use <%MemberMail%> and the blog owner is not correctly defined as shown above, the mail form will be sent to member 1.
Save the code below as NP_MemberMail.php
<?php class NP_MemberMail extends NucleusPlugin { function getName() { return 'Member Mail'; } function getAuthor() { return 'Rodrigo Moraes'; } function getURL() { return 'http://www.tipos.com.br/'; } function getVersion() { return '1.1'; } function getDescription() { return 'A quick mail form.'; } function supportsFeature($feature) { switch($feature) { case 'SqlTablePrefix': return 1; default: return 0; } } function install() { $this->createOption('redirectURL','Url to redirect after the mail form is used','text','http://...'); $this->createOption('sendButton','Text for the "Send" button','text','send'); } function doSkinVar($skinType) { global $blogid, $member; $params = func_get_args(); /* $blog_owner array explanation: replace "1", "2", "3" by the correspondent blog owner id. the first one must be blank, because it corresponds to blog id number 0 (inexistent). */ $blog_owner = array ("","23","12","1"); echo "<form method=\"post\" action=\"".$CONF['IndexURL']."action.php\" name=\"membermail\">\n"; echo "<input type=\"hidden\" name=\"memberid\" value=\""; if ($params[1]) { echo $params[1]; } else { if ($blog_owner[$blogid]) { echo $blog_owner[$blogid]; } else { echo "1"; } } echo "\" />\n"; if (!$member->getID()) { echo "<input type=\"text\" name=\"frommail\" value=\"your e-mail\" onfocus=\"this.form.frommail.value=''\" /><br />\n"; } echo "<input type=\"hidden\" name=\"action\" value=\"sendmessage\" />\n"; /* define the redirection url below */ echo "<input type=\"hidden\" name=\"url\" value=\"".$this->getOption('redirectURL')."\" />\n"; echo "<textarea name=\"message\" rows=\"10\" onfocus=\"this.form.message.value=''\">your message</textarea><br />\n"; if ($member->getID()) { echo "You are logged as "; echo $member->displayname; echo " (<a href=\"?action=logout\">Logout</a>)\n"; } echo "<div align=\"right\">\n<input type=\"submit\" value=\"".$this->getOption('SendButton')."\" />\n</div>\n"; echo "</form>"; } } ?>
Discuss this plugin in the Nucleus Forum.