PriMoThemes — now s2Member® (official notice)

This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™

Custom thank you email per product?

s2Member Plugin. A Membership plugin for WordPress®.

Custom thank you email per product?

Postby cassel » July 2nd, 2011, 2:29 pm

Again, i am trying to meet a deadline and i just cannot find my things around, so if someone can simply redirect me it would be appreciated.

Can i set a custom thank you email to a customer depending on the product they purchased? The reason i am looking in that direction is that i will have some bonus associated with the successfull transaction and i figured it would be a great place to incorporate the specific URL where they could download the particular bonus, or get the coupon for another bonus.

Since those bonus would ONLY be valid for that one specific product purchase, and not for a different one, i cannot use a single standard thank you email for everyone.

Is that too picky or is that something already achievable with s2Member? (I have s2Member pro but not using the pro-form for now)
User avatar
cassel
Experienced User
Experienced User
 
Posts: 442
Joined: February 17, 2011

Re: Custom thank you per product?

Postby cassel » July 2nd, 2011, 3:21 pm

Do you think that using a single landing page after Paypal transaction could be used with conditionals so that the user only has access to the bonus associated with his current package purchase level?
User avatar
cassel
Experienced User
Experienced User
 
Posts: 442
Joined: February 17, 2011

Re: Custom thank you email per product?

Postby Cristián Lávaque » July 3rd, 2011, 2:19 am

Try the success attribute, available with s2Member Pro. WP Admin -> s2Member -> PayPal Buttons -> Shortcode Attributes (Explained) -> success ;)
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Custom thank you email per product?

Postby cassel » July 3rd, 2011, 7:18 am

Thanks for the info. However, is there a way to modify the thank you EMAIL after successfull transaction?
User avatar
cassel
Experienced User
Experienced User
 
Posts: 442
Joined: February 17, 2011

Re: Custom thank you email per product?

Postby Cristián Lávaque » July 3rd, 2011, 7:43 pm

You can use the replacement codes available for that. WP Admin -> s2Member -> PayPal Options -> Signup Confirmation Email
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Custom thank you email per product?

Postby cassel » July 3rd, 2011, 7:58 pm

Hum.. yeah, but it would not have "conditionals" like "if the member purchased package A, i will include link b for a bonus" and "if the member purchased package X, i will include links for Z, W, and Y as bonus"

But i figured out to use a generic thank you, using the replacement code to mention what package the member just bought, and send them all to a single thank you page, where i am using ALL the conditionals so that if the member bought A, THERE is the link for bonus b and if the member bought something else, there are the other links. I find it does what i needed in the end.

Thanks anyways. Your answer might help others too!
User avatar
cassel
Experienced User
Experienced User
 
Posts: 442
Joined: February 17, 2011

Re: Custom thank you email per product?

Postby Cristián Lávaque » July 3rd, 2011, 8:25 pm

That is great. :)

You can probably even use the replacement codes in the link to the thank-you page, so you pick it up there and know what to thank him for, too.
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Custom thank you email per product?

Postby cassel » July 3rd, 2011, 8:35 pm

I could, but since i have a totally different paragraph for each, i include the title within the conditionals. Simple!

Once you get a hang of those conditionals, they are fun!
User avatar
cassel
Experienced User
Experienced User
 
Posts: 442
Joined: February 17, 2011

Re: Custom thank you email per product?

Postby Cristián Lávaque » July 3rd, 2011, 8:45 pm

:)
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Custom thank you email per product?

Postby cassel » August 27th, 2011, 9:54 am

