On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • I've set up myCalendar on 2.6.5 and it seems to work fine except for one very glaring problem - the default behavior seems to be for *anyone* to be able to add an event. Clearly I don't want the general public doing this so is there a way of making it so only admin can add events, i.e be logged in to the back end and then click a date to add an event on a separate browser tab? Only admin should be able to add events. Very surprised this isn't default behavior. Anyone have any ideas? Thanks.

    I would also point out that I've tried the following options:

    &allowGuestEdit=`0` 
        &readOnly=`1`
    


    But this also stops admin from being able to add events! [ed. note: galahad5 last edited this post 3 months, 3 weeks ago.]
    • The easiest method is a simple utility snippet:

      Put this tag above the MyCalendar tag on the calendar page

      [[!AdminOnly]]


      Create this snippet:

      <?php
      /* AdminOnly snippet */
      
      if (! $modx->user->isMember('Administrator')) {
          return "Sorry, you're not authorized to see this page";
      }
      
      return '';


      Only members of the Administrator group will see the page. Others will see the "Sorry" message.
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
      • If you want the general public to still be able to see the calendar I believe contexts can help you. You could make a context, give the user group and admins fuller access while limiting anonymous group to read only.

        I haven't tested this though.
        • Quote from: BobRay at Feb 27, 2019, 06:03 PM
          The easiest method is a simple utility snippet:

          Put this tag above the MyCalendar tag on the calendar page

          [[!AdminOnly]]


          Create this snippet:

          <!--?php
          /* AdminOnly snippet */
          
          if (! $modx--->user->isMember('Administrator')) {
              return "Sorry, you're not authorized to see this page";
          }
          
          return '';


          Only members of the Administrator group will see the page. Others will see the "Sorry" message.

          Thanks, the problem though is that UI need the general public to see the calendar (and browse through it), I just don't want them being able to add events...?
          • I've decided to use mxCalendar instead- works differently but should do the job. Thanks for the replies, both smiley