Email Notification for admin on New User Registration

This post has 17 Replies | 4 Followers

marty1101
Top 500 Contributor
Posts 61
Points 680
By: marty1101
Posted: Mon, Mar 3 2008 5:19 AM

Searching through the site, I found several thread but hoping to have easier a solution.

The 2007.1 site requires Admin approval upon new user registration.  When a new user registered, an email is sent to the user.  I want another email sent to the admin(or to selected moderators & administrators) as well.  The purpose is to quickly respond to a newly registered clients for the company, so they can call to help the client through the registration process.

I found where to add the codes in the SDK, but didn't want to change the source code and recompile the dlls.  While new to C#, I wonder if these's a way to add codes into the classes.  Pardon my poor programming skills.  Here's what I've come up with so far:

Add a file: App_code/Emails.cs

using CommunityServer.Components;
using CommunityServer.MailRoom.Components;
namespace CommunityServer.Components
{
    public class EmailType
    {
        // Added codes below

       public static readonly string NewUserAccountPendingForAdmin = "NewUserAccountPendingForAdmin";
    }
}

namespace CommunityServer.MailRoom.Components
{
    public class CommonEmails : CommonEmailsProvider
    {
        public override void UserAccountPending(User user)
        {
            if (user == null)
                return;
            User(EmailType.NewUserAccountPending, user, null);

            // Added codes below
            User admin = new User();
            admin.Username = "admin";
            User(MOD_EmailType.NewUserAccountPendingForAdmin, admin, null);
        }
    }
}

 

It turned out many errors.  I guess there're advanced ways to change how it is written.  Someone can help me on this?

I also suspect this kind of additions or modifications can be done without recompile.  If this could be done, the road ahead would look very bright for me. ^_^

It may look dumb, but I'm asking anyway.

 

 
Jeff Davis
Top 500 Contributor
Posts 93
Points 1,320
By: Jeff Davis
Posted: Mon, Mar 3 2008 8:26 PM In reply to

Marty,

I've developed a module that does this - was planning to post about it in this thread, but since you're looking for an answer now (and my post is a few days away as yet), I'll post it here - well, I'd like to post it here, but it seems like I can't attach anything to this post!?


Jeff Davis MBA Candidate, Class of 2008 The Fuqua School of Business, Duke University Profile: http://www.linkedin.com/in/jwdavis
 
Jeff Davis
Top 500 Contributor
Posts 93
Points 1,320
By: Jeff Davis
Posted: Mon, Mar 3 2008 9:16 PM In reply to

While waiting to find out how to upload the zip to this site, I've made it available for download (see link two posts down)...

Comments, questions, and suggestions are most appreciated.


Jeff Davis MBA Candidate, Class of 2008 The Fuqua School of Business, Duke University Profile: http://www.linkedin.com/in/jwdavis
 
  • Post Points: 20 |
marty1101
Top 500 Contributor
Posts 61
Points 680
By: marty1101
Posted: Tue, Mar 4 2008 1:40 AM In reply to

Thank you, jdc.

I just followed your instructions and something I'd like to let you know:

1. The email is sent from emailTarget to emailSource

2. The email content is

catchall (catchall@asdf.com) registered at 2008/3/4/ 02:14pm and is awaiting your approval.Approve User: http://localhost:1973/controlPanel/Membership/UserEdit.aspx?UserID=2107All pending users: http://localhost:1973/controlpanel/Membership/MemberSearch.aspx?tab=SearchMembers&s=0

THe first linke doesn't work because the link URL includes "All" in the end.  but the 2nd works.

I'm going to try other things and check out the source.  Thank you very much for the work!!

 
  • Post Points: 20 |
Jeff Davis
Top 500 Contributor
Posts 93
Points 1,320
By: Jeff Davis
Posted: Tue, Mar 4 2008 2:02 AM In reply to

Marty,

Thanks for sanity checking this. It turns out in cleaning it up for public release (I stripped some site-specific stuff out) that I switched the email addresses.

