Send to a friend WordPress plugin
This is my first WordPress plugin, StaF or ‘Send to a Friend’.
StaF will add some viral-mailmarketing functionality to your WordPress blog. It allows users to send the page they’re looking at to a friend, colleague or someone special. The current release is in it’s development stage but it works, and uses AJAX for quick access and sending the mail.
Current Features:
- AJAX for quick sending without leaving the page
- Admin Panel for some text and colours
- Simple install only a few words of code
- E-mail check
Very near future plans (could be today or tommorrow):
- Admin option for the e-mail.
Future plans:
- Spam Blocking (via ip and mail addresses)
- non javascript support
Download
sendtoafriend_v0.4.3.zip
Installation :
- extract the zip file
- upload the complete folder sendtoafriend to your wp-content/plugins/ folder
- activate the plugin in your admin panel
- add <?php StaF_html(); ?> somewhere in your sidebar or template(s)
*note there shouldn’t be a space between the < , ? and php or the ? and > and should only be included once per page !!
Upgrade to v0.4.x
Remove the <?php StaF_html(); ?> from your sidebar or template(s)
Disable the plugin via the admin-panel
Delete the sendtoafriend directory in your wp-content/plugins/ folder
Upload the new sendtoafriend directory to your wp-content/plugins/ folder
Activate the plugin in the admin-panel
Add <?php StaF_html(); ?> back in your sidebar or template(s)
Quick and dirty upgrade
Disable the plugin
Delete the sendtoafriend directory in your wp-content/plugins/ folder
Upload the new sendtoafriend directory to your wp-content/plugins/ folder
Activate the plugin
For previous releases and their upgrade instructions visit page 2
Pages: 1 2

