latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Unique confirmation mails for each level

Home Forums Community Forum Unique confirmation mails for each level

This topic contains 5 replies, has 2 voices. Last updated by  Mike (Volunteer Moderator) 3 years, 4 months ago.

Topic Author Topic
Posted: Wednesday Aug 21st, 2013 at 4:09 pm #56373

I’ve read up on this: http://www.s2member.com/forums/topic/different-new-user-email-based-on-member-leve/
But I’m not programmer so my question is, where in the following bit of code that Raam wrote do I put the special text that I want to type into each email?

add_action ("ws_plugin__s2member_during_configure_user_registration", "my_email_function");
function my_email_function ($vars = array ())
{
	$email = $vars["email"];
	$first_name = $vars["fname"];
	$last_name = $vars["lname"];
	$full_name = $vars["name"];
	$username = $vars["login"];
	$password = $vars["pass"];
	$level = $vars["level"];

	$from = "admin@example.com";
	$subject = "Your username and password";

	if($level == "0") {
		$message = "Username: " . $username . "nPassword: " . $password . "nName: " . $full_name. "nEmail: " . $email;
	}
	elseif($level == "1") {
		$message = "Username: " . $username . "nPassword: " . $password . "nName: " . $full_name. "nEmail: " . $email;	
	}
	elseif($level == "2") {
		$message = "Username: " . $username . "nPassword: " . $password . "nName: " . $full_name. "nEmail: " . $email;	
	}	
	else { // default message if none of the above levels match
		$message = "Username: " . $username . "nPassword: " . $password . "nName: " . $full_name. "nEmail: " . $email;		
	}


   mail ($email, $subject, $message, "From: $fromrnContent-Type: text/plain; charset=utf-8", "-f $from");
}
  • This topic was modified 3 years, 4 months ago by  Mike (Volunteer Moderator). Reason: Adding code tags
  • This topic was modified 3 years, 4 months ago by  Joe Littenberg.

List Of Topic Replies

Viewing 5 replies - 1 through 5 (of 5 total)
Author Replies
Author Replies
Posted: Wednesday Aug 21st, 2013 at 8:32 pm #56385
Moderator
@bcnmes
This is actually a bit easier in the latest release of s2Member®.

You can just use PHP code in the Dashboard when you configure your email messages.

See: Dashboard -› s2Member® -› PayPal® Options -› Signup Confirmation Email(s)


EXAMPLE
<?php if($paypal&#91;'level'&#93; === '1'): ?>
	Email for Membership Level 1
<?php endif; ?>

<?php if($paypal&#91;'level'&#93; === '2'): ?>
	Email for Membership Level 2
<?php endif; ?>
Posted: Thursday Aug 22nd, 2013 at 4:16 am #56416

Sounds good. When you say dashboard you mean I can drop that php directly into the message box?

Thanks,
J

Posted: Thursday Aug 22nd, 2013 at 9:19 am #56439
Moderator
@bcnmes

Sounds good. When you say dashboard you mean I can drop that php directly into the message box?

Exactly. Right into the textarea field for the message body.

Posted: Thursday Aug 22nd, 2013 at 9:46 am #56443

Hi Mike,

Thanks for your response. I pasted in this:

//

<?php if($paypal['level'] === '1'): ?>
You're gonna know this is email 1 designed for level 1, %%first_name%%, because that's how this muthafucka designed it. You can create your user and password here: %%registration_url%%
<?php endif; ?>

<?php if($paypal['level'] === '2'): ?>
Hola %%first_name%%!  

Gracias por suscribirte a BCN MES. Ahora tienes acceso a totalmente tot. Have fun in there y no dudes de contactarnos con ideas para artículos, eventos, etc. 

Si tens preguntes, ja tu saps. Aquí estem. 

Big barna love,
BCN MES
<?php endif; ?>

Hola %%first_name%%!  

Gracias por suscribirte a BCN MES. Ahora tienes acceso a totalmente tot. Have fun in there y no dudes de contactarnos con ideas para artículos, eventos, etc. 

Si tens preguntes, ja tu saps. Aquí estem. 

Big barna love,
BCN MES

//

And my test subscriber got this:

//

You’re gonna know this is email 1 designed for level 1, Sarah, because that’s how this muthafucka designed it. You can create your user and password here: http://tinyurl.com/kncam5c#playground.cityatlas.es

Hola Sarah!

Gracias por suscribirte a BCN MES. Ahora tienes acceso a totalmente tot. Have fun in there y no dudes de contactarnos con ideas para artículos, eventos, etc.

Si tens preguntes, ja tu saps. Aquí estem.

Big barna love,
BCN MES

//

What am I doing wrong? Also, I think I might be going a bit crazy, because when I send a subscriber straight to paypal he/she doesn’t come back with a user account and/or membership level automatically. Right? Subscribers need to sign up again in our site, right? Or am I missing something large. I think I’m missing something…

Thanks,
Joe

Posted: Thursday Aug 22nd, 2013 at 11:39 am #56451
Moderator
@bcnmes

What am I doing wrong? Also, I think I might be going a bit crazy, because when I send a subscriber straight to paypal he/she doesn’t come back with a user account and/or membership level automatically. Right? Subscribers need to sign up again in our site, right? Or am I missing something large. I think I’m missing something…

That’s right, however s2Member® knows what they purchased access to, so you can use conditionals in your email message body as you’ve done here. However, you should have just this for the desired result please.

<?php if($paypal['level'] === '1'): ?>
You're gonna know this is email 1 designed for level 1, %%first_name%%, because that's how this muthafucka designed it. You can create your user and password here: %%registration_url%%
<?php endif; ?>

<?php if($paypal['level'] === '2'): ?>
Hola %%first_name%%!  

Gracias por suscribirte a BCN MES. Ahora tienes acceso a totalmente tot. Have fun in there y no dudes de contactarnos con ideas para artículos, eventos, etc. 

Si tens preguntes, ja tu saps. Aquí estem. 

Big barna love,
BCN MES
<?php endif; ?>
Viewing 5 replies - 1 through 5 (of 5 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.