Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

How to disable / edit the "confirm your email address" inform message

Hi all, I have implemented a signup/signin feature outside of Vanilla (so that users only need to log in on the main website) and confirming their emails is handled by that also. As such, I need to edit (or replace) the message that appears in Vanilla prompting the user to confirm their email address as the link needs points to the main website, not Vanilla.

I can see that the message is created in DashboardHooks::Base_Render_Before and depends on an attribute EmailKey set against the user.

Should I simply delete this attribute, and then create a plugin which will display my own custom message, or is there a better way of doing it?

Many thanks

Best Answer

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP
    Answer ✓

    Have you tried just changing the definitions to edit the email content? Look inside locale en-CA definitions.php and copy the ones you want to edit to a custom new locale file

    $Definition['EmailConfirmEmail'] = 'You need to confirm your email address before you can continue. Please confirm your email address by clicking on the following link: {/entry/emailconfirm,exurl,domain}/{User.UserID,rawurlencode}/{EmailKey,rawurlencode}';
    $Definition['EmailWelcomeRegister'] = 'You have successfully registered for an account at {Title}. Here is your information:
    
      Username: {User.Name}
      Email: {User.Email}
    
    You can access the site at {/,exurl,domain}.';
    

Answers

  • Options
    hgtonighthgtonight ∞ · New Moderator

    You should be able to uncheck the "Require users to confirm their email addresses (recommended)" checkbox in http://forums.example.com/dashboard/settings/registration

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • Options

    I noticed that, but i still want the users to be restricted to what they can do, until they confirm their emails on the main website. Also, i still want a message to appear in vanilla reminding them, but customised to point to the main website.

    I've ended up doing this, but is it good practice?

    1. Deleting the EmailKey attribute after registering them via the main website - $UserModel->SaveAttribute($UserID, "EmailKey", NULL); thereby preventing Vanilla displaying it's own message.
    2. Creating a theme hook, which taps into the Initialize event in Vanilla, to display my own custom message, like so..
    class MyThemeHooks extends Gdn_Plugin {
    
        public function Base_Initialize_Handler($Sender) {
    
            if(Gdn::Session()->isValid()){
                $UserRoles = Gdn::UserModel()->GetRoles(Gdn::Session()->User->UserID);
                if(in_array(C('Garden.Registration.ConfirmEmailRole'), ConsolidateArrayValuesByKey($UserRoles->Result(), 'RoleID'))){
                    $Sender->InformMessage('Please confirm your email...', '');
                }
            }
    
        }
    }
    
  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP
    Answer ✓

    Have you tried just changing the definitions to edit the email content? Look inside locale en-CA definitions.php and copy the ones you want to edit to a custom new locale file

    $Definition['EmailConfirmEmail'] = 'You need to confirm your email address before you can continue. Please confirm your email address by clicking on the following link: {/entry/emailconfirm,exurl,domain}/{User.UserID,rawurlencode}/{EmailKey,rawurlencode}';
    $Definition['EmailWelcomeRegister'] = 'You have successfully registered for an account at {Title}. Here is your information:
    
      Username: {User.Name}
      Email: {User.Email}
    
    You can access the site at {/,exurl,domain}.';
    
Sign In or Register to comment.