As for the links - they worked fine in my email client, but I added an extra space after each URL which should hopefully eliminate the problem you're seeing. The links certainly work here.

Here's the new link for download. Let me know how it goes.

JeffDavis.CS.Modulesv1.1.zip (hosted on CS.org)


Jeff Davis MBA Candidate, Class of 2008 The Fuqua School of Business, Duke University Profile: http://www.linkedin.com/in/jwdavis
 
marty1101
Top 500 Contributor
Posts 61
Points 680
By: marty1101
Posted: Tue, Mar 4 2008 4:26 AM In reply to

The zip file can't be unziped.  The size is 35476 after download.

I use Outlook 2003.

I just started to find out how to build app on top of CS.  It seems to me that changing the out-of-the-box behaviors requires building CSModules.  However, I can add or change aspx and other files to create new features just like writing asp.net 2.0 applications under VS2005. 

In some other posts, people say \App_Code is "not used" in CS.  What I'd like to learn is if I could write .cs or .vb in \App_Code.  If I put your *.cs under \App_Code, would it work with some modifications?  or it has to be the CSModules way?

It gives me a headache that how I could go about building applications on top of CS.  If changing behaviros of CS requires CSModules, I'd have to build a sln project and compile a DLL. (I am only familiar with the web project way, not the sln way).  Then open \web and move the dll into \bin to use and test if it works.  To be honest, I am really not familiar with how this can be done.  A few hints on the whole picture?

 

 
  • Post Points: 35 |
Jeff Davis
Top 500 Contributor
Posts 93
Points 1,320
By: Jeff Davis
Posted: Tue, Mar 4 2008 7:39 AM In reply to

Marty,


The ZIP file downloads and unzips fine for me (size = 25,977). I'll PM the file to you and see if that works. If anyone else tries to download, I'd appreciate an update on whether it works.

As for learning about expanding CS - I agree it can be challenging. I've spent many hours mucking around trying to figure things out - mostly because it's an interesting challenge. That said, it would be nice if I was able to find a good set of clear documentation on exactly what needs to be done.

Jeff Davis MBA Candidate, Class of 2008 The Fuqua School of Business, Duke University Profile: http://www.linkedin.com/in/jwdavis
 
  • Post Points: 35 |
Jeff Davis
Top 500 Contributor
Posts 93
Points 1,320
By: Jeff Davis
Posted: Tue, Mar 4 2008 7:54 AM In reply to

marty1101:
The zip file can't be unziped.  The size is 35476 after download.

Actually, I should thank you as this gave me a kick in the butt to solve another problem.

I've had problems on a couple of CS-sites with people finding corrupt ZIP archives when downloading via IE. Firefox works fine. After getting your email, I tested the link with Firefox and it worked fine; then I remembered, and tested with IE and it failed as you described.

This shows the problem isn't a CS problem.

Anyway, a Google search led me to http://ziprepairsoftware.blogspot.com/, which described the problem and how to resolve. A quick search here on CS.org shows that the issue has been discussed before - I just hadn't bothered yet to explore.

Anyway, all that is to say that after changing the MIME type for ZIP archives, my IIS site with compression now downloads ZIP files just fine to IE clients. So, try downloading again!

JeffDavis.CS.Modulesv1.1




Jeff Davis MBA Candidate, Class of 2008 The Fuqua School of Business, Duke University Profile: http://www.linkedin.com/in/jwdavis
 
marty1101
Top 500 Contributor
Posts 61
Points 680
By: marty1101
Posted: Tue, Mar 4 2008 9:13 PM In reply to

Hello Jeff:

Thanks!  I got your email and the download zip works now.  The two links in the emails work. and the source & target email addresses are right.

 
  • Post Points: 5 |
ins3cure
Not Ranked
Posts 2
Points 40
By: ins3cure
Posted: Thu, Mar 6 2008 10:57 PM In reply to

Jeff,

