Page 1 of 1

Generate HTML for pro-forms

PostPosted: June 26th, 2011, 9:13 am
by ifanatics
Greetings,

I need to try to generate HTML code (instead of shortcode) for pasting pro-forms into a page. This is easy to do with buttons because it offers you both the shortcode and the HTML code. How can I get the equivalent for pro-forms?


Thanks.

Re: Generate HTML for pro-forms

PostPosted: June 26th, 2011, 6:51 pm
by Cristián Lávaque
You could use the shortcode, view the page and copy the HTML there. Haven't tried that with pro-forms, but you could see if it works for you.

Re: Generate HTML for pro-forms

PostPosted: June 26th, 2011, 9:21 pm
by ifanatics
Thanks for the suggestion, although that is not quite working, as it creates an over-complicated situation of trying to figure out what to copy and paste in order to create a form.

I like the shortcode function, but in order for my affiliate software to work properly, I need to render a specific field in HTML. It is not working properly when trying to use it in the shortcode.

Here's what I'm doing currently (with the shortcode):
custom="mysite.com|<?php echo $_COOKIE['ap_id']; ?>"

Here's what I need to do in order for the affiliate software to work properly:
<input type="hidden" name="custom" value="mysite.com|<?php echo $_COOKIE['ap_id']; ?>" />

Yes, I'm using the PHP Exectution Plugin.

For whatever reason, this will not work with the shortcode. It needs to be in regular HTML to work... proven by the fact that it works with paypal buttons (when using the long-code), but I need to get this to work with pro-forms.

Any solutions to get this working properly would be greatly appreciated.

Re: Generate HTML for pro-forms

PostPosted: June 26th, 2011, 10:22 pm
by Cristián Lávaque
OK, got it that it works with the button but not the form. If you <?php echo $_COOKIE['ap_id']; ?> in the page, outside of the shortcode, does it echo what it should? Have you tried the Notification API to a custom script to see how the $_COOKIE['ap_id'] string cames through?

Re: Generate HTML for pro-forms

PostPosted: June 27th, 2011, 4:04 am
by ifanatics
Doesn't look like that's going to do the trick, as the string:
<input type="hidden" name="custom" value="mysite.com|<?php echo $_COOKIE['ap_id']; ?>" /> is meant to REPLACE:
<input type="hidden" name="custom" value="www.example.com" />

Therefore, it seems to me that it needs to happen before the PayPal button is pushed?

The instructions explaining this integration from the Affiliate Software can be found here: http://www.tipsandtricks-hq.com/wordpre ... mment-1545

Thanks.

Re: Generate HTML for pro-forms

PostPosted: June 27th, 2011, 3:44 pm
by Cristián Lávaque
OK, you could try using a custom template for the form, maybe you can add your hidden input there. Copy template for your form from the /wp-content/plugins/s2member-pro/includes/templates/forms/ directory and paste it in your theme's directory. You can name it whatever you want, make it .php instead of .html even. Edit the template the way you need it and then tell the shortcode to use that file as the template for the form using the template attribute. WP Admin -> s2Member -> PayPal Pro-Forms -> Shortcode Attributes (Explained) -> template

Re: Generate HTML for pro-forms

PostPosted: June 27th, 2011, 11:48 pm
by Jason Caldwell
Thanks for the excellent question.
~ and thanks for bringing this to my attention Cristián.

Here's what I'm doing currently (with the shortcode):
custom="mysite.com|<?php echo $_COOKIE['ap_id']; ?>"

This is the correct way to handle this with s2Member Pro Forms. No, there is no way to render an s2Member Pro Form with raw HTML, at least not like you can with a PayPal Button. A Pro Form is very dynamic, and requires much more than just a code snippet to function properly, thus, a code snippet is not provided for Pro Forms; you should always use the Shortcode format for Pro Forms.

Based on the instructions provided here, I see no reason why the Shortcode would not work. I would suggest going back over your integration of the affiliate software, and just double check that you've got all the Replacement Codes entered properly in your Payment Notification URL. Also, be sure that $_COOKIE['ap_id'] actually has a value. If that variable is empty, tracking will not work as intended.

Correct solution ( use Shortcode )
Code: Select all
custom="mysite.com|<?php echo $_COOKIE['ap_id']; ?>"

Re: Generate HTML for pro-forms

