Search code examples
sitecoresitecore6web-forms-for-marketers

Restricting parts of the Sitecore Web Forms for Marketers (WFFM) Wizard


What is the best way to restrict specific parts of the WFFM Insert Form Wizard?

Specifically, I would like to restrict certain users from creating forms from scratch and only offer them the ability to copy an existing form. Can I do this without code? Is there a setting buried somewhere that I'm not seeing?


Solution

  • I don't believe there is a setting or permission available to control what you're asking for.

    One approach you could try is to sub-class the Sitecore.Forms.Shell.UI.CreateFormWizard class (in the Sitecore.Forms.Core assembly). You would then override the OnLoad method, execute some logic to determine whether or not the current user should be able to create new forms via the wizard, then show/hide the radio button for creating a new form.

    Something like this:

    public class CreateFormWizardExtended : Sitecore.Forms.Shell.UI.CreateFormWizard
    {
        protected override void OnLoad(EventArgs e)
        {
            base.CreateBlankForm.Visible = Sitecore.Context.User.IsInRole("sitecore\\AllowedToCreateForms");
            base.OnLoad(e);
        }
    }
    

    You would then need to modify the CreateFormWizard xml control:

    /sitecore/shell/Applications/Modules/Web Forms For Marketers/CreateFormWizard.xml

    Change this line:

    <WizardForm CodeBeside="Sitecore.Forms.Shell.UI.CreateFormWizard, Sitecore.Forms.Core">
    

    to instead use the class you just created, like so:

    <WizardForm CodeBeside="MyNamespace.CreateFormWizardExtended, MyAssembly">
    

    I have not tested this approach, but in theory it should work.

    Hope this helps!