Thank you for putting this module together it provides a very useful service to CS admins.  I was wondering if you know if a modification is possible that would trigger a message when a new account is created on a site where admin approval is disabled. 

I tried changing the useraccount status check to approved and then added a test to check the account creation date against the current date but did not get a notification message.

Thank you in advance
- Zack

 
  • Post Points: 20 |
Jeff Davis
Top 500 Contributor
Posts 93
Points 1,320
By: Jeff Davis
Posted: Thu, Mar 6 2008 11:21 PM In reply to

Zack - thanks for the kind words.

If I understand correctly, you want to get an email when an account is created - not when it is approved, is that correct?

If so, I can revise my module to handle that. In fact, perhaps I should revamp the module to handle all sorts of account creation scenarios. Won't be able to attend to it until next week, but will post as soon as I can.

In the meantime, if you're inclined to play with the source of the module yourself, it shouldn't be hard to tweak. Essentially, the module checks to see if an account was created, and if it was THEN it checks to see if it's pending approval. You could remove the second check and change the email text, and the module would do what you want.

Good luck!


Jeff Davis MBA Candidate, Class of 2008 The Fuqua School of Business, Duke University Profile: http://www.linkedin.com/in/jwdavis
 
ins3cure
Not Ranked
Posts 2
Points 40
By: ins3cure
Posted: Fri, Mar 7 2008 4:08 PM In reply to

Jeff,

Thank you for your response.


Your understanding of the functionality I described is correct and I would definitely enjoy taking a look at your approach to adding that functionality.

I agree this modification should be relatively straightforward and believe I have the code I need to complete the task but seem to be having some undetermined trouble compiling the project into a dll as none of the compiled files I've created (no errors or warnings) have produced any result when moved to the server.  As this is my first foray into .NET using Visual Studio I likely have a few simple issues to figure out before I get the hang of things.


Thanks again,

- Zack

 
  • Post Points: 20 |
Jeff Davis
Top 500 Contributor
Posts 93
Points 1,320
By: Jeff Davis
Posted: Tue, Mar 11 2008 1:56 AM In reply to

So I have a new release, that includes the following:

  • Will automatically subscribe new users to a list of forums (instead of just one)
  • Can be used to send emails for creation of accounts that require administrator approval or for all account creation
  • A new PokeSite task that can load a given URL on a regular basis (intended to keep sites active on shared hosting)

I did test it, but quickly - so be sure to thoroughly test before deploying in production environment. Email me with questions or bugs.

JeffDavis.CS.Modulesv1.15.zip (hosted at CS.org).


Jeff Davis MBA Candidate, Class of 2008 The Fuqua School of Business, Duke University Profile: http://www.linkedin.com/in/jwdavis
 
Arthur Dent
Not Ranked
Posts 35
Points 580
By: Arthur Dent
Posted: Tue, May 13 2008 6:20 PM In reply to

 Jeff, does this module work for CS 2008?  Thanks!

 

 
  • Post Points: 20 |
Jeff Davis
Top 500 Contributor
Posts 93
Points 1,320
By: Jeff Davis
Posted: Wed, May 14 2008 7:46 PM In reply to

Arthur Dent:

 Jeff, does this module work for CS 2008?  Thanks!

 

I haven't a clue! ;)

With the continuing license changes (and fee increases) I've decided not to keep up with the Jonses - I'll be sticking with CS 2007 (and one site with CS 2.1). Perhaps someone else can test it out and let us know (of course, I might get around to testing it when I get home in a few weeks).

In any case - Don't Panic!

Thanks,

Jeff

Jeff Davis MBA Candidate, Class of 2008 The Fuqua School of Business, Duke University Profile: http://www.linkedin.com/in/jwdavis
 
  • Post Points: 35 |
Page 1 of 2 (18 items) 1 2 Next > | RSS
Powered by Community Server (Commercial Edition), by Telligent Systems

Copyright© 2008 Telligent Systems Inc. All rights reserved
CommunityServer.com  •  Telligent.com