• Resolved Pistacho

    (@pistacho)


    I just upload the plugin so I can use the mail confirmation. When a user sign up the mail is send successfully, the problem is that the link that is send seems to not work.

    I call the link using the [confirmation-link] is there another way or need something else to do it?. is some website where I can see the full documentation?

    Thank you

    https://www.ads-software.com/plugins/front-end-only-users/

Viewing 15 replies - 1 through 15 (of 23 total)
  • Plugin Contributor etoilewebdesign

    (@etoilewebdesign)

    Hi Pistacho,

    Sorry to hear that you’re having difficulty.
    We’re putting together up to date documentation for the plug-in currently and are hoping to have that up very soon.

    So you are including the the shortcode “[confirmation-link]” inside the body of your e-mail? That should work. I think another user is having a similar problem so we’ll take a look at what might be happening and try to get back to you soon.

    Thread Starter Pistacho

    (@pistacho)

    Hi.

    I was looking in the sources files. I find that the problem was on the prepare_for_data_insertion file on the EWD_FEUP_Send_Email function.

    I made some modifications and it seem to work fine now, I hope this post help you to improve the plugin because is a really usefull and great plugin.

    Plugin Contributor etoilewebdesign

    (@etoilewebdesign)

    Hi Pistacho,

    Glad to hear you figured out a fix. Thanks for your input, we really appreciate it and are glad you like the plugin!

    If you would like to send a copy of your modifications to [email protected] we could take a look at it and possibly include it in a future version, so that other users can benefit from it.

    Is there any update on this issue?

    For me, when I visit the confirmation link in the email it just takes me to the registration page with all fields being blank. Am I supposed to fill it in again with the same user information? That doesn’t seem right.

    The registration form works, and is located here…
    https://bossgameworks.com/register/

    In the body of the email I used the following…
    [username], thanks for signing up!
    Please confirm your email address at the following link…
    [confirmation-link]

    The email that is sent has the following link in it…
    https://bossgameworks.com/register/?User_ID=0&ConfirmationCode=OmvcvhHG7s

    All that does is take me to the registration page, with all empty fields. There’s no notification that the email is now registered and if I try to log in with the same account at a log in page it says, “Login failed – you need to confirm your e-mail before you can log in”

    Thanks for any help regarding this issue.

    I have exactly the same problem. Confirmation shows up in the Email, but the link just takes me to a empty registration form.

    @pistacho: would you like to share your code with us, so we can quick fix it too? It would be awesome ??

    Thread Starter Pistacho

    (@pistacho)

    Sure. I made few changes. first of all on Prepare_Data_For_Insertion.php look for EWD_FEUP_Send_Email and there is a conditional which check if you want to use the confirmation link. The first change was to change the random string size to 5 because for some reason it didn’t work with 10.

    $ConfirmationCode = EWD_FEUP_RandomString(5);

    Then change the query to.

    $wpdb->query($wpdb->prepare(“UPDATE $ewd_feup_user_table_name SET User_Confirmation_Code='”.$ConfirmationCode.”‘ WHERE User_ID = “.$User_ID));

    So the confirmation code will only update to the user that is sign up.

    This works to me. The only problem that sometimes I have is that the DB sometimes don’t register the confirmation code correctly. So if someone could find why and help me to fix it I would be very thankful

    It was worth a try … XD

    The ConfCodeString looks like this now: ConfirmationCode=nsWE4

    But I recognized another error: For any user it shows up this:
    /?User_ID=0&ConfirmationCode=…

    The User ID is always 0 as its declared in the Header of the EWD_FEUP_Send_Email-method. I did some research an found the following line (96) in the same file inside the Add_Edit_User-method where this method is called:

    if ($Sign_Up_Email == "Yes") {EWD_FEUP_Send_Email($User_Fields, $Additional_Fields_Array);}

    Since I change it to
    if ($Sign_Up_Email == "Yes") {EWD_FEUP_Send_Email($User_Fields, $Additional_Fields_Array, %User_ID);}
    the User_ID in the Confirm-Link is correct.

    But the problem is still there. The Confirm Code in the Database is correct (the same as in the link), but loading the page doesn’t sets the field User_Email_Confirmed to yes.

    Searching goes on …

    Thread Starter Pistacho

    (@pistacho)

    are you sending the confirmation link to a page where you call the register form right?

    For example

    mydomain.com/register?/?User_ID=…&ConfirmationCode=…

    Yes, I think so,
    https://[…%5D.de/%5B…%5D/registrieren/?User_ID=9&ConfirmationCode=TP0Yn

    I just found another thing:
    In the file Insert_Register_Form.php on line 19 i found the following code:
    if (isset($_GET['ConfirmEmail'])) {ConfirmUserEmail();}

    I think this isset is false cause there is no ConfirmEmail in the Link.
    Because of this I set my Link to […]/registrieren/?ConfirmEmail=true&User_ID=9&ConfirmationCode=TP0Yn
    This seams to work. Almost. It brings the following result:
    The confirmation number provided was incorrect. Please contact the site administrator for assistance.

    positve:
    the registration form don’t shows up
    negative:
    the confirmation-code doesn’t match XD

    Iim going to try different things in ConfirmUsersEmail-function now. Maybe i’ll finde something.

    Thread Starter Pistacho

    (@pistacho)

    I suggest that verify on the db the confirmation code.

    When I changed this

    $wpdb->query($wpdb->prepare(“UPDATE $ewd_feup_user_table_name SET User_Confirmation_Code='”.$ConfirmationCode.”‘ WHERE User_ID = “.$User_ID));

    was because when it create a new user changed all the confirmation codes, but with that line it only change the user that is created. Also another problem is the one I told you before that the confirmation code doesn’t store correctly sometimes. If this is the case we are on the same issue

    In my Databese the Confiramtion Code is exactly the same as in the link. I have tested this allready

    So finaly. i made it work for me.

    I made a few changes in different Files.

    1. Give Send_Email-function the User_ID
    As written above the UserID is always 0. Got to File Prepare_Data_For_Insertion.php in line 96 should be this code:
    if ($Sign_Up_Email == "Yes") {EWD_FEUP_Send_Email($User_Fields, $Additional_Fields_Array);}
    change it to
    if ($Sign_Up_Email == "Yes") {EWD_FEUP_Send_Email($User_Fields, $Additional_Fields_Array, $User_ID);}

    2. Edit the Confirm Link

    This is necessary to get to the “Thanks for confirming”-message an not to the register form again.

    Same file (Prepare_Data_For_Insertion.php) in the function EWD_FEUP_Send_Email there scold be this this lines (145):

    if (strpos($PageLink, "?") !== false) {
    	$ConfirmationLink = $PageLink . "&User_ID=" . $User_ID . "&ConfirmationCode=" . $ConfirmationCode;
    }
    else {
    	$ConfirmationLink = $PageLink . "?User_ID=" . $User_ID . "&ConfirmationCode=" . $ConfirmationCode;
    }

    I changed it like this:

    if (strpos($PageLink, "?") !== false) {
    	$ConfirmationLink = $PageLink . "&ConfirmEmail=true&UserID=" . $User_ID . "&ConfirmationCode=" . $ConfirmationCode;
    }
    else {
    	$ConfirmationLink = $PageLink . "?ConfirmEmail=true&UserID=" . $User_ID . "&ConfirmationCode=" . $ConfirmationCode;
    }

    Explanation:
    In the file Insert_Register_Form i found this line:
    if (isset($_GET['ConfirmEmail'])) {ConfirmUserEmail();}
    It makes that the Confirm-thing is only done if there is a ConfirmEmail set in URL.

    This brings me to another solution:
    Simply change this line to:
    if (isset($_GET['ConfirmationCode'])) {ConfirmUserEmail();}
    This checks if there is a ConfirmationCode in the Link, so you don’t need a ConfirmEmail anymore. (not tested)

    3. Change select-wuery to set confirm status

    Got to the File Process_Front_End_Forms.php. On the End of this file is the function ConfirmUserEmail. On the beginning of this function there are these three lines:
    $User_ID = $_GET[‘UserID’];
    $Email_Address = $_GET[‘ConfirmEmail’];
    $Confirmation_Code = $_GET[‘ConfirmationCode’];`
    The names in the GETs should be exactly the same like in the URL (step 2).

    The next line should be this:
    $Retrieved_User_ID = $wpdb->get_row($wpdb->prepare("SELECT User_ID FROM $ewd_feup_user_table_name WHERE User_ID=%d AND User_Confirmation_Code=%s", $User_ID, $ConfirmationCode));
    change it to:
    $Retrieved_User_ID = $wpdb->get_row($wpdb->prepare(“SELECT User_ID FROM $ewd_feup_user_table_name WHERE User_ID=” . $User_ID . ” AND User_Confirmation_Code='” . $Confirmation_Code . “‘”));

    <em>Note for the Developers:</em>
    Most mistakes come because of different names of variables. Sometimes you’re using ConfirmationCode, sometimes Confirmation_Code. Maybe it would be nice idea to name the same thing always the same ??

    PS: Thanks to Pistacho for your help. For me it also works without changing $ConfirmationCode = EWD_FEUP_RandomString();.

    Thread Starter Pistacho

    (@pistacho)

    I’m glad to see that you can make it. ??

    @pistacho: Maybe step 3 is a hint for you. This made me solve the problem withe the “The confirmation number provided was incorrect. Please contact the site administrator for assistance.” message

    Hey, you guys really plugged away at this! Great work!

    However, I’m getting an error. ikf_tanzt, I did what you listed as your steps for getting it to work, but I would get the following error when I clicked on the confirm email link…

    Warning: Missing argument 2 for wpdb::prepare(), called in /homepages/42/d513815181/htdocs/bossgameworks/wp-content/plugins/front-end-only-users/Functions/Process_Front_End_Forms.php on line 251 and defined in /homepages/42/d513815181/htdocs/bossgameworks/wp-includes/wp-db.php on line 1152

    I tried a few different combinations of “userid” and “user_id” as it seems they go back and forth without reason. Or at least without reason to my unseasoned coding eye. I’m sure you guys are more on the ball about this stuff than me.

    For the steps you mentioned in the single post above, listing the 3 steps, does that take into account every change you made the to the original files? I’m thinking I’m missing something else, maybe from the earlier posts.

    Is it possible to post a link to your edited .php files so I can copy them and test that?

    Thanks for the help, it is much appreciated.

Viewing 15 replies - 1 through 15 (of 23 total)
  • The topic ‘Confirm Mail link broken’ is closed to new replies.