Community Support Forums — WordPress® ( Users Helping Users ) — 2012-01-26T13:06:34-05:00 http://www.primothemes.com/forums/feed.php?f=4&t=1604 2012-01-26T13:06:34-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1604&p=61642#p61642 <![CDATA[Re: TIP: Using variables in a Shortcode]]>
You're not using the PHP Variables properly. Please see my response here: viewtopic.php?f=4&t=16906#p61640

Statistics: Posted by Raam Dev — January 26th, 2012, 1:06 pm


]]>
2012-01-26T00:47:55-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1604&p=61584#p61584 <![CDATA[Re: TIP: Using variables in a Shortcode]]>
So using your example, my code look something like this:

Code:
<?php
  $amount = $_REQUEST["amount"];
   do_shortcode('[s2Member-PayPal-Button ... ra="$amount" ... /]');
');
?>

Statistics: Posted by angelazou — January 26th, 2012, 12:47 am


]]>
2011-09-06T14:57:21-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1604&p=34119#p34119 <![CDATA[Re: TIP: Using variables in a Shortcode]]> See this article: viewtopic.php?f=40&t=12764&p=34117#p34117

Statistics: Posted by Jason Caldwell — September 6th, 2011, 2:57 pm


]]>
2011-05-18T02:59:22-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1604&p=15263#p15263 <![CDATA[Re: TIP: Using variables in a Shortcode]]> ~ the example above can be applied to ANY Shortcode, even for Pro Forms.

However, there are two ways to dynamically configure a PayPal Pro Form.

1. Using variables in your Shortcode ( explained here )
( note, you can apply the concept discussed in this thread, to any Shortcode Attribute )
viewtopic.php?f=36&t=1604

2. Or, you can apply a Filter of your own, to all Pro Forms during checkout processing.
Create this directory and file:
/wp-content/mu-plugins/s2-hacks.php
Code:
<?php
add_filter 
("ws_plugin__s2member_pro_paypal_checkout_post_attr", "my_paypal_pro_checkout_form_attr");
function my_paypal_pro_checkout_form_attr ($attr = array ())
    {
        if ($_POST["something-custom"] === "some custom value")
            {
                $attr["ra"] = "10.00"; /* Adjust price dynamically. */
                /* And/or, you could adjust other Attributes too. */
                /* $attr["rp"], $attr["rt"], etc, etc. */
            }
        /**/
        return (array)$attr;
    }
?>
^ this is for all PayPal Pro Checkout Forms, except Specific Post/Page Access.

This is for PayPal Pro Specific Post/Page Checkout Forms.
Code:
<?php
add_filter 
("ws_plugin__s2member_pro_paypal_sp_checkout_post_attr", "my_paypal_pro_sp_checkout_form_attr");
function my_paypal_pro_sp_checkout_form_attr ($attr = array ())
    {
        if ($_POST["something-custom"] === "some custom value")
            {
                $attr["ra"] = "10.00"; /* Adjust price dynamically. */
                /* And/or, you could adjust other Attributes too. */
                /* $attr["ids"], $attr["exp"], etc, etc. */
            }
        /**/
        return (array)$attr;
    }
?>
^ this is for PayPal Pro Specific Post/Page Checkout Forms.

The examples above will also work for Authorize.Net Pro Forms.
Just change all occurrences of the word "paypal" in the code, to "authnet".

Statistics: Posted by Jason Caldwell — May 18th, 2011, 2:59 am


]]>
2011-01-13T04:17:51-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1604&p=5537#p5537 <![CDATA[TIP: Using variables in a Shortcode]]> It is possible to configure Shortcode Attributes dynamically.

But first, you will need to install a PHP Execution plugin.
http://wordpress.org/extend/plugins/php ... on-plugin/

Now, let's assume you have a URL like this on your site:
Code:
http://www.YOURSITE.com/membership-options-page/?amount=129.00

Inside your Membership Options Page, or whatever Page contains your Shortcode, you can do this:
Code:
[s2Member-PayPal-Button ... ra="<?php echo esc_attr($_REQUEST["amount"]); ?>" ... /]
( this Button Code has been abbreviated for clarity; showing only the "ra" attribute )

So in this example, the "ra" attribute ( i.e. the Regular Amount ), is configured dynamically based on the value of ?amount=129.00 in the URL. This particular example may or may not be useful to you, but it demonstrates your ability to configure Shortcode Attributes dynamically. You could even take this a step further by constructing custom forms on your site that contain options; which ultimately dictate the amount that you'll charge. Where the final amount is configured dynamically.

* NOTE: You MUST be in the HTML tab of your editor when adding PHP tags.

Statistics: Posted by Jason Caldwell — January 13th, 2011, 4:17 am


]]>