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.

How to extract the package price (no JS)

Home Forums Community Forum How to extract the package price (no JS)

This topic contains 1 reply, has 1 voice. Last updated by  YoniExpress 3 years, 9 months ago.

Topic Author Topic
Posted: Tuesday Apr 2nd, 2013 at 8:46 pm #46423

This is one of Mr. Flynn’s developers.

I did look for this for a while today (ok, 3 hours or so,) and most of the info I found was specific to the user, as are many of the constants, methods, and shortcodes. We need this for is a pre-signup; the design requires the price to be displayed in a place separate from the description.

There might be other areas we’ll need too, so the general question: how can we extract the values that are used as input from the shortcodes? In the example below, we’d want to somehow access the value for the ra parameter of level 1 membership:

[s2Member-Pro-PayPal-Form level=”1″ ccaps=”” desc=”First Month/$1.00, then $9.00/ Month” ps=”paypal” lc=”” cc=”USD” dg=”0″ ns=”1″ ta=”1.00″ tp=”1″ tt=”M” ra=”9.00″ rp=”1″ rt=”M” rr=”1″ rrt=”” rra=”2″ ……

As mentioned it would be helpful to know how to pull any of these values, I didn’t see them anywhere in the constants or API methods. The [s2Get /] came close, but no cigar.

Rather than jumping through hoops to extract the info, (or resort to Javascript . . . ugh) it would be cool to do something like echo $something[‘level1’][‘ra’];

List Of Topic Replies

Viewing 1 replies (of 1 total)
Author Replies
Author Replies
Posted: Wednesday Apr 3rd, 2013 at 2:06 pm #46480

Never mind. This project is overdue and I’ve figured it out, posting solution for those who might need a similar usage.

I was looking in the wrong place (sorta,) as shortcodes are ultimately parsed by W.P. It wasn’t fun locating where to grab the shortcodes, but it’s stored like so:

$sc = $GLOBALS["scode"];

(get_defined_vars() outputs what appears to be the exact same dump, seems redundant. You probably have your reasons.)

Then using the wordpress function,

$tst = shortcode_parse_atts($sc);

A var_dump() on $tst shows all the selected level shortcodes in place. More gracefully,

$s2shortcode = shortcode_parse_atts($GLOBALS["scode"]);
echo "PRICE {$s2shortcode['ra']} FIRST MONTH {$s2shortcode['ta']}";

As mentioned, a var_dump() shows all the array keys that can be accessed.

Viewing 1 replies (of 1 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.