Community Support Forums — WordPress® ( Users Helping Users ) — 2011-05-07T12:49:41-05:00 http://www.primothemes.com/forums/feed.php?f=4&t=6337 2011-05-07T12:49:41-05:00 http://www.primothemes.com/forums/viewtopic.php?t=6337&p=14354#p14354 <![CDATA[Re: Replacement Codes in Custom Return URL on Success - [s2m]]> Thanks for reporting this important issue.
~ and thanks for bringing this to my attention Cristián.

Yes, I can see where this might happen. I'll classify this as a bug, and we'll include a fix for this in the next release. Until then, you can add this patch if you like.

Please open /s2member-pro/includes/classes/gateways/paypal-form-in.inc.php,
at line #53 add this line:
Code:
$attr["success"] = preg_replace ("/(&#038;|&amp;)/", "&", $attr["success"]); /* Convert ampersands. */ 

Statistics: Posted by Jason Caldwell — May 7th, 2011, 12:49 pm


]]>
2011-05-07T00:44:20-05:00 http://www.primothemes.com/forums/viewtopic.php?t=6337&p=14309#p14309 <![CDATA[Re: Replacement Codes in Custom Return URL on Success - [s2m]]>
I had found that page too, but I didn't share it precisely because it talks about hacking WP, but I did get from it that it represents an ampersand.

I searched s2Member Pro's code for that variable and found this in /wp-content/plugins/s2member-pro/includes/classes/gateways/paypal/paypal-utilities.inc.php (same in the Authorize.Net equivalent):

function paypal_s2p_v_generate wrote:
This function adds the s2p-v variable onto the end of a custom URL for success. This can be used for verifying the integrity of variables in a success query string.


I sent Jason an email earlier, he may leave a comment when he sees it.

Statistics: Posted by Cristián Lávaque — May 7th, 2011, 12:44 am


]]>
2011-05-07T00:26:16-05:00 http://www.primothemes.com/forums/viewtopic.php?t=6337&p=14307#p14307 <![CDATA[Re: Replacement Codes in Custom Return URL on Success - [s2m]]> http://stackoverflow.com/questions/5605 ... nge-to-038
which says that a wp function called wptexturize() is responsible for the "#038;" .. though I am not familiar with that kind of url encoding. I have only seen the Percent sign, like "%20" .

The suggestions on that stackoverflow page involve hacking wordpress.. obviously a no-no. But it inspired me to write this simple function in my functions.php, to remove the "#038;"

Code:
add_filter('the_content', 'fix_ampersands');
function fix_ampersands($content) {
  $content = str_replace('#038;' , '' , $content);
  return $content;
}


Interestingly, this also caused the (mysterious) "s2p-v" var to move to the LAST position in the url. No idea why.

Anyway, I guess i'm all set with this. But it seems to me that this is a problem in s2member Pro that should be addressed for all users who are doing Custom Return URL on Success, with Replacement Codes. Or maybe Jason has more info on this.. i'd still love to hear.

Thanks,
Todd

Statistics: Posted by toddz88 — May 7th, 2011, 12:26 am


]]>
2011-05-06T20:09:45-05:00 http://www.primothemes.com/forums/viewtopic.php?t=6337&p=14277#p14277 <![CDATA[Re: Replacement Codes in Custom Return URL on Success - [s2m]]> Statistics: Posted by Cristián Lávaque — May 6th, 2011, 8:09 pm


]]>
2011-05-06T15:55:18-05:00 http://www.primothemes.com/forums/viewtopic.php?t=6337&p=14260#p14260 <![CDATA[Replacement Codes in Custom Return URL on Success - [s2mPro]]]>
SHORTCODE ON MY PAYMENT FORM PAGE
Code:
success="thank-you/?subscr_id=%%subscr_id%%&item_name=%%item_name%%&regular=%%regular%%&recurring=%%recurring%%&initial_term=%%initial_term%%&regular_term=%%regular_term%%&full_name=%%full_name%%"



RESULTING URL
Note the strange "#038;" between var, after each "&". I think that's the problem.
Code:
https://www.mysite.com/signup/thank-you/?subscr_id=I-00JAFFJFJT1N&s2p-v=1304711482-cf65722cd2a942183f328a64c53fa1b6#038;item_name=Individual+membership%3A+%241+USD+%2F+Month+%28+recurring+charge%2C+for+ongoing+access+%29&#038;regular=1.00&#038;recurring=1.00&#038;initial_term=7+D&#038;regular_term=1+M&#038;full_name=Brian+Westbrook



THANK-YOU PAGE TEMPLATE FILE PHP
Each replacement-code / url-var that i'm expecting is handled like this:
Code:
$thanks['subscr_id'] = htmlentities($_GET['subscr_id']);
$thanks['item_name'] = htmlentities($_GET['item_name']);

Then echo'd out to the page with
Code:
<p>Subscription ID, subscr_id: <?php echo $thanks['subscr_id']; ?></p>
<p>item_name: <?php echo $thanks['item_name']; ?></p>



THE PROBLEM
Only the subscr_id is working, the other vars fail to show up in the $_GET array. Here's my debug:
Code:
[_GET] => Array
        (
            [subscr_id] => I-00JAFFJFJT1N
            [s2p-v] => 1304711482-cf65722cd2a942183f328a64c53fa1b6
        )

[thanks] => Array
        (
            [subscr_id] => I-00JAFFJFJT1N
            [item_name] =>
            [regular] =>
            [recurring] =>
            [initial_term] =>
            [regular_term] =>
            [full_name] =>
        )


Since the $_GET seems to break after the "s2p-v" variable (whatever that is), and the next character in the returned url is a "#" ... it seems like that is the start of the problem, breaking the other vars.

Any idea what's going on here? What the "#038;" is, and how to remove it?
Thanks!
Todd

Statistics: Posted by toddz88 — May 6th, 2011, 3:55 pm


]]>