PriMoThemes — now s2Member® (official notice)
This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™
if ($shrink && ($tinyurl = ws_plugin__s2member_remote ('http://leenk.me/reg/yourls-api.php?signature=XXXXXXXX&action=shorturl&format=simple&url=' . rawurlencode ($register_link))))
if ($shrink && ($tinyurl = c_ws_plugin__s2member_utils_urls::remote ("http://tinyurl.com/api-create.php?url=" . rawurlencode ($register_link))))
if ($shrink && ($tinyurl = c_ws_plugin__s2member_utils_urls::remote ($shrink_service . rawurlencode ($register_link))))
if ($shrink && ($tinyurl = c_ws_plugin__s2member_utils_urls::shrink ($register_link)))
if ($shrink && ($tinyurl = c_ws_plugin__s2member_utils_urls::remote ('http://**********.com/go/yourls-api.php?signature=**********&action=shorturl&format=simple&keyword=register-' . time() . '&url=' . rawurlencode ($register_link))))
return apply_filters ("ws_plugin__s2member_register_link_gen", $tinyurl, get_defined_vars ());
<?php
add_filter ("ws_plugin__s2member_register_link_gen_alternative", "my_link_shortener");
add_filter ("ws_plugin__s2member_sp_access_link_gen_alternative", "my_link_shortener");
function my_link_shortener ($long_link) /* Raw link ( the long version ). */
{
return /* Shorten this */ $long_link;
}
?>
clavaque wrote:Great! That way we won't have to re-apply the hack after each s2Member update.
Is there any way I can get the ClickBank transaction receipt number in the s2hacks.php file for this?
<?php
add_filter ("ws_plugin__s2member_register_link_gen_alternative", "my_link_shortener");
add_filter ("ws_plugin__s2member_sp_access_link_gen_alternative", "my_link_shortener");
function my_link_shortener ($long_link) /* Raw link ( the long version ). */
{
if($_GET["s2member_paypal_proxy"] === "clickbank" && $_POST["txn_id"])
{ $clickbank_receipt_number = $_POST["txn_id"]; }
return /* Shorten this */ $long_link;
}
?>
// Shorten registration link.
add_filter('ws_plugin__s2member_register_link_gen_alternative', 's2_alt_shorten_link');
function s2_alt_shorten_link($link)
{
if ($_GET['s2member_paypal_proxy'] === 'clickbank')
{
return c_ws_plugin__s2member_utils_urls::remote('http://example.com/go/yourls-api.php?signature=xxxxxxxx&action=shorturl&format=simple&keyword=register-' . $_POST['txn_id'] . '&url=' . rawurlencode($link));
}
}
Yes, in the current release it is safe to assume this. I'd still check for it though, just in case something changes in a future release, it will help to safeguard your custom routine a bit.Is it safe to assume that after a ClickBank purchase $_POST['txn_id'] will always be set and with the receipt code?
// Shorten registration link.
add_filter('ws_plugin__s2member_register_link_gen_alternative', 's2_alt_shorten_link');
function s2_alt_shorten_link($link)
{
if ($_GET['s2member_paypal_proxy'] === 'clickbank')
{
$id = !empty($_POST['txn_id']) ?
$_POST['txn_id']
: !empty($_POST['payer_email']) ?
md5($_POST['payer_email'])
: !empty($_POST['subscr_id']) ?
$_POST['subscr_id']
: time();
return c_ws_plugin__s2member_utils_urls::remote('http://example.com/go/yourls-api.php?signature=xxxxxxxx&action=shorturl&format=simple&keyword=register-' . $id . '&url=' . rawurlencode($link));
}
}
$id = !empty($_POST['txn_id']) ?
$_POST['txn_id']
: !empty($_POST['payer_email']) ?
md5($_POST['payer_email'])
: !empty($_POST['subscr_id']) ?
$_POST['subscr_id']
: time();
It is recommended that you avoid "stacking" ternary expressions. PHP's behaviour when using more than one ternary operator within a single statement is non-obvious. See details here: http://php.net/manual/en/language.opera ... arison.php
// Shorten registration link.
add_filter('ws_plugin__s2member_register_link_gen_alternative', 's2_alt_shorten_link');
function s2_alt_shorten_link($link)
{
if ($_GET['s2member_paypal_proxy'] === 'clickbank')
{
$id = (!empty($_POST['txn_id']) ?
$_POST['txn_id']
: (!empty($_POST['payer_email']) ?
md5($_POST['payer_email'])
: (!empty($_POST['subscr_id']) ?
$_POST['subscr_id']
:
time()
)));
return c_ws_plugin__s2member_utils_urls::remote('http://example.com/go/yourls-api.php?signature=xxxxxxxx&action=shorturl&format=simple&keyword=register-' . $id . '&url=' . rawurlencode($link));
}
}
Users browsing this forum: No registered users and 0 guests