Proposal: User Tokens Refactoring + Minor enhancements

Topics: Core
Developer
Jul 7, 2013 at 12:13 PM
Edited Jul 7, 2013 at 12:15 PM
Currently, Orchard.Tokens has a UserTokens class providing tokens for the current user.

One minor improvement would be to move this to Orchard.Users.

And, what I think is still missing is a way to access UserPart proeprties for any content item (if that content item is in fact a user). Currently, the User tokens provide access properties for the current user, but what if you have code that creates a user, initiating a Content Created event, which is handled using a workflow. This workflow wants to send an email to this new user, but the user in context may be anonymous, or another user.

What may be nice is to refactor User tokens a bit so that it accesses the UserPart of the content item in context instead of the current user. We would then add a token called CurrentUser, which chains that user to the refactored User token.

A simple use case is a "User Created" workflow. I have a site where users can register themselves, but they are not automatically logged in after registering. Instead, I want to send them an email with a confirmation link. Right now, to access this user's email address, I have to implement my own token provider, accessing the UserPart of the created content item in context.
Dec 10, 2013 at 8:43 PM
So I am late to the game, but I fully agree. Ran into the same problem today with trying to do a "User Created" workflow. Did you do any work on this and have source code somewhere? If not, I will either have to implement my own or just approve every user that signs up. Thanks for any update you have.
Dec 11, 2013 at 3:02 AM
Quick update, I went ahead and added my own User tokens, very nice once those are in there.