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.

CLICKBANK BUTTON HACK – (another instalation)

Home Forums Community Forum CLICKBANK BUTTON HACK – (another instalation)

This topic contains 16 replies, has 3 voices. Last updated by  Cristián Lávaque 4 years, 6 months ago.

Topic Author Topic
Posted: Wednesday Jun 20th, 2012 at 6:57 pm #17043

Hi, im a proud owner of s2member PRO

I was looking for the answer of using a clickbank button in another instalation, just like this lovely lady in this post: http://www.s2member.com/forums/topic/button-on-a-different-installation/

So, like you said, the answer is using the “CLICKBANK BUTTON HACK” posted here: http://www.s2member.com/forums/topic/using-clickbank-and-paypal/#post-11438

I used it, and it works perfectly.

BUT, here’s my question:

That code works with ONE PRODUCT:

AND,

I need the code (or the HACK) works for several products in clickbank (and of course, several s2member clickbank buttons).

What are the steps, or what codes can i include in the “CLICKBANK HACK” posted here: http://www.s2member.com/forums/topic/using-clickbank-and-paypal/#post-11438

So i can use your services and s2member clickbnak button on my several clickbank products in clickbank?

Appreciate your efforts and your support.

Thanks in advance.

List Of Topic Replies

Viewing 16 replies - 1 through 16 (of 16 total)
Author Replies
Author Replies
Posted: Thursday Jun 21st, 2012 at 8:13 am #17112

Hi Luis.

You can try something like this:

[hilite pre_code]
?clickbank=redirect, would have the number for the product in your hack, e.g. ?clickbank=1

I hope that helps. :)

Posted: Thursday Jun 21st, 2012 at 10:13 am #17129

I just try it!

… But it didn’t work quite well…

A “PAGE NOT FOUND” message appears from my website.

This is the exact code i put in the php file (mu-plugins folder):

<?php
add_action('init', 'handle_custom_clickbank_redirections');
function handle_custom_clickbank_redirections()
{
	if(isset($_GET['clickbank']))
	{
		switch ($_GET['clickbank']) {
			case 1:
				$shortcode = '[s2Member-Pro-ClickBank-Button cbp="1" level="1" ccaps="" desc="El Arte de la Atraccion + La Primera Salida + 8 Switches de Atracción" custom="atraccionla.com" tp="0" tt="D" rp="2" rt="M" rr="0" image="default" output="url" /]';
				break;
			case 2:
				$shortcode = '[s2Member-Pro-ClickBank-Button cbp="2" level="4" ccaps="" desc="Sociedad Secreta Plata + 5 Guías Especiales + CERO DUDAS" custom="atraccionla.com" tp="0" tt="D" rp="1" rt="Y" rr="0" image="default" output="url" /]';
				break;
			case 3:
				$shortcode = '[s2Member-Pro-ClickBank-Button cbp="3" level="2" ccaps="" desc="Guía Especial Frases de Repertorio+ Programa Cero Dudas" custom="atraccionla.com" tp="0" tt="D" rp="1" rt="M" rr="1" image="default" output="url" /]';
				break;
			case 4:
				$shortcode = '[s2Member-Pro-ClickBank-Button cbp="4" sp="1" ids="1464,1470,1481,1479,1477,1475,1473,1471" exp="1440" desc="Description and pricing details here." custom="atraccionla.com" image="default" output="url" /]';
				break;
			case 5:
				$shortcode = '[s2Member-Pro-ClickBank-Button cbp="5" sp="1" ids="1527,1470,1481,1479,1477,1475,1473,1471" exp="1440" desc="Description and pricing details here." custom="atraccionla.com" image="default" output="url" /]';
				break;
			default:
				$shortcode = '[s2Member-Pro-ClickBank-Button cbp="1" level="1" ccaps="" desc="El Arte de la Atraccion + La Primera Salida + 8 Switches de Atracción" custom="atraccionla.com" tp="0" tt="D" rp="2" rt="M" rr="0" image="default" output="url" /]';
		}
		$clickbank_checkout = do_shortcode($shortcode);
		wp_redirect($clickbank_checkout);
		exit;
	}
}

Would be awesome if you can check the code again to make sure its ok.

The case 1, case 2, case 3, case 4, case 5, corresponds to each product in my clickbank account.

The default s2member button code, its exactly the case 1 code.

And by the way, the previous hack code with only one product worked fine, but we need it to work for more than one…

If you need anything else, just let me know.

Thanks in advance,

Posted: Thursday Jun 21st, 2012 at 10:16 am #17130
Posted: Friday Jun 22nd, 2012 at 6:45 am #17175

Odd… It’s as if the output of the shortcode were the linked image instead of the URL… I got redirected to

http://atraccionla.com/ahref=http:/0.lmc541.pay.clickbank.net/?s2_invoice=1&s2_p1=0+D&s2_p3=1+M&s2_desc&s2_custom=atraccionla.com&s2_customer_ip=189.226.221.75&s2_subscr_id=s2-4fe447deb84ad&_s2member_sig=1340360670-24b608620fe5f3a1a5e434df82f56536imgsrc=http://atraccionla.com/wp-content/plugins/s2member-pro/images/clickbank-button.pngstyle=width:auto;height:auto;border:0;alt=ClickBank//a

