New in XMod Pro
Free Module Kits
XMod Pro Addons
Browse it all or refine your selection using the filters below on the left.
By: Patrick Ryan
Link to this Article
XMod Pro is a development tool and like many development tools, you sometimes run into a seemingly insurmountable barrier - a problem you don't think the tool can solve. So, you devise a workaround and move on. After several days or maybe even months, you come back to the problem and discover the answer was staring you in the face the whole time. I just had one of those A-HA! moments.
In my case, I simply didn't think it was possible to automatically login a user to my DNN site immediately after registration using XMod Pro. Turns out, I was wrong. And the beauty is that the solution is remarkably logical, simple, and straightforward.
To register a new user in DNN using XMod Pro, you use the <AddUser> action. To log a user into the DNN site, you use XMod Pro's <Login> action.
The great thing about Actions is that they are executed in the order in which they are used within your form. That means if <AddUser> is defined in your form before the <Login> action, it will be executed before the <Login> action. That means you can use the same username and password information the user just entered to log the user in. If the <AddUser> action was successful, the user will be registered and will be logged in.
See how easy this really is?
<Label class="xmp-form-label"> </Label>
<AddButton Text="Add" Redirect="." RedirectMethod="GET"> </AddButton>
<AddUser Email='[[Email]]' Username='[[Username]]' Password='[[Password]]'
FirstName='[[Firstname]]' LastName='[[Lastname]]' Approved="true"
RoleNames="Registered Users"> </AddUser>
<Login Password='[[Password]]' RememberMe="True" Username='[[Username]]' />
In the code example, I added a redirect back to the same page for testing. It shows the user signed in and authenticated.
That's all there is to it. Enjoy!