This project is read-only.

IShapeFactoryEvents Account Register action

Topics: Customizing Orchard, General
Apr 22, 2011 at 2:01 PM
Edited Apr 22, 2011 at 2:02 PM

Hi, When implementing IShapeFactoryEvents, and hitting the page /Users/Account/LogOn I get a ShapeType of "LogOn".

However when visiting /Users/Account/Register I don't seem to get a ShapeType that appears to indicate the Register page is loading, Eg :


    public class WhateverShapes : IShapeFactoryEvents
        public void Creating(ShapeCreatingContext context)

        public void Created(ShapeCreatedContext context)
            // Yep, get this one OK
            if (context.ShapeType == "LogOn")

            // Never seem to get one related to register
            if (context.ShapeType == "Register")



Any idea how I can render some custom content into the Register page ?

Am still on version 1.0.20



Apr 22, 2011 at 3:03 PM

Strange... both LogOn and Register generate shapes for their view results:


        public ActionResult LogOn() {
            if (_authenticationService.GetAuthenticatedUser() != null)
                return Redirect("~/");

            var shape = _orchardServices.New.LogOn().Title(T("Log On").Text);
            return new ShapeResult(this, shape); 

        public ActionResult Register() {
            // ensure users can register
            var registrationSettings = _orchardServices.WorkContext.CurrentSite.As<RegistrationSettingsPart>();
            if ( !registrationSettings.UsersCanRegister ) {
                return HttpNotFound();

            ViewData["PasswordLength"] = MinPasswordLength;

            var shape = _orchardServices.New.Register();
            return new ShapeResult(this, shape); 

So your code should work. Have you tried debugging and breakpointing the line where you add the wrapper to Register? One thing to watch out for is that if there's an error in your wrapper shape it could just silently not display.

Apr 22, 2011 at 3:17 PM

Ah, not in the AccountController for Orchard 1.0.20 . Darn.

Apr 22, 2011 at 3:22 PM

Ah, missed that :)  I think they're gradually moving towards everything being generated by shapes, but there are still some leftovers that use views.