December 24th, 2005 at 2:14 pm
Ok
I figured it out. There is an extra space in front of the first ? jsut after the some where in your sidebar and try it”
But it should be this:
“add some where in your sidebar and try it”
December 24th, 2005 at 9:54 pm
Hey I’ve noticed the problem before I tried removing it but wordpress keeps putting a space between the < and ? but i’ve put a notice the install text.
January 4th, 2006 at 12:03 am
Most excellent plugin. I implemented it on http://www.sargasso.nl. When you click on an title to go to the post it shows a mail icon on the bottom of the post.
The email check however is very important coz I now receive the emailaddress of my provider or something when I test the plugin without having the sender of the “mail to a friend” a valid email. Very strange.
I would very much appreciate it if you would let me know when the mailcheck is added.
This is the most beautiful “send to a friend” plugin I have seen in years.
January 4th, 2006 at 12:35 am
and perhaps you have a solution for this ; when you have a very long post such as this
http://www.sargasso.nl/archief/2006/01/02/prelude-nieuwe-energie-verhoudingen/
and click on the mail icon on the bottom of the post, the form is shown outside of the screen; you have to scroll up.
If you remove the position absolute bit from the style sheet the form is shown nicely but then my layout gets screwed up. It acts like the form is always there, even when the mail icon has not been clicked on.
In my opinion, after clicking on “send to a friend” the mailform should always be visible on the screen, also with long pages like my example. I think I could fix this myself but it is more likely that you after reading this already know what the CSS should be.
Thanks
January 4th, 2006 at 7:19 pm
@ Dagtyarev
True the email check is really important I’m already working on it the backend code is already done but i’m working on the frontend bit. I hope i can find some few spare hours and add this functionality within a couple of days.
I agree there is a major flaw in the positioning of the mailform, my current idea is to position the mailform in the center of the screen after pressing send to a friend.
January 4th, 2006 at 11:39 pm
that would be really great. For the time being i have now my “send to a friend” link on the top of item pages so the form is always visible.
Thanks again for the great work. I’ll be checking back for the rest of it.
January 5th, 2006 at 11:53 pm
I’ve installed version 3 and the e-mailcheck works fine with me. Thanks !
January 14th, 2006 at 1:21 am
any progress on the positioning of the mailform ? just checking
January 22nd, 2006 at 2:01 pm
Exellent plugin. Is there anyway I can may it work outside of the blogs root? Like PHP-scripts that I can call with include(’blog/wp-blog-header.php’). Because it does’t seem to work outside. The form is not hidden, and it does not work.
January 22nd, 2006 at 11:04 pm
I’m a bit confused by your question but when the form shows up and doesn’t work means the javascript isn’t included.
I don’t know if this will fix your problem but now I am including the javascript in the header of the page when a template (header.php) calls
< ?php wp_head(); ?>I will remove this and output the javascript when you call< ?php StaF_html(); ?>. This will remove the javascript from the<head>but it will only be loaded when needed. it could reduce some loading on other pages where the script is not includedVersion 0.4 will include:
- correct positioning
- admin panel, these options can be set : background-, border- and font colour, the englisch text can be replaced with something in your own language.
Hopefully I’ll find extra time to code this week and release it within a week
Sorry for the lack of updates but i’m really busy, at work working on a few big-time projects, and renovating my new house.
January 24th, 2006 at 12:28 am
Sorry for not beeing very clear in my question. I have my blog in a folder like this http://domain.com/blog, and the plugin is working fine here. But I would like to use the plugin directly on the main site http://domain.com. Here it doesn’t seem to work. The form is open even though I havent pressed on the link “send to a friend”. Probably because the ajax-stuff and the mailing-stuff only works for things in http://domain.com/blog and not in http://domain.com. As I said, with the PHP I sloved this with putting in the beginning of the pages. But meybe it is more complicated with your script.
January 28th, 2006 at 5:30 pm
How to changes the pop-up form position on the screen? I put in my blog but the form come up away outside to the right of my blog pages.
thanks.
January 28th, 2006 at 10:56 pm
@Saylow i’ve seen your problem and I’ve reproduced the wrong placement.
It has someting do with css position:relative, I’ll try to fix it this week.
February 1st, 2006 at 3:03 am
Exellent job, Sebastiaan. Now it works for me also. Also outside the blog folder. I just have the same problem as saylow. The form appears to the right of the link “Send to a friend”. I hope it is not to big a problem to solve, because I intend to place the link in the right side of my link. So it would be nice if the form would appear left to the link. I tried diffenernt things in the CSS-code, but I couldn’t solve it.
February 10th, 2006 at 3:16 pm
It was indeed the css position property, just check the javascript to see how it’s fixed
February 11th, 2006 at 1:05 pm
Thanks for the new version. I love your plugin - thanks for sharing.
February 17th, 2006 at 4:31 pm
Thanks for this. Great script!!!!
February 26th, 2006 at 11:27 pm
BUG
After activating the plugin, all H2 headers on the page had their styles changed.
FIX
In sendtoafriend.php, change this:
#stafForm input,label,2
to:
#stafForm input, #stafForm label, #stafForm h2
February 27th, 2006 at 12:26 pm
Thanx I’ll fix this as soon as possible !!
March 14th, 2006 at 5:45 pm
Great plugin, we can customise the css right? If so prehaps thats a feature you might want to advertise.
March 21st, 2006 at 5:31 pm
Adam I’ve updated the css.. sorry it took so long i’ve been very busy the last couple of weeks (as usual)
April 23rd, 2006 at 3:06 am
This plugin is not xhtml compatible. You have to put the style code in the part of html, and this is in the header template. Also, you cannot capitlize attribute names and you have to close all your tags.
/*In header*/
#stafBlock { position: absolute !important; z-index: 100000; display: none; width: 200px; }
#stafForm { background-color: ; border: 1px solid ; padding: 5px; margin:0; }
#stafForm h2 { margin: 0; }
#stafForm input, #stafForm label, #stafForm h2 { font-family: ‘Lucida Grande’, Verdana, Arial, Sans-Serif; font-size: 1em; color: #222222; }
#stafForm input { width: 90px; height: 15px; margin-top: 5px; border: 1px solid #ccc; }
#stafForm label { float: left; display: block; width: 90px; line-height: 16px; }
#stafClose { float: right; margin-right: 5px; }
/* Normal Plugin */
April 24th, 2006 at 11:57 pm
Thanx Mark
I’ll take a look at it, btw I took the liberty of editting your reaction since it totally broke below /* Normal Plugin */
If there was more usefull information below /* Normal Plugin */ please send a e-mail to sebastiaan.smid[place the at sign here]gmail.com
April 27th, 2006 at 5:11 pm
I have this script running on another site, and it works perfectly. So I copied the plugin over and installed it on my new site, it didn’t work. I’m on the same v. of wp on both. So started from scratch and downloaded a new one and reuploaded it… It’s still not working. When I click on it, it just jumps to the top of the page, and the pop up doesn’t show up…
Does anyone have any idea where the problem is coming from?
April 28th, 2006 at 5:51 pm
I Could think of some problems e.g. javascript turned off, bad doctype/ not XHTML, or just a wierd bug…
I would like to know more like webbrowser and version and prefferably a url we can take a look at.
April 30th, 2006 at 12:44 pm
Hi Sebastiaan,
Thanks for the plugin! I think I’ve found a bug in sendtofriend.php. The option ’squ_staf_linktext’ is missing from function squ_install() and function staf_options_subpanel().
Cheers, Murk
June 10th, 2006 at 5:14 pm
Great plugin! I used it on my site:
http://www.crypticuniverse.com
I’m jsut having a bit of trouble changing labels (Ex: Your Name, Friend Name, Etc.)
If we can do that, how? I can’t seem to find the text in the php file.
Great plugin though. Works great.
June 11th, 2006 at 12:12 pm
the labels can be changed in wordpress under Options -> Send to a friend, the data is saved in the database that wordpress is uses that’s probably why you didn’t find the labels in the php code..
i hope this solves your problem..
September 10th, 2006 at 2:43 am
[…] I’ve also been looking at adding some other WordPress plugins to this site. I’m already using “subscribe to comments“, “Kramer” (highly suggested), “Akismet“, “Simple tags“, Send to a friend (highly suggested) and “Google sitemaps“. If you have some plugins that you’ve been using, and would highly suggest, I’m all ears. Technorati Tags: Joomla, Mambo, template, slideshow, WordPress, plugins […]
September 18th, 2006 at 5:08 pm
Hi all.
I’ve installed staf plugin ( http://www.potaje.net/ ). It’s sending mails OK but I have a problem with the link sended.
When clicked from inside a post page the link sent in the mail it’s OK, but when clicked from the main page (index.php) it sends the main blog url (www.potaje.net).
I guess has something to do with the $_POST [ ‘ url `].
Is there a way to fix this?
Thanks.
September 19th, 2006 at 2:13 pm
Well it sends the url of the page you’re watching so when you’re watching your homepage it will send something like “http://www.yourdomain.com/” when you’re on a post it will send something like “http://www.yourdomain.com/category/post/” etc…
So the current version of the script doesn’t send the post-page on your homepage, so placing links in every post is irrelavant since all of them will send the url of your homepage and not the post-page self..
I will take a look at in the near future since it’s more of a new feature then a bug, any tips or ideas on how to implement this are welcome !
October 6th, 2006 at 11:20 pm
hi
it does not work when i click over it and i am on the home page.
it results www.mysite.com/#
in all the subpages it works good showing its popup.
the home page title is set as the blogtitle.
any idea?
thnx
enrico
October 6th, 2006 at 11:33 pm
in IE if you click send without filling any fields appear and error on the browser status bar (row 49, char 2) and does not show the regular alert like in firefox.
hope you may fix it.
thnx
enrico
October 9th, 2006 at 1:06 am
[…] זמין להורדה תרגום לעברית של תוסף ajax ”שליחת דף זה לחבר“. […]
October 9th, 2006 at 10:18 am
Hi,
Thanks for the great plugin.
I’ve translated your plugin to hebrew (see the trackback above).
I’va also modified it so STaF_html may get a url parameter (optional), this way I can place calls to the plugin from within index.php, so that each call sends the apropriate page/post (place a call per post).
Let me know if you want to have the changed code.
Hannit
October 29th, 2006 at 7:42 pm
Great plugins for wordpress.. you can see it at my website http://www.tyic.com
I did change the css around a little bit…
October 29th, 2006 at 7:49 pm
[…] http://www.lostpixels.nl/staf/1/ +trackback url | +del.icio.us | +digg it | +stumbleupon […]
November 8th, 2006 at 7:25 pm
“”
I can only see the upper half of the word “send” on the submitbutton.
It’s probably my theme “blix”, any suggestions?
check it out @ http://blog.buzzscout.com
thnx
scoutleader
November 20th, 2006 at 3:45 pm
[…] Email To A Friend http://www.lostpixels.nl/staf/ […]
February 1st, 2007 at 1:47 pm
Thank you for this wonderfull plugin. I’m using it on www.denquer.de now. Is it possible to include a textarea for personal messages, sent with the mail?
February 13th, 2007 at 5:01 pm
[…] También puedes encontrar al pie de cada entrada un enlace que te permitirá mandarle aquella que te parezca interesante a quien quieras en menos de un minuto. Nos gusta mucho el plugin que utilizamos porque es muy sencillo y eficaz (gracias Sebastian). […]
February 13th, 2007 at 8:09 pm
Thanks a lot for the plugin! We’re using it in Spanish.
And we’d also appreciate the improvement “potaje.net” was asking for. It has a lot of sense when using StaF in blogs.
Cheers!
March 18th, 2007 at 10:03 pm
Not sure what I’m doing wrong here. It works fine if I call the php like this:
But if I try to use it with an icon, like:
” title=”Send “>
I get:
var staf_confirmtext = ‘’ ” title=”Send Bammer Found Guilty, Investigation Pending”>[Icon}
I’ve tried it a bunch of different ways and I still get the ‘var staf_confirmtext’ no matter what…
Ideas? Help??
Thanks
March 18th, 2007 at 10:04 pm
Blah. Your comment form pulled out my php!! Basically, I just need proper code to use it with an icon or graphic. Otherwise it’s working fine.
Thanks
March 19th, 2007 at 2:36 pm
Lynn you could edit line 81 in the file sendtoafriend.php and add your image there
Or even better download version 0.4.3 and use the link text field for some nice html (make sure your image path is correct !!)
April 10th, 2007 at 6:16 pm
[…] http://www.lostpixels.nl/staf/ […]
May 22nd, 2007 at 1:56 am
Good plugin but one request : how is it possible to show directly on the page #stafBlock without clicking ??? I would like to put the inputs next to comments ; guy puts datas, it loads itself without become hidden. Any help ?
July 16th, 2007 at 9:28 am
Hi there, Could you please explain where exactly to paste the line of php?
You said somewhere in your sidebar or template(s), could you please be a bit more specific?
Your feature looks fantastic, I would very much appreciate your help!!
Thanks!
July 16th, 2007 at 10:23 pm
I’m sorry to say I can’t seem to work with this at all - I can’t see to successfully put it into a widget, or to edit it into my sidebars.
It’s a shame - I’d very much like to be able to use this viral marketing feature.
Gavin
August 3rd, 2007 at 11:59 pm
Any plans to upgrade to Wordpress 2.2.1?
August 5th, 2007 at 8:06 am
thank you very much for this lovely plugin, i hope in the future version we can set an email cap for the number of StaF mail that can be sent per user, it might used/abused for spam flooding…. 2cents
August 7th, 2007 at 9:25 am
Rod -> Nice idea…. i’ll take a look into it
Eirin -> you should put the code into the file sidebar.php
Gavin -> Sorry could you be more specific ?
Chris -> I will upgrade my wordpress to 2.2.2 soon
Videoke -> if people will use it for spamflooding it will be spamming your page this is not very attractive for spammers but they idea is still on my mind
October 13th, 2007 at 12:01 pm
Hello Sebastiaan,
I have activated your plugin, but it does not go right
I test plugin… I click at send a friend, new window is opened and i fill every details, when I click to send it shows me successfully send. But I have nothing in my mail box
Can you help me?
November 12th, 2007 at 9:25 am
Hi I installed plugin on my sites, it works great. but when someone receive an email with link on my sites, in the mail isn\’t mailer\’s (sender\’s) name, but email of my hosting provider ( www-data ). Try it. link to friend is bellow the header.
December 11th, 2007 at 11:36 pm
[…] There’s a few different ways to do this, but my favorite (and the one on this site) is Send to a Friend. Clicking the e-mail link brings up the popup window you see here–simple and effective. You can even change the “Your Name:” and other prompts (and the colors) in the Options menu. […]
December 26th, 2007 at 2:18 pm
Hello,
I have problem, because I need not fromname and how can I delete it? I now how delete it from table but not from code
(When I delete fromname only from table this plugin does not send any mail.)
How can I modify css attribut at (because it destroy my div style)
Thank you for reply!
Bred
March 8th, 2008 at 11:38 pm
Wonderfull Plugin
I’ve enjoyed using it …! I’ve uploaded it on www.shockpill.com, it works cool!
March 10th, 2008 at 3:16 pm
Hi Sebastiaan! first of all thanks for the plugin!
there is a Js bug with Internet Explore 6, Enrico in an old post wrote the request of correction
the mystake it’s the propriety of labels tags into staf_Error function inside js.php.
Need replace the value inherit with a exadecimal color like #000
function staf_Error(stafErrorArr)
{
document.getElementById(’stafLblFromName’).style.color = ‘#000′;
document.getElementById(’stafLblFromMail’).style.color = ‘#000′;
document.getElementById(’stafLblToName’).style.color = ‘#000′;
document.getElementById(’stafLblToMail’).style.color = ‘#000′;
for(i = 0; i
March 21st, 2008 at 8:24 pm
Thanks for the plugin! I’ve uploaded it to a new site I’m making, at http://ecoseugene.org . I had to go in and reduce the font size to 80% for this site, but the send button is still not right. Would you mind telling me where to go to fix that? I’d enjoy making the background colored too, if you can give me pointers.
I really like how simple the plug-in is. Thanks again.
Angela
March 28th, 2008 at 9:55 pm
I am having two problems, If anyone has a suggestion that would be AWESOME!
when I download this file Version: 0.4.3 and then open up sendtoafriend.php it still says Version: 0.4.2
Also, when a user clicks on the link in my website (www.cheapestpcrepair.com) , the box is all mis-shaped, like there is not enough room in it.
where can I get the new STAF 0.4.3? thanks.
I would sure love a suggestion, thanks evryone!
April 14th, 2008 at 10:53 pm
Terrific plugin, which I am using here:
http://stc-montreal.org/en/
One question… Any hope of a version that works with Wordpress 2.5?
April 15th, 2008 at 3:20 am
Great plugin. Easy to customise. Works very well. Thanks!
August 19th, 2008 at 6:53 pm
This plugin is exactly what I have been looking for. I thank everyone who is involved.
Is there anywhere I can vote for this within Wordpress because it took me ages to find it!
I am using this on http://FastStudentCash.com, check it out for working example.
Thanks again
August 19th, 2008 at 9:31 pm
[…] Nome Plugin: Send to a Friend URL Original: Send to a Friend Autor: Sebastiaan Smid Tradução: Paulo Faustino […]
October 22nd, 2008 at 3:33 am
So, I finally got the plugin working…but, this thing with the positioning?
Is there a quick hack or something to get it nicely positioned?
position: absolute doesn´t work (it gets trapped to the right under an “image show” plugin. Tried position: fixed. Beautiful! IF you are on the top of the page when you click the link. If you´re already scrolled down a bit and click the link, the window shows up outside the browser and is unusable
Thnx!
October 31st, 2008 at 6:45 am
i put the code like that :
Por:
but it does’t appear, any idea how to fix it?
Thanks
February 17th, 2009 at 2:03 am
Works like a champ! I tried to put the code on the sidebar template -but- it didn’t work. So I just added “PHP Code Widget” and then I was able to place the code on that widget… easier! get the code here: http://wordpress.org/extend/plugins/php-code-widget/
Oh! and I’m running WP 2.7