Revise Users taking advantage of Workflows


Now that we have Workflows, we could get rid of the RegisytrationSettings.NotificationsRecipients settings, allowing the user to completely configure what should happen upon user registration using a workflow (of course we could run a recipe creating a default workflow from the Users settings page).

Essentially redactoring the following code (from Orchard.Users.MembershipService):
if ( registrationSettings != null  && registrationSettings.UsersAreModerated && registrationSettings.NotifyModeration && !createUserParams.IsApproved ) {
                var usernames = String.IsNullOrWhiteSpace(registrationSettings.NotificationsRecipients)
                                    ? new string[0]
                                    : registrationSettings.NotificationsRecipients.Split(new[] {',', ' '}, StringSplitOptions.RemoveEmptyEntries);

                foreach ( var userName in usernames ) {
                    if (String.IsNullOrWhiteSpace(userName)) {
                    var recipient = GetUser(userName);
                    if (recipient != null)
                        _messageManager.Send(recipient.ContentItem.Record, MessageTypes.Moderation, "email" , new Dictionary<string, string> { { "UserName", createUserParams.Username}, { "Email" , createUserParams.Email } });
With just a Workflow invocation, triggering an event (or even doing so from a IUserEventHandler implementation).

The beauty of having Workflows is that we can now replacing all hardcoded flows (where it makes sense) with configurable ones.


Piedone wrote Nov 22, 2013 at 12:22 PM

Second that! We could just have a UserRegistered event or something (or even possibly have a Workflows event for every IUserEventHandler event).

justrhysism wrote Feb 3, 2014 at 12:28 AM

I agree, so long there is a default as part of the initial Orchard recipe.

sebastienros wrote Oct 9, 2014 at 8:37 PM

Right now the solution is to create your own workflow, as all the pieces are available.