As i am developping my second product (the first one was "basic", the second is "element) i want to have a different page to direct them. I COULD use a single page and use conditionals on it so if they just bought "basic" they will see the bonus for that product, and if they bought "element" they will see the bonus for that product. However, using the conditionals might not tell what product they JUST bought.

For example, if the person is now buying "element" and already had purchased "basic", then using conditionals, that person will see the bonus for both as it will have access to ccaps_basic and ccaps_element. And since the bonus will change over time if the person purchased "basic" 3 months ago, i dont want him/her to access the bonus set for one purchasing today.

All that to say, since conditionals do not work on the thank you email (too bad), is there a way to use the replacement code and concatenate it with a base URL so i could include something like:
http://my_base_url/bonus/ + "Replacement code"

Or is that how the "success" attribute works?
User avatar
cassel
Experienced User
Experienced User
 
Posts: 442
Joined: February 17, 2011

Re: Custom thank you email per product?

Postby cassel » August 27th, 2011, 11:45 am

Trying to read more on the success attributes and i am not sure if it works or not. I read about the cv1 and cv2 and such. It says:
This example uses cv1 to record a special marketing campaign:
( The campaign ( i.e. christmas-promo ) could be referenced using %%cv1%% )
custom="scrapbookcampus.com|christmas-promo"


Questions:
- where is the cv1 and cv2 and such set?
- in the custom attribute given in the example: scrapbookcampus.com|christmas-promo, how does that translate into a URL (i dont think the "|" character is part of a URL).

If it does work, it would mean i can call the cv1 to be the name of the package ("basic" or "element" or whatever) and then create as many thank you pages with something LIKE:

http://scrapbookcampus.com/basic and http://scrapbookcampus.com/element
or maybe something like
http://scrapbookcampus.com/success/basic and http://scrapbookcampus.com/success/element

Is that how it works?
User avatar
cassel
Experienced User
Experienced User
 
Posts: 442
Joined: February 17, 2011

Re: Custom thank you email per product?

Postby Cristián Lávaque » August 27th, 2011, 10:42 pm

Correct, you got it. In the example, christmas-promo is cv1 (first custom value after the domain), the pipe is the separator.

So you can have custom="scrapbookcampus.com|element" and then the replacement code %%cv1%% for the email will have the value element, which you can use in the URL like this: http://scrapbookcampus.com/success/%%cv1%%

I hope that helps. :)
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Custom thank you email per product?

Postby cassel » August 27th, 2011, 10:46 pm

And the cv1 can be set where? in the Paypal button itself?
User avatar
cassel
Experienced User
Experienced User
 
Posts: 442
Joined: February 17, 2011

Re: Custom thank you email per product?

Postby Cristián Lávaque » August 28th, 2011, 1:51 am

Yes, in the button's shortcode with the custom attribute as I show you in my previous post. WP Admin -> s2Member -> PayPal Buttons -> Shortcode Attributes -> custom
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Custom thank you email per product?

Postby cassel » August 28th, 2011, 8:58 am

Going to try this today as it might just solve my problem and might help others!
User avatar
cassel
Experienced User
Experienced User
 
Posts: 442
Joined: February 17, 2011

Re: Custom thank you email per product?

Postby cassel » August 28th, 2011, 11:08 am

I think i got it (and if it works, it would be great!) but i would like you to confirm that i understand correctly (and applied it correctly too!).

Here are two (fake) paypal buttons for two products:
Product A:
Code: Select all
[s2Member-PayPal-Button level="1" ccaps="basic,forum" desc="Basic Scrap Course with PSP" ps="ScrapbookCampus" lc="" cc="USD" dg="0" ns="1" custom="my_domain|success-basic" ta="0" tp="0" tt="D" ra="1" rp="6" rt="M" rr="BN" rrt="" cv1="success-basic" rra="1" success="http://my_domain|cv1" image="http://my_domain/Images/buy-now-yellow.png" output="button" /]

Product B
Code: Select all
[s2Member-PayPal-Button level="1" ccaps="element,forum" desc="Element Creation with PSP" ps="ScrapbookCampus" lc="" cc="USD" dg="0" ns="1" custom="my_domain|success-element" ta="0" tp="0" tt="D" ra="1" rp="6" rt="M" rr="BN" rrt="" cv1="success-element" rra="1" success="http://my_domain|cv1" image="http://my_domain/Images/buy-now-yellow.png" output="button" /]


This means that my cv1 is either "success-basic" or "success-element".

Then, in my confirmation email, i will have this paragraph:
Once your registation is completed, you can login and access your bonuses here:
http://my_domain/%%cv1%%


and then, the bonus pages will be:
http://my_domain/success-basic and http://my-domain/success-element

