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™

List of shortcodes in the Pro html templates?

s2Member Plugin. A Membership plugin for WordPress®.

List of shortcodes in the Pro html templates?

Postby blewis » July 19th, 2011, 4:56 pm

I am trying to tweak my PayPal Pro template (paypal-checkout-form.html), which uses double-percent shortcodes. I wish to show the price of the level at the top of the page, but NOT include the price in the description.

Currently toward the top of the page there is "%%description%%", which shows the value of the "desc" variable passed into it. I want to change this to something like "%%description%% - %%price%%" but I don't know what code to use or if there is even one available. It should be the contents of the "ra" field passed in, but "%%ra%%" is not a valid variable.

Is this possible?

Thanks,
Bryan
User avatar
blewis
Registered User
Registered User
 
Posts: 19
Joined: June 25, 2011

Re: List of shortcodes in the Pro html templates?

Postby Cristián Lávaque » July 20th, 2011, 10:57 am

Hi Bryan.

Well, you could try replacing that string with JavaScript. Or find where s2Member replaces that code with the string and then you edit it there using a hook.

But you can edit the description in the shortcode, have you tried that?
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: List of shortcodes in the Pro html templates?

Postby blewis » July 20th, 2011, 11:22 am

I have tried searching through the code to locate where those %% strings are replaced with real values and have been unable to find it. Do you know where that happens?

I don't want the price in the description, mostly because we will be having a lot of various discount options. Because the description is used in things like the welcome email to tell them what level they have, I don't want the price in there because they may have used a discount code to reduce the base price. It would be confusing to have the description be "My Plan - $29.95 / Month" when there is a good chance they will not actually be paying that amount.

thanks,
Bryan
User avatar
blewis
Registered User
Registered User
 
Posts: 19
Joined: June 25, 2011

Re: List of shortcodes in the Pro html templates?

Postby Cristián Lávaque » July 20th, 2011, 10:03 pm

I understand why you wouldn't want it in the description. No, I don't know where in the code the replacement codes are parsed, I emailed Jason but he hasn't gotten to it yet.

I was suggesting above that you edit the description attribute in the shortcode, just remove the price there: description="My Plan".
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: List of shortcodes in the Pro html templates?

Postby blewis » July 20th, 2011, 10:54 pm

Yes, I have edited the description on the shortcode for the paypal checkout page to remove the price, but I still want to show the price somewhere on the page -- so being able to display the "ra" variable would be great. I tried doing some searches through the code (both regular and pro code) and could not find where the replacements occur.
User avatar
blewis
Registered User
Registered User
 
Posts: 19
Joined: June 25, 2011

Re: List of shortcodes in the Pro html templates?

Postby Cristián Lávaque » July 21st, 2011, 12:43 am

Ah, I see. I'll ask Jason about that.
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: List of shortcodes in the Pro html templates?

Postby Jason Caldwell » July 22nd, 2011, 6:44 pm

I'm investigating this now.

Just a quick FYI though. s2Member will notate discounts in the %%description%% value when/if discounts are applied through Coupon Codes. In other words, if your discounts are applied with Coupon Codes configured with s2Member, the %%description%% value would always indicate that a discount was applied, along with other notes about the Coupon used and the original price before the discount. Your original description is followed by this information, which is added dynamically by s2Member whenever a Coupon is used.
~ 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: List of shortcodes in the Pro html templates?

Postby Jason Caldwell » July 22nd, 2011, 7:02 pm

The Replacement Code %%description%% is handled inside:
Code: Select all
/s2member-pro/includes/classes/gateways/authnet/authnet-form-in.inc.php
( search for instances of %%description%% )

OR --- if you want access to Shortcode Attributes inside your custom template file,
please create this directory and file first please:
/wp-content/mu-plugins/s2-hacks.php
Code: Select all
<?php
add_action 
("ws_plugin__s2member_pro_before_sc_authnet_form_after_shortcode_atts", "my_action");
function my_action ($vars = array ())
    {
        $GLOBALS["authnet_attr"] = $vars["attr"];
    }