PostPosted: June 28th, 2011, 8:56 am
by ifanatics
Hi Jason,

Thanks for the reply. I have confirmed that everything is correct, in the shortcode and in the payment notification url.

The value does get passed through, as I can see the affiliates name on the paypal order details. It reads: "custom: name". But the referring affiliate is not credited with the sale. When asking the providers of the affiliate software, they said it was not compatible with s2member pro forms... which seems strange to me also as it all looks like it *should* work.

I'm beating my head against the wall on this one. I had no idea that this was going to be a problem before deciding to use this affiliate software, but I spent a lot of time setting it up and I do like the interface. Would really like to get it working if you have any further ideas.

Thanks again.

Re: Generate HTML for pro-forms

PostPosted: June 29th, 2011, 5:33 pm
by Jason Caldwell
Cristián, can you please send an email to the developers of this plugin for us? Maybe invite them to join this thread in an effort to resolve the problem here. It sounds to me like everything is configured properly, and if the affiliate program integration is implemented through s2Member's Payment Notification URL, the %%cv1%% Replacement Code should be available there with both Button and/or Pro Form integration.

** If the developer needs a copy of s2Member Pro to complete his tests, we'll be happy to offer that.

Re: Generate HTML for pro-forms

PostPosted: June 29th, 2011, 6:43 pm
by ifanatics
Awesome!

Thanks for the follow up on this. I look forward to finding a solution.

Re: Generate HTML for pro-forms

PostPosted: June 30th, 2011, 1:41 am
by Cristián Lávaque
Sent the email just now.

Re: Generate HTML for pro-forms

PostPosted: June 30th, 2011, 3:04 pm
by Jason Caldwell
Thank you!

Re: Generate HTML for pro-forms

PostPosted: July 3rd, 2011, 12:52 am
by ifanatics
Hey Guys,

Just a follow-up... Any progress on this?


Thanks!

Re: Generate HTML for pro-forms

PostPosted: July 3rd, 2011, 1:35 am
by Cristián Lávaque
We're in communication with the developer by email. :)

Re: Generate HTML for pro-forms

PostPosted: July 3rd, 2011, 1:17 pm
by Jason Caldwell
The developer has indicated that he thinks the problem is with this section of code:
Code: Select all
custom="mysite.com|<?php echo $_COOKIE['ap_id']; ?>"

He believes the PHP tag here is NOT being processed successfully. Do you have a PHP execution plugin installed? If so, please run a quick test inside one of your Pages/Posts to be sure it's working as expected. Try testing a PHP tag like this please.
Code: Select all
<?php echo 'Hello world.'; ?>

PHP Execution Plugin ( required for PHP tags ):
http://wordpress.org/extend/plugins/php ... on-plugin/

Re: Generate HTML for pro-forms

PostPosted: July 3rd, 2011, 2:07 pm
by Jason Caldwell
If all else fails. Please remove the PHP tag from your Shortcode, and instead follow these instructions.

Create this directory and file:
/wp-content/mu-plugins/s2-hacks.php
Code: Select all
<?php
add_action 
("ws_plugin__s2member_before_sc_paypal_button_after_shortcode_atts", "wp_aff_s2member_integration");
add_action ("ws_plugin__s2member_pro_before_sc_paypal_form_after_shortcode_atts", "wp_aff_s2member_integration");
function wp_aff_s2member_integration ($vars = array ())
    {
        $cookie_value = esc_html ($_COOKIE["ap_id"]);
        $vars["__refs"]["attr"]["custom"] .= "|" . $cookie_value;
    }
?>

Re: Generate HTML for pro-forms

PostPosted: July 7th, 2011, 1:57 am
by Cristián Lávaque
The developer of the Affiliate plugin just let us know that he release a new update that integrates with s2Member much better and simpler!

Thank you guys for all the pointers and help. I have now released an updated version of the affiliate plugin and integrating this version with the s2Member is super easy. The customer essentially have to activate these two plugins and check a few checkboxes and thats it. Here is the updated integrated instruction:

http://www.tipsandtricks-hq.com/wordpre ... ftware-368


:)

Re: Generate HTML for pro-forms

PostPosted: July 8th, 2011, 4:10 pm
by Jason Caldwell
Nice work Cristián!

Re: Generate HTML for pro-forms

PostPosted: July 8th, 2011, 8:43 pm
by Cristián Lávaque
Nice work Jason! :)