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.

Free Registration only works once

Home Forums Community Forum Free Registration only works once

This topic contains 3 replies, has 3 voices. Last updated by  Jason (Lead Developer) 4 years, 10 months ago.

Topic Author Topic
Posted: Friday Feb 17th, 2012 at 11:54 am #5498

I implemented free registrations for levels 1 and 2 of my site using the code below.

add_action("init", "register_level");
   function register_level(){
       if(isset($_GET["register_level"])){
           if ($_GET["register_level"]== 1) {
               $link = c_ws_plugin__s2member_register_access::register_link_gen ("none", "-", $_SERVER["HTTP_HOST"], $_GET["register_level"], false);
               wp_redirect($link); exit();
           }    
           if ($_GET["register_level"]== 2) {
               $link = c_ws_plugin__s2member_register_access::register_link_gen ("none", "-", $_SERVER["HTTP_HOST"], $_GET["register_level"], false);
               wp_redirect($link); exit();
           }    
       }
   } 

But I find I can only register once. That is when I visit the site (even for a separate computer) and try to use the free registration link I get the “Link Expired:Please contact Support if you need assistance.” message. However, I found it’s not related to the tinurl or goo.gl.

I search the code and found the message is being generated from the register-in.inc.php file and is detected by the conditional on line 61

if (($reg_cookies = c_ws_plugin__s2member_register_access::reg_cookies_ok ()) /*&& extract ($reg_cookies)*/ /* Needed? */)

Furthermore I found there is a piece of metadata that seems to be involved. Specifically after the first free registration, the metavalue wp_s2member_subscr_id is created with a value of ‘-‘. If I delete this meta value then I can register again, but as long at it is there, then I can’t.

The meta value is associated with user id 45 which is the id of the prior user that registered free. I guess this value is stored in a cookie somewhere and that may be the related of the problem. Then again even if I go to a different computer where there should be no cookies, it still happens.

Here is the URL causing the problem.

https://greaterebiz-vps-server1.com/aftercareers.com/?s2member_register=fnIyOlZVNnpybmgxN3ZjM1F3ZXNyN1NuNHpwZ0RGOUg4QlNNOjBjNDllOWY4ZDkzMzUzZGQ2NWRkZjhhZTRjMWNmNTZmfNCtHIEApevnYoopNE8q_cwYuyh6jPtCZwdAdYLUNnYRavcNaxuxCklvM2GxAv-j91e4KC8tzRWQZSayfpEueI0THcZJS1S6R82zlYIDfGNfIP6VzC97SlQSzmKgZWb8TvPhYofSgqpCnrim10C4cwI0LdaEIuWA1_OIGUX5O41fJ-bDptZoFeRlPHqlU4VHT5h_2dMLICmOGaVKpNxdFZs

Thanks,
David D.

List Of Topic Replies

Viewing 3 replies - 1 through 3 (of 3 total)
Author Replies
Author Replies
Posted: Friday Feb 17th, 2012 at 12:35 pm #5510
Eduan
Username: Eduan
Moderator

Have you tried using pro-forms to offer the free registration at paid levels?

I invite you to look at this KBA (Knowledge Base Article) for more info on how to do this:
Offering Paid Member Registration for Free, Using Pro-Forms

Hope this helps. :)

Posted: Monday Feb 20th, 2012 at 4:50 pm #5725
Staff Member

Hi there. Thanks for the heads up on this thread.
In your PHP, set the Paid Subscr. ID to a unique value each time you generate a link please. s2Member will only allow each Paid Subscr. ID to register one time (this is security against duplicate registrations from the same customer). See also: http://php.net/manual/en/function.uniqid.php

$link = c_ws_plugin__s2member_register_access::register_link_gen ("none", uniqid(), $_SERVER["HTTP_HOST"], $_GET["register_level"], false);
Posted: Monday Feb 20th, 2012 at 4:51 pm #5726
Staff Member
See also, docs on that class method you’re using here.
Viewing 3 replies - 1 through 3 (of 3 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.