Membership registration not working (bug)

Hi There,

I'm having trouble to get the registration page up and running. This is the message I get after filling in the fields:

Notice: Undefined variable: user_id in .../plugins/membership/membershipincludes/classes/membershippublic.php on line 1710

Can you please take a look at it. Looks like a workaround has been implemented but this line uses $user_id which has not been defined in case of an error.

Thanx!

  • NorbyOnline
    • Flash Drive

    Hi Paul,

    Happy New Year!

    I think we have PHP5.3, according to the website of our hosting provider.

    Well, the line in question is not the workaround, it's the surrounding code. I'm a Front-end developer, not a PHP one, so I don't fully understand how it works.

    I think this code may cause the problem, which is right above line 1710:

    // Hack for now - eeek
    									$anyerrors = $error->get_error_code();
    									if(is_wp_error($error) && empty($anyerrors)) {
    										// No errors so far - error reporting check for final add user *note $error should always be an error object becuase we created it as such.
    										$user_id = wp_create_user( sanitize_user($_POST['signup_username']), $_POST['signup_password'], $_POST['signup_email'] );
    
    										if(is_wp_error($user_id) && method_exists($userid, 'get_error_message')) {
    											$error->add('userid', $userid->get_error_message());
    										} else {

    I think we end up in the else, leaving $user_id not an user but an error.

    FYI: We use multisite and buddypress and want to use some of your plugins.

    Kind regards,
    Martijn

  • NorbyOnline
    • Flash Drive

    Hi Tom,

    Looks like it works as long as WP can create a user, then you go to the next step. But if e.g. the e-mail address is already used the error occurs. This should of course result in a user friendly message near the form or fields but now you see the form again like nothing happened (unless debug is on).

    I hope you can fix this soon. When you do, could you also fix the notice that will be shown in debug after filling the form successfully:

    Notice: Undefined index: https in .../wp-content/plugins/membership/membershipincludes/classes/membershippublic.php on line 1689

    Thanx!
    Martijn

  • Barry
    • DEV MAN’s Mascot

    This bug is still in the beta. It's easy to reproduce, just use an e-mail address that is already registered. I don't get a message with the error.

    I have in testing with the latest beta and can't reproduce any of the warnings you have posted so far and I get a message with an error.

  • Barry
    • DEV MAN’s Mascot

    Note are you getting the same error message as before? Can you post the error messages you are getting again as I need the line numbers so I can have another quick look - the line numbers you posted before won't be the same after you upgraded to a different version as the files will be different.

  • tomshieh
    • New Recruit

    Respected Barry,

    I am also getting error on the registration page and below is the message I get after filling in the fields or register empty fields:

    Notice: Undefined variable: user_id in /home/sniperfo/public_html/wp-content/plugins/membership/membershipincludes/classes/membershippublic.php on line 1565

    You can also check on below link:
    http://sniperforex.com/register/?action=registeruser&subscription=21

    Looking forward for your great response.
    Thanks.

  • Barry
    • DEV MAN’s Mascot

    Ok, line 1565 of membershippublic.php for beta 4 is

    if(empty($_POST[$key])) {

    If you are getting the error you are above then that would suggest that the membershippublic.php file you have on your server isn't the latest one. Can you make sure that you have the most up to date version of the plugin. It may be best to delete the folder via FTP and then upload the new folder with FTP afterwards to make sure that all the files are replaced.

  • tomshieh
    • New Recruit

    Respected,

    After upgrading to beta version. I am getting below errors after registration.

    Notice: Undefined variable: sub in /home/sniperfo/public_html/wp-content/plugins/membership/membershipincludes/includes/payment.form.php on line 16

    Fatal error: Call to a member function sub_name() on a non-object in /home/sniperfo/public_html/wp-content/plugins/membership/membershipincludes/includes/payment.form.php on line 16

    then I see in payment.form.php file and compare with old one payment.form.php file,
    here I replace (on line 12):

    $coupon = membership_get_current_coupon();

    with

    $sub = new M_Subscription( $subscription );
    $coupon_code = membership_get_current_coupon();
    $pricing = $sub->get_pricingarray();

    if(!empty($pricing) && !empty($coupon_code) ) {
    $pricing = $sub->apply_coupon_pricing($coupon_code,$pricing);
    }

    After doing this,
    registration is working fine with subscription.

    My question is "is it good approach to resolve above errors?" or "will it create more errors in future?"

    Please guide me to best.
    Thanks.

  • NorbyOnline
    • Flash Drive

    Hi Guys,

    Sorry for this delayed reply. Fortunally, in the mean time there was a new version and it looks like my problem is fixed! Thanx!

    I see a second issue has been raised in this thread but I'm closing this topic anyway :slight_smile:
    @tomshieh: I've your problem remains after the latest update (3.4.3.1), please start a new topic.

    Martijn

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.