Did i get that correctly?
User avatar
cassel
Experienced User
Experienced User
 
Posts: 442
Joined: February 17, 2011

Re: Custom thank you email per product?

Postby cassel » August 28th, 2011, 11:36 am

As i am testing this, i am getting an unexpected result. I tried going through a purchase using the button generated above and once the transaction was completed, i didn't get the confirmation email that i set up. Instead, i got this one:

Thank you! You've been updated to:
Element Creation with PSP

Please log back in now.
http://my_domain/wp-login.php


And even the subject line of that email reads:
Thank you! Your account has been updated
instead of
Congratulations! You officially registered for the %%item_name%%

This is far from what i am working on now. Where is this "confirmation email" come from and why didn't i get the one i just set up? Did i forget something along the way?
User avatar
cassel
Experienced User
Experienced User
 
Posts: 442
Joined: February 17, 2011

Re: Custom thank you email per product?

Postby Cristián Lávaque » August 29th, 2011, 1:16 pm

cassel wrote:I think i got it (and if it works, it would be great!) but i would like you to confirm that i understand correctly (and applied it correctly too!).


Yes, it looks fine to me. :)

cassel wrote:This is far from what i am working on now. Where is this "confirmation email" come from and why didn't i get the one i just set up?


Indeed, it's as if you had configured a different confirmation email, or if s2Member sends a different email when it's an account upgrade instead of a new account.

What confirmation email panel are you editing? Could you copy the title and paste it here?
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Custom thank you email per product?

Postby cassel » August 29th, 2011, 1:34 pm

What confirmation email panel are you editing? Could you copy the title and paste it here?

I am not 100% sure what you are asking but here is what i THINK you are asking:
Under Paypal Option > Signup Confirmation Email ( Standard ) i have an email confirmation set like this:
Congratulations! You officially registered for the %%item_name%%