If you use the shortcodes in a post, do they ouput the URL or the button?

Not sure why that is. I rewrote the hack to use another hook, and not use the switch. Let me know if this makes any difference:

[hilite pre_code]
'[[s2Member-Pro-ClickBank-Button cbp="1" level="1" ccaps="" desc="El Arte de la Atracción + La Primera Salida + 8 Switches de Atracción" custom="atraccionla.com" tp="0" tt="D" rp="2" rt="M" rr="0" image="default" output="url" /]]',
2 => '[[s2Member-Pro-ClickBank-Button cbp="2" level="4" ccaps="" desc="Sociedad Secreta Plata + 5 Guías Especiales + CERO DUDAS" custom="atraccionla.com" tp="0" tt="D" rp="1" rt="Y" rr="0" image="default" output="url" /]]',
3 => '[[s2Member-Pro-ClickBank-Button cbp="3" level="2" ccaps="" desc="Guía Especial Frases de Repertorio + Programa Cero Dudas" custom="atraccionla.com" tp="0" tt="D" rp="1" rt="M" rr="1" image="default" output="url" /]]',
4 => '[[s2Member-Pro-ClickBank-Button cbp="4" sp="1" ids="1464,1470,1481,1479,1477,1475,1473,1471" exp="1440" desc="Description and pricing details here." custom="atraccionla.com" image="default" output="url" /]]',
5 => '[[s2Member-Pro-ClickBank-Button cbp="5" sp="1" ids="1527,1470,1481,1479,1477,1475,1473,1471" exp="1440" desc="Description and pricing details here." custom="atraccionla.com" image="default" output="url" /]]',
);
if (isset($shortcodes[$_GET['clickbank']])) {
$clickbank_checkout = do_shortcode($shortcodes[$_GET['clickbank']]);
wp_redirect($clickbank_checkout);
exit;
}
}
}
[/hilite]
Posted: Friday Jun 22nd, 2012 at 8:34 am #17190

Nope, Cristián.

Didn´t make any difference.

Can test it yourself here:

http://atraccionla.com/?clickbank=1
http://atraccionla.com/?clickbank=2
http://atraccionla.com/?clickbank=3
http://atraccionla.com/?clickbank=4
http://atraccionla.com/?clickbank=5

In a post, the output depends if i put output=”url”, or output=”anchor”.

Here´s a test page with two examples: http://atraccionla.com/uncategorized/s2member-clickbank-button-test/

Oh, i appreciate your help and support, i know and hope we could make it work, i really need it.

Posted: Saturday Jun 23rd, 2012 at 6:12 am #17237

It’s weird that it works fine in posts, or with a single shortcode, but not with this new hack…

Couldy you replace the [hilite mono]wp_redirect[/hilite] line with this to see what’s being returned by [hilite mono]do_shortcode[/hilite], please?

[hilite pre_code]echo $clickbank_checkout;[/hilite]

I’ll ask Jason if he has an idea why the output is being the anchor instead of the URL.

Posted: Monday Jun 25th, 2012 at 12:20 pm #17386

Hey Cristian!

I made the change, you can double check the final code here. Justin case i did it wrong:

<?php
add_action('wp_loaded', 'handle_custom_clickbank_redirections');
function handle_custom_clickbank_redirections() {
	if(isset($_GET['clickbank'])) {
		$shortcodes = array(
			1 => '[s2Member-Pro-ClickBank-Button cbp="1" level="1" ccaps="" desc="El Arte de la Atracción + La Primera Salida + 8 Switches de Atracción" custom="atraccionla.com" tp="0" tt="D" rp="2" rt="M" rr="0" image="default" output="url" /]',
			2 => '[s2Member-Pro-ClickBank-Button cbp="2" level="4" ccaps="" desc="Sociedad Secreta Plata + 5 Guías Especiales + CERO DUDAS" custom="atraccionla.com" tp="0" tt="D" rp="1" rt="Y" rr="0" image="default" output="url" /]',
			3 => '[s2Member-Pro-ClickBank-Button cbp="3" level="2" ccaps="" desc="Guía Especial Frases de Repertorio + Programa Cero Dudas" custom="atraccionla.com" tp="0" tt="D" rp="1" rt="M" rr="1" image="default" output="url" /]',
			4 => '[s2Member-Pro-ClickBank-Button cbp="4" sp="1" ids="1464,1470,1481,1479,1477,1475,1473,1471" exp="1440" desc="Description and pricing details here." custom="atraccionla.com" image="default" output="url" /]',
			5 => '[s2Member-Pro-ClickBank-Button cbp="5" sp="1" ids="1527,1470,1481,1479,1477,1475,1473,1471" exp="1440" desc="Description and pricing details here." custom="atraccionla.com" image="default" output="url" /]',
		);
		if (isset($shortcodes[$_GET['clickbank']])) {
			$clickbank_checkout = do_shortcode($shortcodes[$_GET['clickbank']]);
			echo $clickbank_checkout;
			exit;
		}
	}
}

It returns the button images!

