How to get newsletter features implemented.
OK, I searched through the forums here about implementing newsletter support in Classipress and coudnt find anything specific. So I thought I would give it a go myself.
I used a plugin called Newsletter signup -
http://wordpress.org/extend/plugins/newsletter-sign-up/
It's a great plugin that is used to simplify the registration of your site's users to a given newsletter service.
If enabled in the preferences, you can ask it to put a checkbox in the comments and in the registration form. It works fine in the comments, but not in the registration form, as ClassiPress uses it's own. Here's what I've done so it does work with Classipress's registration form.
1- In the plugin files, you need to modify some field names, as ClassiPress does not use the same ones as wordpress. So, in newsletter-sign-up/frontend/NewsletterSignUp.php change the beginning of the grab_email_from_wp_signup() function to fool like this:
PHP Code:
function grab_email_from_wp_signup()
{
if($_POST['newsletter-signup-do'] != 1) return;
if(isset($_POST['your_email'])) {
// gather emailadress from user who WordPress registered
$email = $_POST['your_email'];
$naam = $_POST['your_username'];
} elseif(isset($_POST[...
2 - we also need to help Classipress grab functions from the plugin
So, in newsletter-sign-up/newsletter-sign-up.php
add:
PHP Code:
function nsu_grabinfo() {
$NewsletterSignUp = NewsletterSignUp::getInstance();
$NewsletterSignUp->grab_email_from_wp_signup();
}
Now we need to change classipress's registration functions so that they are aware of the plugin.
3 - In includes/forms/register/register-form.php, before the first <?php endif ?> add:
Code:
<div align="right"
<?php if(function_exists('nsu_checkbox')) nsu_checkbox(); ?>
</div>
leaving the first div open is done on purpose.
4 - In includes/forms/register/register-process.php, after
PHP Code:
//set the first login date/time
appthemes_first_login ( $super_id );
add:
PHP Code:
if(function_exists('nsu_grabinfo')) nsu_grabinfo();
Voila!
Hope that is helpful to some of you out there.