and under Signup Confirmation Email ( Pro Form ) (which i am NOT using, but just in case) i have an email confirmation like this (which i didn't edit):
Congratulations! ( your membership has been approved )


Still no idea where it comes from. I am using a test button with a transaction of $1 if you want to test it.
User avatar
cassel
Experienced User
Experienced User
 
Posts: 442
Joined: February 17, 2011

Re: Custom thank you email per product?

Postby Cristián Lávaque » August 29th, 2011, 4:13 pm

Got it. I'm emailing Jason about this.
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Custom thank you email per product?

Postby Jason Caldwell » August 30th, 2011, 2:52 pm

Thanks for the heads up on this thread.

The seemingly mysterious email I think you're referring to, is a basic transactional email that s2Member sends out whenever an "existing" User/Member is being upgraded or downgraded, as opposed to signing up for a "new" account. I refer to this as a "modification" transactional email, and at this time ( i.e. s2Member v110815 ), it can only be customized with Hooks/Filters.

Create this directory and file:
/wp-content/mu-plugins/s2-hacks.php
Code: Select all
<?php
add_filter 
("ws_plugin__s2member_modification_email_sbj", "my_s2_modification_sbj", 10, 2);
function my_s2_modification_sbj ($s2member_default_sbj, $vars = array ())
    {
        return "Thank you! Your account has been updated.";
    }
add_filter ("ws_plugin__s2member_modification_email_msg", "my_s2_modification_msg", 10, 2);
function my_s2_modification_msg ($s2member_default_msg, $vars = array ())
    {
        return "Thank you! You've been updated to:\n" . $vars["paypal"]["item_name"] . "\n\nPlease log back in now:\n" . wp_login_url ();
    }
?>
If you need to perform conditionals before spitting out the contents of these emails, you may find it helpful to examine all of the information passed through to your Filter function inside the $vars array. There is MUCH information stored inside that array, including: $vars["user"], $vars["user_id"] and $vars["paypal"] ( which is an array of PayPal details related to the modification ).

Here are some other Filters that you may find useful in cases where you need more control over the content of emails ( i.e. when you need to use conditionals, or insert other information dynamically ). For instance, these two Filters allow for greater control over the Signup Confirmation Email:
Code: Select all
ws_plugin__s2member_signup_email_sbj
ws_plugin__s2member_signup_email_msg

These control the Confirmation email for Specific Post/Page Access:
Code: Select all
ws_plugin__s2member_sp_email_sbj
ws_plugin__s2member_sp_email_msg

In all cases, you can use the code sample I provided above, and just change the Filter names and the way you fill the content of the data being filtered. For example, this is how you might dynamically modify the content of the Signup Confirmation Email via PHP scripting.

Create this file and directory:
/wp-content/mu-plugins/s2-hacks.php
Code: Select all
<?php
add_filter 
("ws_plugin__s2member_signup_email_sbj", "my_s2_signup_sbj", 10, 2);
function my_s2_signup_sbj ($s2member_default_sbj, $vars = array ())
    {
        return "Congratulations ( your account has been approved )";
    }
add_filter ("ws_plugin__s2member_signup_email_msg", "my_s2_signup_msg", 10, 2);
function my_s2_signup_msg ($s2member_default_msg, $vars = array ())
    {
        return "Thank you! You purchased:\n" . $vars["paypal"]["item_name"] . "\n\nPlease register now:\n" . add_query_arg("action", "register", wp_login_url ());
    }
?>
( Please note that $vars["user"], $vars["user_id"] are NOT available for the Signup Confirmation Email like they are for modifications, because the Customer has not yet registered. That's what the Signup Confirmation email is actually for ( i.e. to help them get registered ).
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: Custom thank you email per product?

Postby cassel » August 30th, 2011, 3:31 pm

OOOOOOOOOh thanks. Do you mean that this "mysterious email" is ONLY because it is an already registered member and otherwise, if it was a NEW member, the coding i did was supposed to work?

I might need a few days to digest all that information. Maybe you can help point me to the right direction in:
- where is the information passed through to your Filter function inside the $vars array?
- the other filters you mention, are they files? if not where are they?
- the two file content you posted have the same name, going in the same directory, how come?

With some work and studying, i might make sense of that!
User avatar
cassel
Experienced User
Experienced User
 
Posts: 442
Joined: February 17, 2011

Re: Custom thank you email per product?

Postby Jason Caldwell » August 30th, 2011, 5:58 pm

Thanks for the follow-up.
- where is the information passed through to your Filter function inside the $vars array?

The array of $vars, is passed by the call that s2Member makes to your Filter function. The array of $vars may contain different information for each Filter that s2Member has. For a more detailed explanation, this article may help to clarify how s2Member passes defined variables from it's processing routine to your own custom routine inside a Hook and/or a Filter function. See: viewforum.php?f=40#src_doc_overview_description
- the other filters you mention, are they files? if not where are they?

No, they are just the "names" of Filters made available by s2Member. See this article as a primer on Hooks/Filters for WordPress/s2Member: viewforum.php?f=40#src_doc_overview_description If you'd like to see s2Member's Hooks/Filters in the context in which they are fired, you can simply search s2Member's source code for a given Hook and/or Filter name. For instance, search s2Member's source code for: ws_plugin__s2member_modification_email_sbj
- the two file content you posted have the same name, going in the same directory, how come?
They could have different names, or you could combine all of your Hooks/Filters into a single file if you prefer. I just use s2-hacks.php as an example to go by. All that's important is that your PHP file(s) are inside this special directory for WordPress: /wp-content/mu-plugins/ These are (M)UST (U)SE plugins, which are loaded automatically, that's what you want.
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: Custom thank you email per product?

Postby cassel » August 30th, 2011, 6:05 pm

Thanks for your patience. I will go check those references and probably be back with more questions! (ask Cristian, i can be dense at times! ;) )
User avatar
cassel
Experienced User
Experienced User
 
Posts: 442
Joined: February 17, 2011

Re: Custom thank you email per product?

Postby cassel » August 30th, 2011, 6:33 pm

Trying to study this but just a quick quick question: what is sbj and msg for? are they actual important code parts or just random name to be customized?
User avatar
cassel
Experienced User
Experienced User
 
Posts: 442
Joined: February 17, 2011

Next

Return to s2Member Plugin

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron