This is the home page of the WP Opt-in WordPress plugin. The plugin collects e-mail addresses from users with a simple form.
Description
The WP Opt-in plugin can be used to send e-mail to users. The front side of the plugin is a simple form with an e-mail input field and a submit button. By entering an e-mail address into the field and pressing submit, an e-mail is sent automatically to the specified address.
The contents and sender of the automatic e-mail can be specified in options, along with whatever you would like for status messages and other text for the front side.
IP address and time for submit is stored together with the e-mail address in the database. E-mail entries in the database can be selectively deleted. Export to a Bcc friendly format is also possible.
Download
Get the WP Opt-in plugin here.
Installation
This list should do all the magic:
- Deactivate the plugin in the WordPress ‘Plugins’ menu if you are upgrading
- Download and unzip the plugin
- Upload the
wp-opt-infolder to the/wp-content/plugins/folder - Activate the plugin, place the widget in your sidebar and edit its title by using the Presentation menu
- Configure the plugin in the WP Opt-in menu located under the WordPress Options menu
If your theme does not support widgets, you can paste <?php if (function_exists('wpoi_opt_in')) { wpoi_opt_in(); } ?> into your sidebar file. This file may be called sidebar.php or similar.
Edit the title of the widget
The widget configuration dialog can be found under the presentation menu.

