Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Manu Claessens 23 posts 63 karma points
    Nov 17, 2013 @ 21:39
    Manu Claessens
    0

    Only allow user to create a certain doctype once

    Hi guys,This might be a stupid question, but I would like to limit my users to only create a certain documenttype once.More specifically, I have a documenttype 'NewsArea', and viewing it doesn't make sense to have two news areas in one website, I would like to disable the creation of a second NewsArea to make it 'idiot-proof'.Any tips on how to make this happen?Kind regards,Manu

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Nov 17, 2013 @ 21:48
  • Manu Claessens 23 posts 63 karma points
    Nov 17, 2013 @ 21:58
    Manu Claessens
    0

    Hey Dennis,

    Big thanks for your quick reply, highly appreciated.

    Unfortunately, it's not exactly what I'm looking for. Although I do understand from this topic that my solution won't be available 'out-of-the-box'.

    Therefore, my current thinking is that I would need to create some coding to follow below reasoning:

    1) User creates doctype 'NewsArea'

    2) Code checks if a doctype with 'NewsArea' already exists

    3A) If it already exists, popup appears telling user that he/she can only create one NewsArea

    3B) If doesn't exist already, then there is no problem and a new NewsArea will be created

     

    Any idea on how I can tackle the above via code ?

     

    Thanks!

    Manu

  • Mike Chambers 636 posts 1253 karma points c-trib
    Nov 18, 2013 @ 10:26
    Mike Chambers
    0

    http://our.umbraco.org/wiki/reference/api-cheatsheet/attaching-document-event-handlers

    and 

    http://our.umbraco.org/wiki/reference/api-cheatsheet has a section - Using ApplicationBase to register events

    Should allow you to hook into the before_save or publish or where ever your logic needs.. (eg you might want the user to be able to create multiple.. but only have one published at a time as an alternative)

Please Sign in or register to post replies

Write your reply to:

Draft