• Is it possible to disable the account creation in the first step of “Add advert”?

    We are using the WooCommerce Addon and it’s complaining in the checkout step: “An account is already registered with your email address”

    Already tried to remove the checkbox with the Custom Fields Addon but it’s still doing the registration in the background.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    if you remove the Account field using the Custom Fields then the registration code should be never run as it will not be possible to register a user.

    In other words, the only case when the user account will be created is if the form will send a _create_account = 1 variable.

    Maybe the account with selected email address already exists in the database and this is why you are seeing the error?

    Thread Starter captaincrispycrunch

    (@captaincrispycrunch)

    Good morning Greg,

    as described before, thanks to custom fields the _adverts_account field is sitting in the trash, as it can’t be fully deleted: Screenshots

    To be 100% sure I tripple checked in 3 different browser (Private/Incognito tab, empty cache, no plugins/addons) with random email addresses freshly generated.

    Still getting the “Account data” & “Set you password” mail after the first step and the “An account is already registered with your email address” notification in the checkout step in every browser.

    Edit#1: User creation happens after the 2nd step (Preview), User Role is “Subscriber”. I may have another guess…let’s check.

    Edit#2: No, it wasn’t the custom templates nor the contact form addon. The user and the add are getting created after the preview-step. The add is marked as “Cart Abondend” and the user receives the form fields/details from “Contact Person” and the “Subscriber” role.

    So it’s more a problem of the contact person being the same person creating the add. I guess there is now way around this?

    Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    the default fields (the Account is one of them) cannot be permanently deleted you can only trash them, but if the field is trashed it will not show in the form and the value will not be sent.

    With WPAdverts WC integration the account will be created if either the account checkbox is checked or the user is purchasing a package (as anonymous users cannot have packages).

    Right now to prevent it you can open file wpadverts-wc/wpadverts-wc.php and on line about 364, comment out or remove

    
    adverts_create_user_from_post_id( $post->ID, true );
    
    Thread Starter captaincrispycrunch

    (@captaincrispycrunch)

    Thank you Greg for the suggestion. I tried it with “adverts_create_user_from_post_id” commented out and it’s pretty close to what we intended.

    But now the user can’t see and manage his adds under “My account > Manage Ads”.
    (I guess it’s because the add is created without an author?)

    Our plan was to have the following order of events for new users:

    New Website Visitor clicks on “create add” >
    Fills out “Create Add” Form and clicks Preview >
    Preview is okay and clicks publish >
    Fills out Check Out Form and clicks Purchase >
    Success >
    Add is published >
    Account gets created from eMail & Data from Checkout >
    Receive eMail with password from WooC. >
    Receive eMail with Invoice from WooC.

    Maybe I’m missing something. Do you think this process can be realized?

    How about using “adverts_create_user_from_post_id” but then in between the steps “preview okay, clicks publish” and “Checkout form” logging the user in automatically?

    Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    if you restore the line adverts_create_user_from_post_id( $post->ID, true ); then you can additionally add in your theme functions.php file the code below

    
    add_filter( "adverts_create_user_from_post_id", "automatically_login_user", 50 );
    function automatically_login_user( $user_id ) {
        wp_clear_auth_cookie();
        wp_set_current_user ( $user_id );
        wp_set_auth_cookie  ( $user_id );
        return $user_id;
    }
    

    it will automatically login the user after creating an account for him.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Disable checkbox & account creation’ is closed to new replies.