Troubleshooting
- If no emails are sent, check if PHP is configured to use a working SMTP server.
Version history
1.3 Text in notification e-mail changed to be more general. Made it possible to place the php file in either a wp-opt-in folder or the plugins folder. Recommended: folder (to be compatible with future versions).
1.2 Better Windows/Linux support. Thanks to Last Programmer for testing.
1.1 Improved PHP mail() compatibility
1.0 Option to send notification email, use form footer field, seamlessly perform database upgrade.
0.9.2 Correct bugfix in 0.9.1.
0.9.1 Tiny bugfix.
0.9 Remove old duplicates of submitted new email.
0.8 Fix register activation hook. Thanks to Jared.
0.7 Create initial opt-in-users database table fix.
0.6 Fix widgets on more WordPress versions.
0.5 Add control to edit widget title.
0.4 Correct typos introduced in 0.3.
0.3 Widget support. Thanks to Rune.
0.2 Add a comment and improve readme.
0.1 Initial version
Unresolved issues and feature requests
- Add new admin-page for writing e-mail to all opt’ed in users
- Replace mail() with wp_mail() for better support of other mail plugins
- Add option for file attachment in the e-mail
- Support sending of HTML e-mail
- The “To” field in sent e-mails has the receipient twice
- Add export email addresses to file possibility (select text in Settings -> WP Opt-in -> Bcc friendly format, copy and paste it into a text file)
- Configuration of fields and names of fields in the opt-in form: unlimited number of fields, field datatypes, …
- Possibility for CAPTCHA and verification e-mail
- Support for custom defined opt-in form, CSS class or ID for styling as default
- Option for removing multiple names at once
- Adwords conversion code to check how many registrations come from PPC
Support
Leave a comment below. Here is a translation of the fields, for those who do not understand Norwegian.
- Navn : Name (required)
- E-post : E-mail (required, will not be published)
- Hjemmeside : Website
- Varsle meg på e-post … : Send me an email on new comments here
Please use English in comments on this page.
I have tried to install this on ver 2.3.1 but I get an error message that tells me the plugin causes a fatal error and will not install.
I would love to integrate this on some of my clients sites.
Any ideas why this might be happening?
Hmmm, I’ve used this on both 2.3.1 and on WP MU 1.3, with no problems. What do your server (web) log have to say about the error?
–
Rune
Parse error: syntax error, unexpected ‘)’ in [my blog location]/wp-content/plugins/wp-opt-in.php on line 384
Also, it had an extra line at the end of the file, which I removed in a text editor. That’s when I was able to get the above syntax error. May want to fix the problem.
Dave and Sue: Oops. F#$@%! How did these typos get in there? It seems I messed things up a bit with the widget stuff. Well, now it’s hopefully OK again. Sorry for not beeing available for a while.
Rune: Thanks for helping
The plugin is working fine now, but it still had an extra line in at the bottom. I removed it, and everything showed up when I tested it. I changed the title of the widget in the file, you might want to add that in the admin options. I will be adding the widget in the next day or two when I prepare the download I’m using it to track. Thanks for coming up with this, it’s simple and just what I wanted.
Sue: I can’t find any problems related to an extra line at the end. More details on the error message, wordpress version, web server version, php version, etc would be helpful.
Version 0.5 should implement the missing widget title control. You might need to deactivate and activate the plugin (and select another theme and back again?) to make the missing widget control box visible.
Hi Petter,
From WordPress:
Blank lines (outside of tags) in index.php or any other core Wordpress file are not acceptable. They’ll cause output prematurely, which breaks things.
In other words, you get the can’t modify headers which confuses so many people. That just tells me something is wrong and the first place I’ll look is the last line for an empty one below it. Usually it’s caused by hitting return when you type the last ?>. After it’s removed, everything works great.
Hope this clarifies what I meant.
Thanks for all the helpful details, Sue.
If I’m lucky, version 0.6 should fix the blank line issues.
hi, could i’ve some files attached in the email?
ego2012: Thanks for the feedback. That’s a good feature request. I’m sorry, but current version does not support files attached to the email. A future version might include this. In the mean time, you could upload the file somewhere -and write the location (URL) in the email.
by now i can do in this way… i hope you will upgrade soon
btw do you know a WP-plugin that allow to download a file only once?
hi,
i’d like to add it outside the sidebar and without the widget system directly in PHP inside my home.php template… could you help me plz?
thank you
ego2012: I’m sorry. I don’t know any such plugin’s. Why would you like to limit the number of downloads per user?
Hi Peter,
I get the following error when I submit an e-mail to join the wp-opt in widget:
WordPress database error: [Table 'markbro1_wrdp1.wp_wpoi_users' doesn't exist]
INSERT INTO wp_wpoi_users (time, ip, email) VALUES (‘1197228803′,’76.0.32.157′,’e-mail removed to prevent spam‘)
How can I fix that from displaying in my sidebar?
Thanks,
Mark
i’ve had same problem seems that the plugin is not able to create de DB table… i did it by myself using phpMyAdmin using the SQL found inside wp-opt-in.php line number 109
CREATE TABLE wp_wpoi_users (
id mediumint(9) NOT NULL AUTO_INCREMENT,
time bigint(11) DEFAULT '0' NOT NULL,
ip varchar(50) NOT NULL,
email varchar(50) NOT NULL,
UNIQUE KEY id (id)
)
Peter: i’d like to allow only user that opt-in to download some files… so i think around using links that can be used only one time
Mark: That’s a bug, then. Thanks for the report. Will be fixed in the next version. But could you please try to deactivate and activate the plugin before checking again if the problem is still present? If it is, you might bypass the problem (before I fix it) by adding // to the start of line 107 and 141. Also, your WordPress and MySQL versions might be helpful.
ego2012: Thanks for additional details and help. Sorry for not beeing able to help with a download once plugin.
Hi Peter,
I have version 2.3.1, I am not familiar with MySQL and does line 1 start with the very first line of the file where it says this:
<?php
or does line one start somewhere else?
I did try to deactivate and then activate again but that did not work.
I am ready to tray what you recomened I just need a place to reference where line one is so I can count down to line 107.
Thanks,
Mark
Mark: I may have fixed it. Try updating to version 0.7. You will probably need to deactivate and activate the plugin after upgrading. I tested a tiny bit myself, but would appreciate feedback on your result.
Hi Peter,
I tried it again with the new version and this is the error message that displayed after clicking the submit button:
[Table 'markbro1_wrdp1.wp_wpoi_users' doesn't exist]
INSERT INTO wp_wpoi_users (time, ip, email) VALUES (‘1197241174′,’76.0.32.157′,’e-mail removed to prevent spam‘)
Any ideas?
Mark
Did you deactivate and activate the plugin after upgrading?
Hi Peter,
I did de-activate and then activate and I get two different errors in the “opted in users table both in the Bcc friendly format and the All details section, this is what it says:
WordPress database error: [Table 'markbro1_wrdp1.wp_wpoi_users' doesn't exist]
SELECT * FROM `wp_wpoi_users` ORDER BY id DESC
Mark
Hello Mark. Oh. This was bad. Strange. I managed to create tables with different names using the same code on my server. I will need some time to investigate (can not continue today). In the mean time, if you figure it out, the version of php and mysql might be helpful. You might get them by issuing the commands
and
on your server.
No problem thanks Peter, I looked at my control panel and I have mysql in there I just am not familiar with it.
Thanks again,
mark
I too am seeing an error on the options page that the table does not exist:
WordPress database error: [Table 'poscar.wp_wpoi_users' doesn't exist]
SELECT * FROM `wp_wpoi_users` ORDER BY id DESC
This has happened with both version 0.6 and 0.7. I am running WordPress 2.3.1, PHP 5.2.1 and MySQL 5.0.33 . I can create the table manually and everything then works fine.
Another suggestion I have is for you to use the wp_mail() function rather than mail(). This will allow your plugin to work with the various SMTP plugins out there.
Thanks for your efforts so far. I like the simplicity of this project.
Jared: Thanks for the solution! It has been implemented in version 0.8. Your great suggestion for using wp_mail will also be investigated when I find time.
Mark: Try upgrading
Petter,
I is working like a charm
Many thanks for this wonderful plugin.
Merry Christmas,
Mark
AKA – The Militant Marketer
Thanks for the patience and for reporting once more, Mark. Merry Christmas to you too. To prevent some future spam, I removed two tiny pieces of your comments here. Hope you don’t mind.
When I try to delete a Opt’d in user, I get the error ‘Cannot load wp-opt-in.php.’
Follow the install instructions. The php file shall not be placed inside a wp-opt-in folder.
Hi Petter,
I have that problem to. Where do we put the php file and where do we find it in order to place it somewhere else?
Thanks,
Mark
From the install instructions:
Upload
wp-opt-in.phpto the/wp-content/plugins/directory…but your placement seems to be here:
/wp-content/plugins/wp-opt-in/Hi Petter,
When I put wp-opt-in.php in the /wp-content/plugins/ directory I got the following error when I tried to activate the plug in.
Fatal error: Cannot redeclare wpoi_show_form() (previously declared in /home/markbro1/public_html/wp-content/plugins/wp-opt-in.php:33) in /home/markbro1/public_html/wp-content/plugins/wp-opt-in/wp-opt-in.php on line 38
Should I put it back in the wp-opt-in folder?
Mark
Oh. I’m sorry for not giving all the details. The folder
/wp-content/plugins/wp-opt-in/with contents should also be deleted.Petter,
Many thanks, once again you have schooled me in the finer points of programerology
Velen Dank,
Mark
As someone else pointed out to me, most plugins seems to have a folder. I’m currently thinking of a method to support both, but I’m not sure if it is feasible.
Thanks again for helpful feedback, Mark.
My apoligies for maybe sounding incredible stupid… but is this plugin only intended to collect adresses? So not for sending an email to the collected adresses on a later time? I would like to use it as a sort of update service to let opt-in subscribers know there have been updates on the website.
If it is only to collect adresses it works perfectly!
TIA,
Eric
Eric: There is no stupid questions. Only stupid answers. Thanks for making me explain better.
The WP Opt-in plugin automatically sends one specific email to anyone who enters their e-mail and press the button. All e-mail adresses are stored in the database, making it possible to manually send e-mail to e.g. everyone who have requested the information.
If you want to automatically send an email every time you write a new post, you could check the WordPress plugin called Subsribe2. It’s advanced when compared to WP Opt-in, but it actually does something else.
Did this answer your question?
Thank you Petter. So with manually you mean to copy/paste the adresses from the admin page into my email program? If so that’s ok too, as I really like the simplicity of the plugin.
Eric: Yes, you understand what I mean by manually. A future version might include an additional admin-page where it is possible to write e-mail to all opt’ed in users. I added this as a feature request up in the top.
Cool, that would be sweet (an extra admin page to send collective email) but till then I still will use it as I really like this plugin! Thanks Petter!!!!
Hello, This plugin is just what I was looking for, but I have a problem. When I submit the form I get the following error:
“PHP Warning: mail() [function.mail]: Failed to connect to mailserver at “localhost” port 25, verify your “SMTP” and “smtp_port” setting in php.ini or use ini_set() in D:\home\blog\wp-content\plugins\wp-opt-in\wp-opt-in.php on line 85″
I’ve verified that in my php.ini file the SMTP is set to localhost and the port is set to “25″, but I still get this error.
This installation is on IIS6 (unfortunately), any advice would be welcome! Thanks again for the great plugin. I hope we can get it to work.
Parker: If you don’t have a SMTP server running, you will need to either install one, or tell php to use a working server (in the ini file). Possibly something like this. I’m not familiar with IIS, but hope this was some help.
thanks! My server admin was able to provide the appropriate smtp settings. it works great!
Hello,
I love this! Is there anyway to port it to another plugin that sends “automatic” emails whenever a new post is made, or a comment is created? One that can be turned on and off?
Thanks!!!
Martin
Parker: I’m glad you figured it out.
Martin: Do you want to send a predefined e-mail each time a new post or comment is made? Would it be better if the e-mail contained (some of) the post or comment itself? There are plugins out there which does this (check subscribe2 and subscribe to comments) -but most of them are a bit more complex to set up and use. Then again, I might have missed something in what you want. Thanks for commenting and making good suggestions.
Hi Peter
Thanks for a great plug in, my problem I hope is a simple one, I cannot change the title, it shows up in the website as wp opt in, but when I try and configure it to show subscribe, I then save the settings and refresh but it still says wp opt in, any idea? or somewhere in the code you could point me to where I can change it manually.
Thanks in advance and merry christmas everyone
Hello Steven. Does the new widget configuration picture help? Or could it be some issue with your version of everything? If you don’t find a solution, I will need more details about your setup.
And merry christmas to all
opt-in seems great. the only problem i’m having is that everytime i refresh my blog page, i get re-subscribed. is there something i should be doing to make sure that the form clears and resets itself after it gives the success message once? thanks!
Chris: Thanks for reporting back. Is the refresh problem present only after you have submitted an e-mail adress with the opt-in form? Or can you quit your web-browser, start it again, load your blog page, hit refresh and get re-subscribed? Do you have similar problems for e.g. comments? And is the problem present only in the Safari browser?
(I guess handling of two identical e-mails in the database could be better by removing the oldest, but I need more details to make the plugin behave better on refresh)
Petter,
Great plug-in! Thanks! Any plans to add the option to integrate with a MySQL database?
Nevermind, I checked my MySQL database and saw the wp-opt in table, and I can glean the info I desire from that. Thanks for the GREAT plug-in and Happy New Year!
Thanks for those links. I use “subscribe to comments”.
Maybe I’m missing something but…I can get the widget on the page, and I see on the admin > options area the email addresses it collects. But then what? How do I send those users an email? Does the plugin automatically send one? I’m stumped?
I’ve signed up my wife as a test, so once I get her email submitted (via your plugin), what do I do next?
Sorry!
Martin
Brad: Thanks for the feedback.
Martin: The plugin sends an email (as configured in the plugin options page) automatically when it collects email addresses (if PHP has been configured to use a working SMTP server). To send email after the first one, you must copy the addresses from the section called “Bcc friendly format” on the “Options” / “WP Opt-in” page. Paste them into your favorite e-mail client. A future version of this plugin might support sending e-mail like this from inside the WordPress admin menu without the copy/paste operation. Please let me know if any of this information was helpful.
Happy new year to everyone!
Thanks Petter! I “get it” now
Hi
Nice widget.
How to css it?
How can I use css on he submit button?
Thanks
Is there a way to export the list of all mails?
for instance if I got about 5000 how to export to a txt file?
Martin: Great
Marc: Maybe you can manage by placing a <div class=”…”> in the form header field located on the plugin options page? (and matching </div> tag in the form footer field) If not, I guess you need to write some css into the php file yourself. The code you are interested in is located in the wpoi_show_form function, around line 36. Please let me know if you need to hack inside the plugin. Regarding export: you will (currently) need to make an empty text file, and copy all the emails from the bcc field, and paste them in the file. I added a feature request for export to file on this page. Thanks for good feedback.
Hello,
I’ve got this working great, but when I try to delete an opt-in user, I get this error page: Cannot load wp-opt-in.php.
Can I get help?
Thanks!
Martin
It’s really amusing how popular this little plugin thing seems to be
Martin: You need to place the php file in the plugins directory. Not inside a wp-opt-in directory. A future version might support this type of installation.
So you’re saying DONT do this:
\plugins\wp-opt-in\wp-opt-in.php
But do this:
\plugins\wp-opt-in.php
The plugin works the first way, but gives the error when trying to delete a user’s email. So this will fix that?
Thanks!!!
Martin: Yes
Thanks for explaining it better.
Works perfectly now!
This rocks!
One last suggestion. Can we get a future version that checks for duplicate entries? I have a few users that signed up twice (don’t know why), and so I get them listed multiple times.
Martin: Great! Thanks for the suggestion. I extended one of the feature requests.
Thank you for this neat and useful plugin!
Thank you for the plugin.
It doesn’t seem to be emailing.
Do I need to check off something to
make it email.
Thanks,
Jim
Can we get other options in (or show us where to hack the plugin ourselves) as well as email address?
I mean, like fields for “First Name”, “HTML or plain text”?
7162: You are most welcome
Jim: I tried to insert a Troubleshooting section in the post (search from top of this page). I hope it can help. Please let me know if it’s not sufficient.
Martin: Everyone is free to hack in the plugin. It’s GPL. Or you can make suggestions here. Stuff I think is good and feasible will be added when I find time.
Wondering if you can tell me (briefly) what Im doing wrong. Trying to call the widget from within a tabbed php file. I can get it to show up but not work by using
but if I use just
Simon: It’s difficult to understand the problem. Please check your email.
How do I change this text “Receive information automagically here.” ???
I have found it in the file to upload but when I change it, it does not make a difference.
Can You help??
Chris: You can change the text under the “Options” -> “WP Opt-in” menu in the WordPress admin-panel. The text in the php file is the default value which is written to the database the first time you enable the plugin.
Thanks so much for the plugin – it worked….
hey,
i have problems with this plug in i to of my blogs
one of them i located here: http://blog.miguelovitch.dk
error looks like this:
WordPress databasefejl: [Table 'miguelovitch_dk_db.wp_miguelovitchwpoi_users' doesn't exist]
INSERT INTO wp_miguelovitchwpoi_users (time, ip, email) VALUES (‘1203589987′,’<ip address removed>‘,’<email removed>‘)
any idee how to find a work around this issue?
I have another blog at http://myluckymedia.com on this blog wp optin works fine
best regards michael
Kendra: Thanks for positive feedback
Michael: This was odd. Are you using an old version? Does it help to deactivate and activate the plugin? (I removed the IP and email address in your comment)
Hi! I found this problem. When i suscribe an e-mail, the response is this:
“Warning: mail() [function.mail]: SMTP server response: 550 Delivery is not allowed to this address. in [part of path removed]\wp-content\plugins\wp-opt-in\wp-opt-in.php on line 85
Error al enviar.”
Could you tell me why this problem could be provoqued?
Thanks so much!!!
Mauricio:
I have tried to reply to something similar. Does it help? Or could it be that you entered a non-valid e-mail address? Also, you should move the wp-opt-in.php file to the location specified in the install instructions (this might be improved in a future version).
(I removed a pice of your comment to avoid unneccessary exposure of your server)
I’ve got the some minor problem with this plugin. But after reading all the posting I could fixed it up. Just wanna say GREAT WORK…!! THANK YOU!!
I’ve used the plug-in in the past and it worked great.
The new update doesn’t appear and doesn’t allow the other widgets to appear. Any thoughts? I’ve taken it off of the widget until I can get this figured out.
Thanks,
Jim G
Rossi: Thanks for feedback
Jim G: Oh f**k. This was bad. Thanks for the bug-report. It may be some combinations of php version and web-server (or one of them?) which handles whitespace (especially linefeed?) differently than others. What versions do you use? (if you don’t like exposing your system with version numbers on the web, you can send me an email with this form.
Jim G: Thanks for helpful feedback by email. The new version should fix this.
This could be more of a theme issue than a problem with the plugin, but when i add <blockquote cite”"> to my sidebar.php, everything the css goes crazy! Everything under the plugin is moved to the left of the sidebar and the style isn’t consistant. Is there any way to fix this in the plugin, or through css (to make it not effect the theme)?
*correction
This could be more of a theme issue than a problem with the plugin, but when i add the: ?php if (function_exists(‘wpoi_opt_in’)) { wpoi_opt_in(); } ? code to my sidebar.php, everything the css goes crazy! Everything under the plugin is moved to the left of the sidebar and the style isn’t consistant. Is there any way to fix this in the plugin, or through css (to make it not effect the theme)?
Jason: There is a little bit of html i the function called wpoi_show_form(). But let’s try something else first…
Default values for the options in the admin-panel are:
Bad e-mail: <p><b>Bad e-mail address.</b></p>
Failed to send: <p><b>Failed sending to e-mail address.</b></p>
Success: <p><b>Sent requested e-mail.</b></p>
Form header: <div class=\”widget module\”>Receive information automagically here.
Form footer: </div>
E-mail field: E-mail:
Submit button: Submit
Does it help to change some of them back to default? If not: which theme are you using?
Thank you SOOOOOO much! That did the trick! whew.
Thanks for nice plugin Petter! It does exactly what I was expecting.
The one one thing that I can think of is to make the message field HTML editable, so we can copy and paste templates. Anyone can now subscribe to our eNewsletter from the shopping cart and blog. I will try to implement it in our directory too.
Other than that, the plugin works great!!
Jason: Great to know this worked fine, and nice to be able to help.
Global Fusion: Thanks for positive feedback. I guess you mean HTML in the email to send. If so, it’s now added as a feature request.
I keep getting this msg:
When I download the new version and FTP it to the site, I still get the old one.
Any thoughts?
Martin: This was odd. I downloaded the latest version from WordPress, and it states version 0.9.2 in the php file. What’s the version number in the php-file (can be opened in a text editor) located on your server? Optionally: what’s the version number in the plugins list in the WordPress admin-panel plugins list?
I get Version: 0.8 – and that’s with deleting my local copy, downloading the one from WordPress, deleting the one on my server, FTPing the new one, and still… version: 0.8
I’ll try again now…
Ok, it was my batch file that did NOT overwrite the old file with your new file, so I had to manually copy/paste.
Thanks, it’s updated now!
Martin: Thanks for the status-update, and good you figured this out. The upcoming plugin update function in WP 2.5 will probably not work with this plugin, making me wonder if your problem was WP 2.5 related.
I actually haven’t switched to 2.5 yet, but will be installing 2.5 RC2 today. I’ll let you know how THAT goes with your plugin
So for future updates of your plugin, I would just check your site for them manually?
Martin: The next version will hopefully support the update function. Upgrade to the current version with the 2.5 update function will probably not work correctly as I suspect a structure like plugins/wp-opt-in/wp-opt-in.php will be required. And some admin-stuff did not work properly when placed in a folder. Feedback on 2.5 RC2 would be appreciated.
Hi Peter,
I just did a “clean install” of WP 2.5, and then I added your WP Opt-in plugin to it. Everything seems to be working beautifully
Thanks a lot!
Tamer: Thanks for the update
(and you are most welcome)
If anyone has tried the automatic upgrade function in WordPress 2.5, I would be very interested in some feedback on the results.
Hi Petter!
Really nice plugin! Like it a lot!
I just starting a new blog and my traffic is not that big. would there be the possibility to set the admin email on bcc? so I know there is a new subscriber? It’s just for the first start period of the blog.
I try to find it in the code to add it, but don’t wanna do it without you
I think it’s only a line like “$email_bcc = “admin@domain.tld” ;
or do you think it’s bullshit?
best regards
braeburn
Tried it out, and when I call
it just breaks the page, probably from a not being closed or something? I’m surprised no one else has this problem, also had issues with the DB automatically creating the tables, Which I was able to manually enter thanks to someones comment here.thanks anyways
the code was removed form my comment, but I’m manually adding the opt-in form to my header not using a widget.
Sorry for not beeing especially quick with updates and replies.
braeburn: Thanks for positive feedback. I think your suggestion is great, and added it to the feature request list.
mike: Regarding manual add of tables: Are you using the latest version? (check the version number in the list of plugins in the admin-panel) If so, could you give some information on the php version used on your server? Regarding the addition of the plugin in the header: I sent you an email.
Hi,
Thanks for this plugin!
Maybe I’m missing something, but is there a way to use this in the body of a page, rather than on the sidebar? For the project I’m working on, it makes sense to just have it appear on one page, rather than all of them.
thanks,
Harris
Harris: If you want the plugin to appear only when not looking on an archive page and not a category page, this code could be used:
<?php if (!is_archive() && !is_category()) { if (function_exists('wpoi_opt_in')) { wpoi_opt_in(); } } ?>More description of conditional tags is available on the codex. I guess you need to check
is_single(). Possibly something similar to this (but you probably need to change the number 17):<?php if (is_single('17')) { if (function_exists('wpoi_opt_in')) { wpoi_opt_in(); } } ?>In addition, you could (probably) insert php code (almost) anywhere with the Inline PHP plugin.
Hello,
A great little plugin you have here, nice work!
I am creating a new marking site and have installed this plugin on the latest WordPress 2.5 and it works beautifully for me. I was also able to place the opt-in form in an actual post by using the Exec-PHP 4.6 plugin and turning off the visual editor to add the form code in a php statement.
This plugin is almost just what I need. I really love the simplicity and reliability of its function..
However, I would like to add a “Name” field to the opt-in form! And have it work just as it does, yet record the name as a record in the admin as well, like it does with the email and IP address. I could probably add the field to the actual form pretty easy but would also like this “Name” to show in WP admin under the plugin Wp Opt-in users too. Not necessarily in the Bcc area, but below that in the table, would be great!
Could you possibly give us any help with how to go about adding an extra field to the form on this nifty little plugin?
Also, would be super nice to be able to use html in the “E-mail to send users, Message” as was mentioned in a comment above.
Thanks for help and for the great plugin addition,
Quality Net Design: Thanks for a great feature request! This should include storage of name, and a field for this is needed in the database table. I think an option in the admin-part to enable/disable this functionality should also be implemented. Some code will be required several places. Sorry for not beeing especially quick regarding feature requests, but this is done as a minor project on my free time.
Hi Petter,
Can you include a “Name” field in addition to the “Email Address” field?
John: It’s now on the feature request list.
Hello,
Thanks for your plugin,
Very good one indeed.
Best regards,
P-C
Whenever I try to activate the plug-in I get this error:
Plugin could not be activated because it triggered a fatal error.
Do you know what I could be doing wrong?
P-C: Thanks for good “it’s working” report
Garret: Are you using the latest version (please check the plugins part of your WordPress admin-menu, if it states version 0.9.2) ? If so, is the php-file located at the location specified in the install instructions? If this does not help, it could be a conflict with another plugin. Disabling all plugins and enabling this plugin first should then work. Please help me fix the problem by providing more feedback, if you find a possible conflict or this does not help.
Hello again
The plugin is working good, but it doesn’t use the stylesheet my site is set to. How can I configure this? I want to avoid putting tags in the form elements for wp-opt in.
Best regards,
P-C
P-C: Thanks for good ide for additional functionality. It’s now added to the feature request list. Hopefully I’ll be able to add some of the new stuff soon.
Hi
Is there an easy way to add the subscription field inside a post?
Thank you for this awesome plug-in.
Regards,
Justin.
PS: You should start a forum so that your users can also provide tech support to other wp opt-in users.
Thanks again.
Justin: A filter could have been added to make this possible without adding other plugins. Currently you should be able to do this by e.g. installing the PHP Exec plugin and adding the code to place in the sidebar for themes which does not support widgets in it.
I have also been thinking of a forum for a while. It would definetely organise the information in this comment field much better. I think a forum should be possible to use without registration, to make it easy to enter information in it. bbPress seems like a nice alternative, and recently it has added support for checking of posts and comments with Akismet. It’s on my todo-list.
Hi Petter
Thanks for your quick response. I will try to use the PHP Exec plugin.
Justin.
The plugin seems to be sending multiple emails to users when they opt-in. How can I fix it?
thanks!
-d
Darren: Multiple emails? I tried once more here, but I only get the additional notification email, if the notify field in the admin-panel is not empty. Could it be something strange with the mail setup on your server? Does other php functionality send you only one email on other “activity”? Are the multiple-emails sent from WP Opt-in identical? I might need more information about your server if this does not help.
Why would I get this response after having an e-mail submitted:
Warning: mail() [function.mail]: SMTP server response: 451 See http://pobox.com/~djb/docs/smtplf.html. in D:\Hosting\3090636\html\wp-content\plugins\wp-opt-in\wp-opt-in.php on line 132
Does other php functionality send you only one email on other “activity”?
Yes I have had good results with Cforms.
Are the multiple-emails sent from WP Opt-in identical?
Yes, they are identical.I got three as a matter of fact from one sign up.
I might need more information about your server if this does not help.
What specifically can I tell you?
-d
Last Programmer:
Oh… This might be a tough one. Some mail servers seems to not support carriagge-return / linefeed in php scripts, and others require them (the old and still ongoing MS/unix fight). Is it possible for you to upgrade your mailer? The [mail function] part of your php.ini could also be interesting.Correction: thanks for the bug report. This will be fixed ASAP. Could you try this version before I update?Darren: Thanks for more feedback. I checked around. This could be related to a problem in Outlook/Exchange. Let’s try a long shot first. Please try
to insert this code at line 113 in wp-opt-in.php (it’s a text-file):
this version.$headers .= "Message-ID: <".time().rand(1,1000)."@".$_SERVER['SERVER_NAME'].">\n";Let me know if it works out
-I would like to make a better fix.If this does not work: could you set it up a let me try to opt in? Your php version and the [mail function] part of your php.ini file might also be helpful.
How would I go about putting the submit button on the same line as the email box? I would love for this to be on the same line for cleanliness.
Thanks
Darren and Last Programmer: Version 1.1 should fix your problems.
Matthew: “Support for custom defined opt-in form” is on the list of feature requests. For now you can change line 65 and 66 in the php file to:
echo '<input type="text" size=3 name="wpoi_email" id="wpoi_email" />' . "\n";echo '<input type="submit" value="' . wpoi_get_option('wpoi_form_send');
If this does not fit on one line, try to reduce the additional size parameter or change the Submit button and/or E-mail field in the plugin options to something shorter.
I appreciate the attempt, Petter, but even 1.1 is providing problems. Upon submitting an e-mail address to the Opt-In, it now says:
Last Programmer: Thanks for giving more feedback. This was odd. The plugin should (but I’m not sure) comply with the PHP mail function. According to the documentation, the message parameter should end lines with only LF, and additional_headers should have CR and LF. I will investigate further to be able to point to an issue with either qmail, the php manual or this plugin (or your setup?).
That would be very helpful, Petter, as this is my best option rather than a separate Forms page for receiving new e-mail addresses.
The site is http://www.last-command.com if you care to have a look.
Last programmer: I sent you an email. Hopefully with a fix.
I think that your opt-in plugin is just what I have been looking for and I thank you very much for making it available.
2 Issues though:
1 – When I attempt to delete a name from the database I get “can not display page” screen and it says HTTP 500 Internal Server Error. Any ideas on what is going on there? How will I be able to un-subscribe people?
2 – How do I load the database into Dada mail; to use it to generate mass E-Mailings? Or is there some other thing I need to do to send bulk mailings from this database?
Thanks again, look forward to hearing from you,
Charlie
Charlie: Thank for the feedback
1) Try if moving the wp-opt-in.php file to the location specified in the install instructions helps.
2) A future version might include the possibility to send email from the admin-panel in WordPress. I don’t know if this will work with your Mailing list manager, but: For now you can hopefully select the text under Bcc friendly format, right click, choose copy and paste it into Dada mail somewhere. If this does not work, you should be able to paste it into your e-mail client.
Hi Petter
Thanks for this plug-in. It was working perfectly, but now it gives “Failed sending to e-mail address” whenever I try to subscribe an email address. I think this might have begun after I did an auto-upgrade.
I’m using 1.2 of the plugin and WP 2.6.1.
Any ideas?
Martin: Thanks for the feedback. I have not tried the auto-upgrade myself, and was wondering if it could affect this plugin. The error is an effect of failure from the php mail function. Could you please try version 1.0 and 1.1 of the plugin and report if any of them does not work. Some info about your server would also be helpful (operating system, web-server software, php version and if safe_mode is enabled or disabled in your php.ini). If you don’t like to “expose” your server information to others, you can send me an e-mail (the fields from the top are name, e-mail, subject, message).
Out of curiosity, regarding the auto-upgrade: where does the wp-opt-in.php file end up? In a folder called
wp-opt-ininside thewp-content/plugins/folder, or directly in thepluginsfolder?Petter
Thanks for your quick response.
“Could you please try version 1.0 and 1.1 of the plugin and report if any of them does not work.”
Same problem with 1.0 and 1.1.
“Out of curiosity, regarding the auto-upgrade: where does the wp-opt-in.php file end up?”
Good question. I think it puts it in a wp-opt-in folder in the plugins folder. The wp-opt-in.php file was originally installed in directly in the plugins folder but somehow made its way to a wp-opt-in folder within the plugins folder. It may have been auto-upgrade which did this, or it may have been a human as there are two of us who have had been working on the files. However, I suspect it was the auto-upgrade process.
I’ll get back to you with the server info.
Martin
Petter
Some more info. When I submit an email address, it records in the database my default WP email address, not the one I submit. This happens whether I’m logged in or not, and on different computers.
Martin
Martin: Do you know which version you upgraded from?
Hm. Could you try to delete the wp-opt-in folder and put the php file directly in the plugins folder? Without using the auto-upgrade.
This might also be related to your SMTP settings in a file called php.ini (but I don’t think so).
can you somehow unsubscribe me from the updates? I can’t see how and I don’t need the emails. And this is all in German.
Edit: E-mail address removed
Martin: I will get investigate further and come up with something soon.
Darren: Oh. Sorry, the subscribe / unsubsribe pages are in Norwegian. I removed your e-mail subscription to comments on this post, and removed your e-mail address from the comment field to avoid spam in your inbox.
Love the e-mail plug in but want to add a graphic to the outbound e-mail.
How can this be done?
David
David: Graphics and other formatting functionality is probably a part of the HTML-email feature request. It’s not implemented yet.
(I modified your link to the graphics to avoid running a CGI script on your server when someone follows your link)
Thanks for the update. Any chance we can get an auto notice when you have HTML functionality installed?
Pd thanks for the CGI protection too. I am too trusting.
David: You will be notified in the list of plugins (in “new” versions of WordPress) when a new version is available, if you have this plugin installed on your server This also works if the plugin is deactivated.
Martin: Sorry for not beeing able to help you. I suspect the problem is related to your server.
I would appreciate feedback if anyone seems to have the same problem as Martin.
HI, thank you so much, this is a great plug in.
My question is about the Notify: option where it states..
Also notify to this email when someone opt-in. Leave blank for no notification.
When I insert a email address into this area, the email that is sent arrives with the subject line “WP Opt-in notification,”
and also has the words “Password sent to new address” in the body of the message.
why is this?
and secondly – still on the Notify: option, is there a way to include the submitted email address in the Notify: email body.
thanks Robert
sorry the submitted email address does come in the in the Notify email, still wondering what the “Password sent to new address” in the body of the message, is all about Robert
once again great work!
rhilts: The “Password sent to new address” is an incorrect term. It match how I use the plugin here -but should be more general. Will be fixed. Thanks for reporting this.
Awesome Plugin!
Add new admin-page for writing e-mail to all opt’ed in users
I can’t wait for this feature, any idea when?
Jeffrey: The feature will hopefully be added soon …but when thinking of time I expect to use on the plugin in near future, it’s probably going to take a while. Anyone capable are most welcome to implement any features or improvements and make the new plugin available for everyone (the code is GPL).
Hi,
I’ve installed it okay but it’s not showing on my site. How do I ahve it showing?
Also, I know there’s a welcome message set up but how do I email them on other occasions?
Thanks,
Jackson
Jackson:
Are you using a widget enabled WordPress theme? If you are, there should be a “Widgets” sub-menu under “Design” in the admin-panel. Click “Add” on the “WP Opt-in” widget in the left side column, place it (by drag and drop) in the order you want it in the right side column before you hit “Save changes”.
If you are not using a widget enabled theme, you will need to paste some php-code in the sidebar yourself:
<?php if (function_exists('wpoi_opt_in')) { wpoi_opt_in(); } ?>This code is typically pasted in a file called sidebar.php
Regarding how to send e-mail on other occasions: “admin-panel -> Settings -> WP Opt-in -> Bcc friendly format”. Select and copy. Paste it into the bcc-field (you should not reveal all addresses to everyone by using the to-field) in your favorite e-mail client software.
Thanks Petter,
I saw the widgets link and have it shwhowing now. And thanks for the info on the emailing.
One more thing; how do I access the actual email info from people who’ve signed up, so I can see how many sign-ups I have etc?
Jackson
Jackson: If you scroll a bit down on the admin-panel settings page for WP Opt-in (below the “Bcc friendly format”) you should see the list with opt’ed in e-mails.
hej petter, thanks a lot for this very helpful plugin… but i have one problem: the confirmation e-mail is being sent 4 times? do you have any idea what the problem could be? thx! and best wishes from berlin
mrtn: Oh. This problem seems kind of familiar. I did not find a solution last time. Could you please share some details about your smtp mail server on the blog host you are using? Possibly software and version. If you have access, some of this information could be in a file called php.ini.
If you do not want to share this information in public, you can send me an e-mail.
Hey,
is there a way to reset the ID numbers? So is it possible to have the ID numbers follow eachother, even if there are a few deleted email addresses?
greetings!
aheme: Good question. The ID numbers are only used to uniquely identify a database entry. They could have been hidden as they should not serve any practical purpose for you (maybe I forgot to remove them after debugging initial versions?). Sorting the table by date (or optionally e-mail?) could be more logical.
Anyone know how I can change the color of the text on the form from white to black?
Thank you.
Peter: The feature request “Support for custom defined opt-in form” could be the best method for solving your problem. Until it’s implemented, you can check my reply to Marc.
Hello again Petter!
Still using your excellent plugin. I wonder, is it possible to post the opt-in form (text box with button) in a post or page?
The reason why I want this is because I want to write a text with information about my newsletter, and have the opt-in form right there.
Thanks again!
P-C
P-C: You might be able to fix this yourself. The Exec-PHP plugin executes PHP code where you want it. This is the PHP code you want to execute:
<?php if (function_exists('wpoi_opt_in')) { wpoi_opt_in(); } ?>Thanks Petter, it works like a charm!
P-C
Petter – so i am new to wordpress. i recently added your plugin to my site (i currently deactivated it) and was wondering where it creates the database and how I can access it.
Thank you in advance for your help
//Gupta
P-C:
Gupta: The plugin use the same database as WordPress. Settings are stored in the options table and details about opt’ed in users are stored in the wpoi_users table. Both these tables should have the prefix defined by the table_prefix variable in your wp-config.php file. You might have access to phpMyAdmin (or something similar) to view the details inside your database.
hi. Thanks for plugin
perfect.
Regards
Hello from California!
We would like to use your plugin and tried in on wp271 using Blue Zinfadel theme by Brian Gardner. We tried placing the widget in the left hand side bar in between the search box and blogroll and it caused blog roll to jump into the large posting middle area and deleted most of the vertical hairline ruled lines demarking the posting area (both left and right) from sidebars
I tried again as the bottom widget in left sidebar and since nothing was below it nothing got pushed into top of next section but both ruled lines were truncated.
Can you please advise how this valuable plugin could be made to be more compatible with this theme? thanks.
baron:
Bill: Oh. The feature request Support for custom defined opt-in form should obviously be of high priority.
In the mean time you might be able to fix this by changing the Form header and Form footer fields located on the plugin settings page. Possibly to something like this:
<li id="event-calendar" class="widget ec3_widget_cal">…and:
</li>If this does not work you can change some HTML in the function called
wpoi_show_form()inside the php-file.Hi Petter,
plugin was working great until very recently,
then started getting this message:
Warning: mail() [function.mail]: SMTP server response: 503 This mail server requires authentication when attempting to send to a non-local e-mail address. Please check your mail client settings or contact your administrator to verify that the domain or address is defined for this server. in [my blog location]\news\wp-content\plugins\wp-opt-in.php on line 131
this was before the upgrade, tried the upgrade and completely reinstalling with no luck.
I’m not very familiar with servers etc, so I’ve also contacted my hosting support as we’ve made no changes on our end and it seems odd that it worked and no it doesn’t…
let me know if you have any advise…
thanks
Hi Petter,
Your sumbit buttom is below the input box by default. how can i make the sumbit buttom’s position by the right of the input box?
Thanks.
Yuri: Hopefully your hosting support will fix the problem. You could try to use an old version of the plugin. Please let me know if an old version works.
pianyi: Please check my reply to Bill March 1st 2009 (ignore second paragraph in it).
Hello Petter – Thanks for the information on the table. that’s all worked out, however the next step is that I need to make changes to the options and would like to send the emails with Bcc.
in Wordpress 2.7.1, and with the Shadows Options theme that I am using, I do not see an ‘Options’ selection in my menu to make changes to WP Opt-in. Also, I can not find the interface where I can copy the email addresses or send bcc emails.
Thanks.
//Gupta
Thanks for the plugin Ok I am using a non widget supported wp theme and got it to work however my only question is the following. How do I change the font color my background is black and the text is black so very hard to see it. Thanks in advance.
Hi Petter, how to get high priority? and how to make your plugin support utf-8 languages like chinese and japanese?
Thanks.
Gupta: In the admin-panel, “Settings” and “WP Opt-in” there should be a section with “Bcc friendly format” as header. All opt’ed in e-mail addresses should be there. Select them, copy and paste it into a text file or your e-mail client program (e.g. the “Bcc” field in a new e-mail inside Outlook).
John: You might be able to fix this by adding e.g. a <div class=something> around the place where you pasted the wpoi_opt_in function. Possibly something like this:
<div class="pagenav"><?php if (function_exists('wpoi_opt_in')) { wpoi_opt_in(); } ?></div>(you might want to check your style.css file in your theme folder to select the class with the the colours and font you want, or use the same class as something else in your sidebar)
pianyi: I guess I should include a paypal-possibility here to make it possible for others to make me hurry or prioritise differently. But then again: I do not think I will use time on doing this. Regarding UTF-8: What does not work as expected?
Thanks peter for responding to my comment, however I am still having some trouble changing the color for some reseaon it wants to stay as black letters. Anyone else got any ideas?
John: Sorry for not beeing much help, but I need to use time on other stuff… I can recommend a HTML tutorial and “view source” (right click on the web-page you want to change). Optionally you could try a theme with widget support.
Hi Petter, The plugin works great and I at one time edited the message but cant figure out how now. The messages go to my personal email now just fine. What I wanted to do is to have the info go to an auto responder in host gator cpanel. Is this possible? I couldn’t figure out how to set the email destination. Forgive me but I am a complete newbie and don’t know anything about code except for the basics in html.
I’m not sure if I understand what you want. Do you want two e-mail destinations? The notification e-mail address should be in the “Notify” field on the WP Opt-in options page in the WordPress admin-panel. If you are lucky, you can enter two e-mail addresses in the Notify field separated by comma.
Sorry, I didn’t realise my error in thinking until I thought about it. Just need to be able to change message and email address. I know I did this about 3 months ago and I cant figure out how I did it.
Thanks for the help I really appreciate it. Your the first person to get back with me in about 20 posts and 5 emails for various help
Now if I can only figure out what is with my wpnamedusers I will be ready to open my site.
great plug-in…one thing I am noticing: the email auto response is listing the recipient name twice as if it is being sent twice; I am only getting one email which is correct. Header looks like this when I receive.
From: newsletter_nospam@drtond_bot_bait.com
Subject: Dr. Tond Newsletter
Date: March 20, 2009 11:24:18 AM PDT
To: larry_nospam@hdesign_bot_bait.com, larry_nospam@hdesign_bot_bait.com
Larry: Oh. Wow. Thanks for the bugreport. (I made a few small changes to your comment to avoid spam-bots indexing this web-page to fill up your e-mail inbox)
hello, can you add a name field in the opt-in form?
Yes. It’s on the feature request list. But I don’t know when I’ll do it…
Fantastic Plugin. I’ve been using it for quite some time now and I think you’re doing a great job. I have a feature request that someone may have already asked for so please pardon me if I am repeating the request. I would like to see the option for removing multiple names at once, maybe a check box to select specific emails and then a “check all” option as well. I am running WPMU so have multiple customers using your fantastic plugin and many of my customers have asked me if I could do this. I wouldn’t even know where to start so I thought best to ask you first
Is this a possibility for the future?
Thanks so much!
Courtney Bostdorff
Courtney: Wow. My plugin on WPMU
Thanks for feedback. Your feature request was added to the list. Its definitively possible. I can not promise anything with regards to when, though.
Great plugin.
Question: Can I somehow use this not as a widget or in the sidebar.php, but on an html page? Is there a way to call the email submit form that way?
Thanks.
~J-Ri
Jason: Yes, you can. Simply rename your *.html file to *.php and insert
<?php if (function_exists('wpoi_opt_in')) { wpoi_opt_in(); } ?>where you want the form. PHP is parsed by the webserver as HTML everywhere outside the<phpand?>.Hello,
The plug-in description says, “Export to a Bcc friendly format is also possible.” – can you explain how this is done please?
Thanks!
Martin
Martin: select (mark) text in “Settings -> WP Opt-in -> Bcc friendly format”, copy and paste it into your favorite e-mail client or text editor.
Hi Peter, great plugin, I enjoyed it ! ^_^
I got problem the same as Larry- 20. mars, 2009 which got duplicate email on email Header (like larry’s example
To:larry_nospam@hdesign_bot_bait.com,larry_nospam@hdesign_bot_bait.com)
how can i fix it ?
and when I add email from opt in, I got error from my webmail
From: Mail Delivery System
To: h5…@…..net
Subject: Mail failure – malformed recipient address. How can this happen ?
Is is posibble if I also want to get email who is filling my opt-in from email I write on “From:” ? so I don’t have to open WP-Admin.
Thanks
Yenni.
hi Peter, I already knew if I want to get email (notification) then I must fill “Notify” field.
sorry for a stupid question ^_^
Can you help me? Installed the plugin. Created a special page and inserted the line as above and all works. However, when I add the plugin as a widget to the top sidebar for some reason everything below the wpoptin plugin loses its formatting. Can someone explain what may be happening?
Yenni: We are all humans. All humans make mistakes.
Adam: Oh. Could this be related to your theme? Your web-page seems allright now… Did you figure this out yourself?
Petter: thanks for the reply. What I finally did was I removed the closing tag in the sidebar html; which may mean, and I know very little about scripting, that there is a closing somewhere in the wpoptin plugin file. this is the code that I have in the sidebar:
Subskrypcja
<!– –> (when this is left open it causes everything that follows to be without any CSS formatting.
Adam: Thanks for the bug-report. I will remove the unnecessary code in the next version.
hi Petter
I don’t know if this question has been addressed yet. I scanned through posts but don’t have time to read all of them.
When I place this as a widget in my sidebar it misconfigures my blog page. About half the page turns into grey background. It’s changing the formatting. Any help would be appreciated. thanks!
Suzanne: Does it help if you use the default values?
Petter—thanks for getting back to me.
I checked and those defaults are already in place. It seems there is something in the script that is altering the table in my theme template. In brief, it is cutting the white background border shorter so that a huge portion of text spills into the grey area.
I’m using Wordpress’s default template….don’t know if that has something to do with it. I uploaded a more advanced theme can can try that.
But for now…it’s rearranging my template somewhat.
Suzanne: Oh. Does it help if you change line 67 in the php-file to:
echo '" /></p>' . "\n</form>\n";?
And… Could you paste your web-page URL somewhere?
hi Petter
I wasn’t sure if this was line 67 but I went in and made the change. With no luck.
Here is a cut and paste of that section so you can see where I inserted the change:
function wpoi_show_form()
{
echo ‘” />’ . “\n\n”;
echo ” . wpoi_get_option(‘wpoi_form_email’);
echo ‘ ‘ . “\n”;
Also, when you said to paste my url somewhere…did you mean in this php file? I tried that and it deactivated the file. I probably misunderstood what you meant.
weird…that didn’t seem to paste the correct information. Let’s try again:
echo ‘” />’ . “\n\n”;
echo ” . wpoi_get_option(‘wpoi_form_email’);
echo ‘ ‘ .
Suzanne: I sent you an e-mail.
hmmmm…maybe my instincts were right! I switched to a different template design and that solved the problem. There seems to be a compatibility problem with Wordpress’s default theme.
I tested the email out and it works splendidly…I appreciate all your help Petter. Thanks again!
Suzanne
Petter
I have a new problem! All the opt-in email addresses coming in are google.com. Everybody who signs up with me has it. I know that’s not the case because I know one of the people who signed up.
Please help! thanks
Suzanne: I’m not sure if I understand the problem. Does all the opt’ed in e-mail addresses end with “google.com” ? You can easily test by opt’ing in yourself and checking the list with opt’ed in e-mail adresses in the admin-panel (settings -> WP Opt-in).
Petter
Turns out I misread the situation and it was a false alarm. Everything works perfectly fine. Thanks!
Hello!
I’m using the WP Opt in plugin on http://www.nakedwineshow.com and it’s been fabulous for collecting emails from our site visitors. I see in your blog post that having a Name Field is something that’s been requested. I was wondering whether it was something you’re going to be adding to the plugin? And if so, what might be the timeline on that?
Thanks!
Anastasia: Thanks for good feedback. I should have implemented the change along time ago. It’s fairly straight-forward. I don’t feel comfortable promising anything due to other projects both online and offline.
Petter
The main reason I have the optin is so I can sign up subscribers and notify them when I publish a new blog post.
I have subscribe2 (which I installed after wp-opt in). There seems to be a disconnect in getting these 2 programs to work together.
Do you happen to know how I might do that (aside from manually)? Is there another plug in besides subscribe2 that might be more compatible?
thanks!
Suzanne: To my knowledge there are no plugins which can import stuff from WP-Opt-in. In other words: manual or “make your own import-wrapper for Subscribe2″ is probably the only solutions. The import-wrapper solution will require some PHP and SQL knowledge.
Hey! It’s a great plug-in, I am wondering if it’s possible to have adwords conversion code on it to check how many registrations come from PPC?
gio: Yes, I guess it’s possible. I added this to the list of feature requests. You should not expect anything; I have no interest in this myself.
Great plugin!
Using and loving it!
I would like a captcha and verification email feature added to this plugin. This would make it perfect. Robots are going to spam the mailing list and we need to verify they are a. human and b. really at that email address. I am using WP 2.8 I dont see the options page to actually send the emails. I see the configuration page only.
Klub:
Solarblu: Thanks for the feature requests. I added them to the list.
Do you have a spam problem? How are robots going to spam the mailing list if you send e-mail with the recipients in the Bcc field? You are supposed to copy all the e-mail addresses in the “Bcc friendly format” field (on the settings page) and paste them in your favorite e-mail client (Evolution, Outlook, Gmail, etc…)
When I use the widget I have to place it at the bottom of the sidebar. If I place this widget above any other widgets, all widgets below this one lose some of their formatting. How can I fix this? Thank you so much…
Tai: Oh. This sounds familiar… I wrote something related a while ago.
Here is your code with a name field. Since I already had it set up when I made the changes, I manually added the new field to my database. Its working fine for me.
copy from bcc field and paste into file should be simple
Option to enable/disable stuff in a form:
if ( isset($post['abc'])) {
$chk = ‘ checked=”checked”‘;
} else {
$chk = ”;
}
Location for more php mail details:
http://www.sitepoint.com/print/advanced-email-php
*/
$wpoi_db_version = “0.2″;
function wpoi_show_form()
{
echo ” . “\n”;
echo ” . wpoi_get_option(‘wpoi_form_name’);
echo ‘ ‘ . “\n”;
echo ” . wpoi_get_option(‘wpoi_form_email’);
echo ‘ ‘ . “\n”;
echo ” . “\n\n\n”;
}
function wpoi_getip()
{
if (isset($_SERVER)) {
if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])) {
$ip_addr = $_SERVER["HTTP_X_FORWARDED_FOR"];
} elseif (isset($_SERVER["HTTP_CLIENT_IP"])) {
$ip_addr = $_SERVER["HTTP_CLIENT_IP"];
} else {
$ip_addr = $_SERVER["REMOTE_ADDR"];
}
} else {
if ( getenv( ‘HTTP_X_FORWARDED_FOR’ ) ) {
$ip_addr = getenv( ‘HTTP_X_FORWARDED_FOR’ );
} elseif ( getenv( ‘HTTP_CLIENT_IP’ ) ) {
$ip_addr = getenv( ‘HTTP_CLIENT_IP’ );
} else {
$ip_addr = getenv( ‘REMOTE_ADDR’ );
}
}
return $ip_addr;
}
function wpoi_opt_in()
{
global $wpdb;
$table_users = $wpdb->prefix . “wpoi_users”;
echo stripslashes(wpoi_get_option(‘wpoi_form_header’));
$_POST['wpoi_email'] = trim($_POST['wpoi_email']);
if(empty($_POST['wpoi_email'])) {
wpoi_show_form();
} else {
// Linux and Windows compatibility
if (!defined(‘PHP_EOL’)) {
if ( strtoupper(substr(PHP_OS,0,3) == ‘WIN’ ) ) {
$lf = “\r\n”;
} else {
$lf = “\n”;
}
} else {
$lf = PHP_EOL;
}
$name = stripslashes($_POST['wpoi_name']);
$email = stripslashes($_POST['wpoi_email']);
$email_from = stripslashes(wpoi_get_option(‘wpoi_email_from’));
$subject = stripslashes(wpoi_get_option(‘wpoi_email_subject’));
$message = stripslashes(wpoi_get_option(‘wpoi_email_message’));
$message = wordwrap($message, 70);
$email_notify = stripslashes(wpoi_get_option(‘wpoi_email_notify’));
$headers = “From: “.$email_from.$lf;
$headers .= “X-Mailer: WP Opt-in”.$lf;
$headers .= “MIME-Version: 1.0″.$lf;
$headers .= “Content-Type: text/plain; charset=\”" . get_settings(‘blog_charset’) . “\”" . $lf;
// $headers .= “Content-Type: text/html; charset=\”" . get_settings(‘blog_charset’) . “\”" . $lf;
$headers .= “Message-ID: “.$lf;
if (!preg_match(“/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/”, $email)) {
echo stripslashes(wpoi_get_option(‘wpoi_msg_bad’));
wpoi_show_form();
}
elseif (mail($email, $subject, $message, “To: “.$email.$lf.$headers)) {
// Delete user if already present
$delete = “DELETE FROM ” . $table_users .
” WHERE email = ‘” . $email . “‘”;
$result = $wpdb->query($delete);
// Write new user to database
$ip = wpoi_getip();
$insert = “INSERT INTO ” . $table_users .
” (time, ip, name, email) ” . “VALUES (‘” . time() .
“‘,’” . $ip . “‘,’” . $name . “‘,’” . $email . “‘)”;
$result = $wpdb->query($insert);
echo stripslashes(wpoi_get_option(‘wpoi_msg_sent’));
if ($email_notify != ”) {
mail($email_notify, “WP Opt-in notification”, “E-mail sent to new address”.$lf.”Name: “.$name.$lf.”E-mail: “.$email.$lf.”IP: $ip”.$lf, “To: “.$email_notify.$lf.$headers);
}
} else {
echo stripslashes(wpoi_get_option(‘wpoi_msg_fail’));
}
}
echo stripslashes(wpoi_get_option(‘wpoi_form_footer’)) . “\n”;
}
function wpoi_install()
{
global $wpdb;
global $wpoi_db_version;
$table_users = $wpdb->prefix . “wpoi_users”;
if(($wpdb->get_var(“show tables like ‘$table_users’”) != $table_users) ||
(wpoi_get_option(“wpoi_db_version”) != $wpoi_db_version)) {
// No configuration detaTable did not excist or ; create new
$sql = “CREATE TABLE ” . $table_users . ” (
id mediumint(9) NOT NULL AUTO_INCREMENT,
time bigint(11) DEFAULT ‘0′ NOT NULL,
ip varchar(50) NOT NULL,
name varchar(50) NOT NULL,
email varchar(50) NOT NULL,
UNIQUE KEY id (id)
);”;
require_once(ABSPATH . ‘wp-admin/includes/upgrade.php’);
dbDelta($sql);
// Insert initial data in table
$insert = “INSERT INTO $table_users (time, ip, email) ” .
“VALUES (‘” . time() . “‘,’” . wpoi_getip() .
“‘,’” . get_option(‘admin_email’) . “‘)”;
$result = $wpdb->query($insert);
wpoi_add_update_option(“wpoi_db_version”, $wpoi_db_version);
// Initialise options with default values
wpoi_add_option(‘wpoi_widget_title’);
wpoi_add_option(‘wpoi_email_from’);
wpoi_add_option(‘wpoi_email_subject’);
wpoi_add_option(‘wpoi_email_message’);
wpoi_add_option(‘wpoi_email_notify’);
wpoi_add_option(‘wpoi_msg_bad’);
wpoi_add_option(‘wpoi_msg_fail’);
wpoi_add_option(‘wpoi_msg_sent’);
wpoi_add_option(‘wpoi_form_header’);
wpoi_add_option(‘wpoi_form_footer’);
wpoi_add_option(‘wpoi_form_name’);
wpoi_add_option(‘wpoi_form_email’);
wpoi_add_option(‘wpoi_form_send’);
}
}
function wpoi_add_option($option_name)
{
// if ( !get_option($option_name) ) {
add_option($option_name, wpoi_get_option($option_name));
// }
}
function wpoi_add_update_option($option_name, $option_value)
{
/* if ( get_option($option_name) ) {
update_option($option_name, $option_value);
} else {
add_option($option_name, $option_value);
}*/
add_option($option_name, $option_value);
update_option($option_name, $option_value);
}
function wpoi_get_option($option_name)
{
$opt = get_option($option_name);
if ( $opt ) {
return $opt;
}
$blogname = get_option(‘blogname’);
if ($option_name==’wpoi_widget_title’) { return ‘WP Opt-in’; }
if ($option_name==’wpoi_email_from’) { return get_option(‘admin_email’); }
if ($option_name==’wpoi_email_subject’) { return “[$blogname] Requested e-mail”; }
if ($option_name==’wpoi_email_message’) { return “This is an automatically sent e-mail.\nYou received this because $blogname received a request.”; }
if ($option_name==’wpoi_email_notify’) { return ”; }
if ($option_name==’wpoi_msg_bad’) { return “Bad e-mail address.“; }
if ($option_name==’wpoi_msg_fail’) { return “Failed sending to e-mail address.“; }
if ($option_name==’wpoi_msg_sent’) { return “Sent requested e-mail.“; }
if ($option_name==’wpoi_form_header’) { return “Receive information automagically here.”; }
if ($option_name==’wpoi_form_footer’) { return “”; }
if ($option_name==’wpoi_form_name’) { return “Name:”; }
if ($option_name==’wpoi_form_email’) { return “E-mail:”; }
if ($option_name==’wpoi_form_send’) { return “Submit”; }
if ($option_name==’wpoi_db_version’) { return “0.0″; }
}
function wpoi_options()
{
global $wpdb;
$table_users = $wpdb->prefix . “wpoi_users”;
// Handle options from get method information
if (isset($_GET['user_id'])) {
$user_id = $_GET['user_id'];
// Delete user from database
$delete = “DELETE FROM ” . $table_users .
” WHERE id = ‘” . $user_id . “‘”;
$result = $wpdb->query($delete);
// Notify admin of delete
echo ‘‘;
_e(‘User deleted.’, ‘wpoi_domain’);
echo ‘‘;
}
// Get current options from database
$email_from = stripslashes(wpoi_get_option(‘wpoi_email_from’));
$email_subject = stripslashes(wpoi_get_option(‘wpoi_email_subject’));
$email_message = stripslashes(wpoi_get_option(‘wpoi_email_message’));
$email_notify = stripslashes(wpoi_get_option(‘wpoi_email_notify’));
$msg_bad = stripslashes(wpoi_get_option(‘wpoi_msg_bad’));
$msg_fail = stripslashes(wpoi_get_option(‘wpoi_msg_fail’));
$msg_sent = stripslashes(wpoi_get_option(‘wpoi_msg_sent’));
$form_header = stripslashes(wpoi_get_option(‘wpoi_form_header’));
$form_footer = stripslashes(wpoi_get_option(‘wpoi_form_footer’));
$form_name = stripslashes(wpoi_get_option(‘wpoi_form_name’));
$form_email = stripslashes(wpoi_get_option(‘wpoi_form_email’));
$form_send = stripslashes(wpoi_get_option(‘wpoi_form_send’));
// Update options if user posted new information
if( $_POST['wpoi_hidden'] == ‘SAb13c’ ) {
// Read from form
$email_from = stripslashes($_POST['wpoi_email_from']);
$email_subject = stripslashes($_POST['wpoi_email_subject']);
$email_message = stripslashes($_POST['wpoi_email_message']);
$email_notify = stripslashes($_POST['wpoi_email_notify']);
$msg_bad = stripslashes($_POST['wpoi_msg_bad']);
$msg_fail = stripslashes($_POST['wpoi_msg_fail']);
$msg_sent = stripslashes($_POST['wpoi_msg_sent']);
$form_header = stripslashes($_POST['wpoi_form_header']);
$form_footer = stripslashes($_POST['wpoi_form_footer']);
$form_name = stripslashes($_POST['wpoi_form_name']);
$form_email = stripslashes($_POST['wpoi_form_email']);
$form_send = stripslashes($_POST['wpoi_form_send']);
// Save to database
wpoi_add_update_option(‘wpoi_email_from’, $email_from );
wpoi_add_update_option(‘wpoi_email_subject’, $email_subject);
wpoi_add_update_option(‘wpoi_email_message’, $email_message);
wpoi_add_update_option(‘wpoi_email_notify’, $email_notify );
wpoi_add_update_option(‘wpoi_msg_bad’, $msg_bad);
wpoi_add_update_option(‘wpoi_msg_fail’, $msg_fail);
wpoi_add_update_option(‘wpoi_msg_sent’, $msg_sent);
wpoi_add_update_option(‘wpoi_form_header’, $form_header);
wpoi_add_update_option(‘wpoi_form_footer’, $form_footer);
wpoi_add_update_option(‘wpoi_form_email’, $form_email);
wpoi_add_update_option(‘wpoi_form_name’, $form_name);
wpoi_add_update_option(‘wpoi_form_send’, $form_send);
// Notify admin of change
echo ‘‘;
_e(‘Options saved.’, ‘wpoi_domain’);
echo ‘‘;
}
?>
WP Opt-in Options
E-mail to send users on opt-in
From:
<input type="text" name="wpoi_email_from" id="wpoi_email_from" value="” size=”40″>Only user@domain.tld format is allowed.
Subject:
<input type="text" name="wpoi_email_subject" id="wpoi_email_subject" value="” size=”40″>
Message:
Notify:
<input type="text" name="wpoi_email_notify" id="wpoi_email_notify" value="” size=”40″>Also notify to this email when someone opt-in. Leave blank for no notification.
Front side messages on opt-in
Bad e-mail:
<input type="text" name="wpoi_msg_bad" id="wpoi_msg_bad" value="” size=”40″>
Failed to send:
<input type="text" name="wpoi_msg_fail" id="wpoi_msg_fail" value="” size=”40″>
Success:
<input type="text" name="wpoi_msg_sent" id="wpoi_msg_sent" value="” size=”40″>
Front side form appearance
Form header:
Form footer:
Name field:
<input type="text" name="wpoi_form_name" id="wpoi_form_name" value="” size=”40″>
E-mail field:
<input type="text" name="wpoi_form_email" id="wpoi_form_email" value="” size=”40″>
Submit button:
<input type="text" name="wpoi_form_send" id="wpoi_form_send" value="” size=”40″>
Opted-in users
Bcc friendly format
get_results(“SELECT * FROM $table_users ORDER BY id DESC”);
$additional_user=0;
foreach ($users as $user) {
if ($additional_user) {
echo ‘, ‘;
}
$additional_user=1;
echo $user->email;
}
?>
All details
ID
Date
Time
IP
Name
E-mail
Action
<?php
$user_no=0;
$url = 'options-general.php?page=' . __FILE__ . '&user_id=';
foreach ($users as $user) {
if ($user_no&1) {
echo "”;
} else {
echo “”;
}
$user_no=$user_no+1;
echo “$user->id”;
echo “” . date(get_option(‘date_format’), $user->time) . “”;
echo “” . date(get_option(‘time_format’), $user->time) . “”;
echo “$user->ip”;
echo “$user->name”;
echo “$user->email”;
echo “id\” onclick=’if(confirm(\”Are you sure you want to delete user with ID $user->id?\”)) return; else return false;’>Delete“;
echo “”;
}
?>
<?php
}
function wpoi_widget_init() {
global $wp_version;
if (!function_exists('register_sidebar_widget')) {
return;
}
function wpoi_widget($args) {
extract($args);
echo $before_widget . $before_title;
echo wpoi_get_option('wpoi_widget_title');
echo $after_title;
wpoi_opt_in();
echo $after_widget;
}
function wpoi_widget_control() {
$title = wpoi_get_option('wpoi_widget_title');
if ($_POST['wpoi_submit']) {
$title = stripslashes($_POST['wpoi_widget_title']);
wpoi_add_update_option('wpoi_widget_title', $title );
}
echo 'Title:’;
echo ”;
}
$width = 300;
$height = 100;
if ( (‘2.2′ == $wp_version) || (!function_exists( ‘wp_register_sidebar_widget’ ))) {
register_sidebar_widget(‘WP Opt-in’, ‘wpoi_widget’);
register_widget_control(‘WP Opt-in’, ‘wpoi_widget_control’, $width, $height);
} else {
// v2.2.1+
$size = array(‘width’ => $width, ‘height’ => $height);
$class = array( ‘classname’ => ‘wpoi_opt_in’ ); // css classname
wp_register_sidebar_widget(‘wpoi’, ‘WP Opt-in’, ‘wpoi_widget’, $class);
wp_register_widget_control(‘wpoi’, ‘WP Opt-in’, ‘wpoi_widget_control’, $size);
}
}
function wpoi_add_to_menu() {
add_options_page(‘WP Opt-in Options’, ‘WP Opt-in’, 7, __FILE__, ‘wpoi_options’ );
}
register_activation_hook(__FILE__, ‘wpoi_install’);
add_action(‘admin_menu’, ‘wpoi_add_to_menu’);
add_action(‘plugins_loaded’, ‘wpoi_widget_init’);
?>
Hi, great plugin, it does everything that Ineed it to.
But for some reason once activated and added to my widget footer it distorts my css of the footer. The white box should cover all three ‘Keep in touch with us:’ ‘Phone & Email’ and ‘Newsletter’
http://myfashionnotebook.co.uk/
Have you got any idea why it would do this and how I could fix it?
Thanks
the plugin is great, but when i put it in my sidebar is messes up the appearance of the other widgets. take a look, http://www.sportsmumbojumbo.com, it’s the “sign up for our newsletter” widget, see how all the widgets below it are all over the place? (“advertising space” “like our articles” etc…should all be in the nice green bars like all the stuff on the left sidebar)
please help!
I found the plugin (rev 1.3) sticks an excess at the end of the code. Even blanking out the form footer didn’t help. But inserting as form footer fixed the problem for me.
I also was receiving 2 copies of each email – I resolved that by dropping the “To: “.$email.$lf.” from the headers passed to the mail() function.
My previous post should read “excess ” (with spaces removed)
Yikes – I’m trying to say an excess div closing tag!
And insert a blank as the form footer
Roz: I hope someone finds your comment useful. Unfortunately I will not implement your suggestion in the plugin for now.
Adam and Rina: The new version 1.3.1 might help. Or possibly the default values.
Bev: Thanks for helpful input. I updated to a new version. I guess a </div> tag could be inserted in the form footer field in settings? The default values should do this.
Roz
What will be the code if i will add another field called Phone Number and then once i click the submit button it will redirect to another page.
Thank you.
Cool plugin, thanks
is there a shortcode u can enter to have the form appear on a post or page?
Marketing Meerkat:
Jerome: Nope. But you might manage by using something else.
NICE ONE!
only some css classes or id’s to style the form would be nice
Jonas: Thanks for feedback and great tip. I added it to the list.
First of all – Great Plugin!
Just wondering is it can be used only on one page and not all the pages?
Thanks
Thanks for the feedback.
Yes, you can insert the plugin exactly where you want it. If you want the plugin visible in the sidebar on specific pages/posts, you need to use e.g. the Samsarin PHP widget and enter some PHP code in it.
my theme doesnt support the opt in plugin.
where do i need to submit that php line in the sidebar map?
Under which line. i tried to copy it in the folder but dont know the excate place.
thanks!
Tony: Sorry for the late reply. It seems you figured it out yourself
I guess your theme does not support Widgets.
Petter – I have been trying to install WP opt-in, and am having problems. Your directions tell me to download and un-zip the plugin, but when I go to upload, I am told to upload in zip format! Whenever I try, either zip or unzip, nothing happens! I have a file – wp-opt-in.php – which does not upload. When I try wp-opt-in.zip, I get “file not found”. What should I do??
Joan
Oh. I think the auto/manual install stuff can be confusing. Does the managing plugins documentation help?
Hi there!
Just want to let You know that I’m using it and its great!
I’ve used this plugin before, and now wish I could. The features that really would make it first call, would be the ability to separate name fields(first, last) and the option to add some additional fields for other basic info: street, city, state, country, postal code. If these could be added optionally, you would have the ability to use this plug in for many more types of things. Event registration, Special offers, etc.,
Marcin: Thanks for nice feedback.
Larry: Oh. That’s a really great idea. I really hope I’ll find time to expanding the plugin as suggested. It’s now on the feature request list.
bug with IE6 ,IE7 : Inactivate
zip: What? Would you care to elaborate?
Hi there,
Love the plugin but it breaks my theme.
The plugin is added as a widget. It is in de left sidebar.
Beneath it I added an other text widget but this one is displayed on the left, where the content should be.
The content is pushed down.
Any idea what the problem is?
I would appreciate it very much!
Here the link to the site:
http://www.tvzeist.nl/wp/
Cheers Heyman
The plugin is making 1 closing div ( ) too much.
If I add the plugin by hand and don’t close the div I put it in all goes well.
How can I fix this properly?
Cheers Heyman
Heyman: I guess the default options will help.
Thanks Petter,
My form header looked like this:
Form header: Receive information automagically here.
I removed a div and it works fine!
Strange cause I don’t remember edting it. Guess I have to have some more sleep!
Thanks again for a great plugin!
Cheers Heyman
Heyman: Thanks for the “all ok now” feedback. Great you fixed it
Great plugin. I’ve been using it at Vagobond.com for a while now with no issues, but when I put it a Moroccoblogs.com, it adds in the dots before each new widget…any simple fix for this?
Thanks.
Vago
Vago: Does it help by trying the default options or another theme on Moroccoblogs?