Looking at the code a bit now, I see that you could have used the filter ws_plugin__s2member_before_register_link_gen
in a hack to set the $shrink'
variable to FALSE
, and s2 wouldn’t shorten the URL. See: c_ws_plugin__s2member_register_access::register_link_gen
in s2member\src\includes\classes\register-access.inc.php
public static function register_link_gen($subscr_gateway = '', $subscr_id = '', $custom = '', $item_number = '', $shrink = TRUE)
{
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
do_action('ws_plugin__s2member_before_register_link_gen', get_defined_vars());
unset($__refs, $__v);
if($subscr_gateway && is_string($subscr_gateway) && $subscr_id && is_string($subscr_id) && $custom && is_string($custom) && $item_number && (is_string($item_number) || is_numeric($item_number)))
{
$register = c_ws_plugin__s2member_utils_encryption::encrypt('subscr_gateway_subscr_id_custom_item_number_time:.:|:.:'.$subscr_gateway.':.:|:.:'.$subscr_id.':.:|:.:'.$custom.':.:|:.:'.$item_number.':.:|:.:'.strtotime('now'));
$register_link = home_url('/?s2member_register='.urlencode($register)); // Generate long URL/link.
if($shrink && ($shorter_url = c_ws_plugin__s2member_utils_urls::shorten($register_link)))
$register_link = $shorter_url.'#'.$_SERVER['HTTP_HOST'];
}
return apply_filters('ws_plugin__s2member_register_link_gen', ((!empty($register_link)) ? $register_link : FALSE), get_defined_vars());
}
s2Member has been improved with the years, and Jason made it more secure whenever possible. The length of that link may be one example of that. That’s why Jason always used a URL shortener instead of compromising this.
My preferred choice, if I were in your position, since you’re already hacking s2, I’d use my own URL shortener. https://yourls.org/#API
After setting $shrink to false with the above filter, then I’d use the filter ws_plugin__s2member_register_link_gen
to shorten $register_link
with my own shortener (e.g. YOURLS).
Funny enough, hacking this was my first customization when I started using s2Member, just before starting to give support… The old hack doesn’t work with the current version, though. https://www.primothemes.com/forums/viewtopic.php%3Ff=4&t=1636.html
s2Member used to allow a custom shortening service before. Not sure when or why Jason removed it. I’ll look into it and probably bring it back, including the option to not shorten.