?>
* Now you can have access to all Shortcode Attributes inside your custom PHP template file. For instance, you could now use: $GLOBALS["authnet_attr"]["ra"]
~ 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: List of shortcodes in the Pro html templates?

Postby blewis » July 22nd, 2011, 7:07 pm

Thanks (and thanks for the reminder about the dynamic desc).

But just to clarify, I am using PayPal Pro (with ARB). The code for this would still be in the Authnet gateway directory?

Bryan
User avatar
blewis
Registered User
Registered User
 
Posts: 19
Joined: June 25, 2011

Re: List of shortcodes in the Pro html templates?

Postby Jason Caldwell » July 22nd, 2011, 7:14 pm

Oh, sorry. I guess I just had Authorize.Net on my mind when I wrote that.
The process is essentially the same for PayPal, but the locations are different. Here you go.
The Replacement Code %%description%% is handled inside:
Code: Select all
/s2member-pro/includes/classes/gateways/paypal/paypal-form-in.inc.php
( search for instances of %%description%% )

OR --- if you want access to Shortcode Attributes inside your custom template file,
please create this directory and file first please:
/wp-content/mu-plugins/s2-hacks.php
Code: Select all
<?php
add_action 
("ws_plugin__s2member_pro_before_sc_paypal_form_after_shortcode_atts", "my_action");
function my_action ($vars = array ())
    {
        $GLOBALS["paypal_attr"] = $vars["attr"];
    }
?>
* Now you can have access to all Shortcode Attributes inside your custom PHP template file. For instance, you could now use: $GLOBALS["paypal_attr"]["ra"]
~ 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: List of shortcodes in the Pro html templates?

Postby blewis » July 22nd, 2011, 7:57 pm

Thanks. I will give it a try.

Bryan
User avatar
blewis
Registered User
Registered User
 
Posts: 19
Joined: June 25, 2011

Re: List of shortcodes in the Pro html templates?

Postby blewis » July 23rd, 2011, 5:44 pm

Not sure why, but the s2-hacks file in the mu-plugins directory did not work for me. The %%ra%% variable did not change to the price (it just stayed the literal string "%%ra%%" in the final output).

However, hacking the paypal-form-in.inc.php file directly did work. It's not the prettiest thing, since I not really like changing core files in plugins (due to updates). But at least it's working.

Thanks,
Bryan
User avatar
blewis
Registered User
Registered User
 
Posts: 19
Joined: June 25, 2011

Re: List of shortcodes in the Pro html templates?

Postby Jason Caldwell » July 24th, 2011, 12:06 pm

Thanks for reporting back.
blewis wrote:Not sure why, but the s2-hacks file in the mu-plugins directory did not work for me. The %%ra%% variable did not change to the price (it just stayed the literal string "%%ra%%" in the final output).

However, hacking the paypal-form-in.inc.php file directly did work. It's not the prettiest thing, since I not really like changing core files in plugins (due to updates). But at least it's working.

Thanks,
Bryan
Sorry for any confusion. You'll need to use <?php echo $GLOBALS["paypal_attr"]["ra"]; ?>. The %%ra%% Replacement Code is invalid inside a Pro Form template. The hack I supplied makes it possible to access Shortcode Attributes through PHP tags though.
Code: Select all
<?php echo $GLOBALS["paypal_attr"]["attribute_name_goes_here"]; ?>
~ 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: List of shortcodes in the Pro html templates?

Postby blewis » July 24th, 2011, 1:21 pm

Oops. I guess you did state that in your original code posting. I just failed to read the part below the code box. Sorry for not following directions! :)
User avatar
blewis
Registered User
Registered User
 
Posts: 19
Joined: June 25, 2011

Re: List of shortcodes in the Pro html templates?

Postby Jason Caldwell » July 24th, 2011, 10:33 pm

No problem at all. Thanks for the follow-up!
~ 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


Return to s2Member Plugin

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot] and 2 guests

cron