Remove Add New Event (Calendar) if group is not allowed

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • evoir
    Senior Member
    • Apr 2000
    • 425

    Remove Add New Event (Calendar) if group is not allowed

    Hi, I've spent a bunch of time creating a dozen calendars, and assigning my dozen groups to the appropriate calendars. No one except admins has the authority to add events to the calendar, but, that option still shows to all. Is there a way to remove this to reflect the usergroup one is logged in as? Make sense? I'd rather not have visitors click it and get an error message. Would rather the link only show up to usergroups who are assigned to be able to add calendar events. IS there a way to do this?
  • Jake Bunce
    Senior Member
    • Dec 2000
    • 46598
    • 3.6.x

    #2
    That is the normal behavior. You can hide it by using template conditionals. For example:

    Admin CP -> Styles & Templates -> Style Manager -> « » -> Calendar Templates -> CALENDAR

    Add the red code:

    Code:
    		<if condition="$show['popups']">
    			<td class="vbmenu_control"><a href="calendar.php?$session[sessionurl]c=$calendarinfo[calendarid]&amp;month=$today[mon]&amp;year=$today[year]">$vbphrase[show_today]</a></td>
    			<td class="vbmenu_control" id="cal_mode">
    				<if condition="$show['weeklyview']">
    					<a href="$show[nojs_link]#goto_viewtype">$vbphrase[weekly_view]</a>
    				</if>
    				<if condition="$show['monthlyview']">
    					<a href="$show[nojs_link]#goto_viewtype">$vbphrase[monthly_view]</a>
    				</if>
    				<if condition="$show['yearlyview']">
    					<a href="$show[nojs_link]#goto_viewtype">$vbphrase[yearly_view]</a>
    				</if>
    				<script type="text/javascript"> vbmenu_register("cal_mode"); </script>		
    			</td>
    			[color=red]<if condition="$bbuserinfo[usergroupid] == 6">[/color]
    			<td class="vbmenu_control" id="add_event"><a href="#goto_newevent">$vbphrase[add_new_event]</a> <script type="text/javascript"> vbmenu_register("add_event"); </script></td>
    			[color=red]</if>[/color]
    		</if>
    		
    	</tr>
    	</table>
    	
    	<if condition="!$show['popups']">
    	<a name="goto_viewtype"></a>
    	<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center" style="border-top-width:0x">
    	<tr align="center">
    Now the "add event" menu will only show for admins.

    Comment

    • evoir
      Senior Member
      • Apr 2000
      • 425

      #3
      Thanks. I'll give it a try.

      Comment

      • Greek Wizard
        New Member
        • Nov 2001
        • 17

        #4
        I would like to bump this up.

        The addition above works fine for removing the link to add a new event on the top, but how can i make the box on the bottom that has the same links, only visible to members or certain user groups as well?

        Also instead of

        Code:
        <if condition="$bbuserinfo[usergroupid] == 6">
        Can I add

        Code:
        <if condition="in_array($bbuserinfo[usergroupid], array(5,6))">
        so that the Super mods can only see it as well?

        Thanks
        Last edited by Greek Wizard; Thu 30 Nov '06, 4:52am.

        Comment

        • Greek Wizard
          New Member
          • Nov 2001
          • 17

          #5
          Never mind,

          I figured it out, I was looking in the wrong spot.

          For those interested, calendar_monthly, etc were the places to make the conditionals.

          Comment

          widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
          Working...
          😀
          😂
          🥰
          😘
          🤢
          😎
          😞
          😡
          👍
          👎