In the Admin portion - you are given options for the three typical email generated responses. Where would I start to add other functionality such as a "Welcome to after a user registers? Jody
Engine\Framework\Notify\Components\NotifyUtility is what performs the email generation and sending now. the code would be added to the FormatEmail and SendNotifications methods you would then need to add NotifyUtility.SendNotifications to the end of the registration
code process as well as add your email to the Community_Messages table. There may be more, I just glanced at this, but it should get you started at least.
Here is my mod for adding this functionality to the registration process: this is the VSCS version - I am sure the VB port would be painless. Tested on my own site - using Lotus Domino R5 as my mail server. I used the password reminder control as the template
for this with very minor modifications. It could be easily used in other areas of the site as well... You will also need to have the following: alias email with username of welcome@ configured in whatever email package you are using. DB actions: add to Community_Message
a new row for each community in use Message_ID - whatever the next sequential number is Message_Community - community_id to have it applied to Message_Name - Welcome Message_Title - Welcome Message_Description - Sends email to newly registered member Message
Body - "Dear " or something so it will not be NULL Go into the admin - Edit Messages and you will see "Welcome" in the drop down. Edit to your liking. Now replace: ...engine/framework/users/register.cs replace with the following: ********* //Note: The only
real addition to the register.cs is between //Success and the redirect after login statement - but I included the whole .cs file for simplification. ********* namespace ASPNET.StarterKit.Communities { using System; using System.Web.UI; using System.Web.UI.WebControls;
using ASPNET.StarterKit.Communities; using System.Web.Security; //********************************************************************* // // Register Class // // Represents the Register page. The Register page enables // new users to register for a community.
// //********************************************************************* public class Register : SkinnedCommunityControl { string _skinFileName = "Users_Register.ascx"; RegisterForm ctlRegisterForm; Panel pnlInvalidUsername; Panel pnlInvalidEmail; Button
btnRegister; //********************************************************************* // // Register Constructor // // Calls the base SkinnedCommunityControl constructor // and assigns the default page skin. // //*********************************************************************
public Register() : base() { // Assign a default skin file name if (SkinFileName == null) SkinFileName = _skinFileName; } //********************************************************************* // // SkinType Property // // Specifies the skins directory where
this page's skin file is located. // //********************************************************************* override protected string SkinType { get { return "ContentSkins"; } } //********************************************************************* // //
InitializeSkin Method // // Retrieves all the controls from the Page Skin // //********************************************************************* override protected void InitializeSkin(Control skin) { Page.SmartNavigation = false; // Find the Register Form
control ctlRegisterForm = (RegisterForm)GetControl(skin, "ctlRegisterForm"); // Find the Invalid Username Panel pnlInvalidUsername = (Panel)GetControl(skin, "pnlInvalidUsername"); pnlInvalidUsername.Visible = false; // Find the Invalid Email Panel pnlInvalidEmail
= (Panel)GetControl(skin, "pnlInvalidEmail"); pnlInvalidEmail.Visible = false; // Find Register Button btnRegister = (Button)GetControl(skin, "btnRegister"); btnRegister.Click += new EventHandler(btnRegister_Click); } //*********************************************************************
// // btnRegister_Click Method // // If no validation errors, registers user as a new user. // //********************************************************************* void btnRegister_Click(Object s, EventArgs e) { if (Page.IsValid) { ProfileInfo objProfile
= new ProfileInfo(); objProfile.Username = ctlRegisterForm.Username; objProfile.Password = ctlRegisterForm.Password; objProfile.Email = ctlRegisterForm.Email; objProfile.FirstName = ctlRegisterForm.FirstName; objProfile.LastName = ctlRegisterForm.LastName;
objProfile.Timezone = ctlRegisterForm.Timezone; objProfile.Occupation = ctlRegisterForm.Occupation; objProfile.Location = ctlRegisterForm.Location; objProfile.Interests = ctlRegisterForm.Interests; objProfile.MSN = ctlRegisterForm.MSN; objProfile.Yahoo = ctlRegisterForm.Yahoo;
objProfile.AIM = ctlRegisterForm.AIM; objProfile.ICQ = ctlRegisterForm.ICQ; objProfile.Url = ctlRegisterForm.Url; objProfile.FakeEmail = ctlRegisterForm.FakeEmail; objProfile.EnableNewsletter = ctlRegisterForm.EnableNewsletter; objProfile.EnableNotifications
= ctlRegisterForm.EnableNotifications; int result = UserUtility.RegisterUser(objProfile); // success! if (result > 0) { if (Page.IsValid) { ProfileInfo _profileInfo = UserUtility.GetProfileFromEmail(objProfile.Email); if (_profileInfo == null) { pnlInvalidEmail.Visible
= true; return; } else pnlInvalidEmail.Visible = false; // Get the reminder message MessageInfo reminderEmail = MessageUtility.GetMessage("Welcome"); // Send formatted email EmailUtility.SendFormattedEmail ( String.Format("welcome@{0}", CommunityGlobals.PrimaryDomain),
reminderEmail, _profileInfo, CommunityGlobals.SmtpServer ); } // pnlForm.Visible = false; // pnlSent.Visible = true; FormsAuthentication.RedirectFromLoginPage(objProfile.Username, false); } // Display error switch ( result ) { case -1: // Username already
taken pnlInvalidUsername.Visible = true; pnlInvalidEmail.Visible = false; break; case -2: // Email address already taken pnlInvalidEmail.Visible = true; pnlInvalidUsername.Visible = false; break; } } } } }
I zipped up the cs file and the mod I made to the ComunityMaintence_Messages sp - so that creation of new communities would include the welcome message feature - available here: I haven't bothered with a insert script to auto-populate it - if anyone comes up
with one then post here... http://wbcb.com/TechTips/CSK1/601.aspx Thanks
jodywbcb
Contributor
4482 Points
985 Posts
Edit Messages Section
Aug 14, 2003 07:46 PM|LINK
My Blogs on .Net 2.0 and Ajax
http://csk.wbcb.com
http://ArtbyJody.com
kanati
Member
705 Points
141 Posts
Re: Edit Messages Section
Aug 14, 2003 08:15 PM|LINK
jodywbcb
Contributor
4482 Points
985 Posts
Re: Edit Messages Section
Aug 14, 2003 10:05 PM|LINK
My Blogs on .Net 2.0 and Ajax
http://csk.wbcb.com
http://ArtbyJody.com
jodywbcb
Contributor
4482 Points
985 Posts
Re: Edit Messages Section
Aug 14, 2003 10:06 PM|LINK
My Blogs on .Net 2.0 and Ajax
http://csk.wbcb.com
http://ArtbyJody.com
jodywbcb
Contributor
4482 Points
985 Posts
Re: Edit Messages Section
Aug 14, 2003 11:17 PM|LINK
My Blogs on .Net 2.0 and Ajax
http://csk.wbcb.com
http://ArtbyJody.com