Check it here:
Can test it yourself here:

http://atraccionla.com/?clickbank=1
http://atraccionla.com/?clickbank=2
http://atraccionla.com/?clickbank=3
http://atraccionla.com/?clickbank=4
http://atraccionla.com/?clickbank=5

We’re like ALMOST there, i know its a little chenge in code we need… YOU’RE THE EXPERT MAN!

I know you can do it.

Let me know of the next test we could do.

Thank you very much for your help and support

Posted: Monday Jun 25th, 2012 at 11:33 pm #17447

Yeah, that’s what it was ouputing before, which is why you had the error, the code for the button is not a valid URL to redirect to.

What I don’t understand is why the [hilite mono]output[/hilite] attribute in the shortcode is not working in this version of the hack. I emailed Jason asking him what he thinks.

Posted: Tuesday Jun 26th, 2012 at 9:15 am #17538

Awesome, please let me know!

I really need it to work.

Thanks in advance Cristián.

Posted: Wednesday Jun 27th, 2012 at 12:49 pm #17663

Hi Cristián! Any news?

Posted: Wednesday Jun 27th, 2012 at 2:23 pm #17677
Staff Member

Thanks for the heads up on this request for support.

@Luis Caraballo

Nothing wrong with the hack that you posted. I just ran it through a test install and it works as expected. If problems persist on your end, I would start looking at other possibilities (i.e. something besides the code you posted here). Is it possible there are other hooks/filters at work somewhere? Something else that might be filtering shortcode attributes?

Posted: Wednesday Jun 27th, 2012 at 9:37 pm #17716

Hi Jason!

Nope, this is the only mu-plugin, and this is the code:

<?php
add_action('wp_loaded', 'handle_custom_clickbank_redirections');
function handle_custom_clickbank_redirections() {
	if(isset($_GET['clickbank'])) {
		$shortcodes = array(
			1 => '[s2Member-Pro-ClickBank-Button cbp="1" level="1" ccaps="" desc="El Arte de la Atracción + La Primera Salida + 8 Switches de Atracción" custom="atraccionla.com" tp="0" tt="D" rp="2" rt="M" rr="0" image="default" output="url" /]',
			2 => '[s2Member-Pro-ClickBank-Button cbp="2" level="4" ccaps="" desc="Sociedad Secreta Plata + 5 Guías Especiales + CERO DUDAS" custom="atraccionla.com" tp="0" tt="D" rp="1" rt="Y" rr="0" image="default" output="url" /]',
			3 => '[s2Member-Pro-ClickBank-Button cbp="3" level="2" ccaps="" desc="Guía Especial Frases de Repertorio + Programa Cero Dudas" custom="atraccionla.com" tp="0" tt="D" rp="1" rt="M" rr="1" image="default" output="url" /]',
			4 => '[s2Member-Pro-ClickBank-Button cbp="4" sp="1" ids="1464,1470,1481,1479,1477,1475,1473,1471" exp="1440" desc="Description and pricing details here." custom="atraccionla.com" image="default" output="url" /]',
			5 => '[s2Member-Pro-ClickBank-Button cbp="5" sp="1" ids="1527,1470,1481,1479,1477,1475,1473,1471" exp="1440" desc="Description and pricing details here." custom="atraccionla.com" image="default" output="url" /]',
		);
		if (isset($shortcodes[$_GET['clickbank']])) {
			$clickbank_checkout = do_shortcode($shortcodes[$_GET['clickbank']]);
			wp_redirect($clickbank_checkout);
			exit;
		}
	}
}

You can test the final result here:

http://atraccionla.com/?clickbank=1
http://atraccionla.com/?clickbank=2
http://atraccionla.com/?clickbank=3
http://atraccionla.com/?clickbank=4
http://atraccionla.com/?clickbank=5

Please, let me know.

The hack with one single product (the original hack) worked perfectly, but i really need to protect more than one product with your awesome membership software, it´s the reason i need it!

Let me know if i make a mistake with the code or something,

Thanks!

Posted: Friday Jun 29th, 2012 at 5:04 am #17839

Luis, I tested the hack in my own site as well and the output was a URL, not the anchor, so it works well. The problem you’re having is specific to your installation.

I’d suggest deactivating other plugins one by one, checking after each if the problem went away.

Posted: Friday Jun 29th, 2012 at 3:41 pm #17881

Ok, test it.

It WORKS but ONLY with Specific Post/Page buttons…

Not with MEMBERSHIP BUTTONS!

Any ideas?

Should i change everything for specific post?

Please check.

Thanks!

Posted: Friday Jun 29th, 2012 at 3:54 pm #17883

Ok, SOLVE IT.

This was the solution :S …

If i change the “DESCRIPTION” of the product in the section of the CLICKBANK BUTTON CREATION,
the hack wouldn´t work…

So, i created now buttons without changing the descriptions o pricing details.

Thanks for your help, and sorry for the trouble.

Posted: Saturday Jun 30th, 2012 at 6:14 am #17931

I see. The hack worked for me with the custom descriptions you wrote. I’m sorry I didn’t think of trying that.

I’m glad you figured out what was happening in your site. Thanks for the update. :)

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