We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

Restrict users from deleting events | Forum

Graham
Graham Mar 17 '13
Hi 


Please could you point my in the direction where and what to change in the code so that only admins can see the delete button in events.

Version 1.5.1


Many thanks

Graham

Purusothaman Ramanujam
ow_plugins\event\controllers\base.php is the file and below is the place you have play with.

This is for both edit and delete. So be careful to modify the code.

The other way is to edit the base_view.html to remove the delete link.
       
if ( OW::getUser()->isAuthorized('event') || OW::getUser()->getId() == $event->getUserId() )
        {
            $this->assign('editArray', array(
                'edit' => array('url' => OW::getRouter()->urlForRoute('event.edit', array('eventId' => $event->getId())), 'label' => OW::getLanguage()->text('event', 'edit_button_label')),
                'delete' =>
                array(
                    'url' => OW::getRouter()->urlForRoute('event.delete', array('eventId' => $event->getId())),
                    'label' => OW::getLanguage()->text('event', 'delete_button_label'),
                    'confirmMessage' => OW::getLanguage()->text('event', 'delete_confirm_message')
                ),
                )
            );
        }
Alia Team
Alia Mar 17 '13
Topic was moved from General Questions.
Graham
Graham Mar 18 '13
thanks for a quick response :)
Graham
Graham Mar 19 '13
I have deleted the line


 <li><a href="{$editArray.delete.url}" class="ow_mild_red" onclick="return confirm('{$editArray.delete.confirmMessage}');">{$editArray.delete.label}</a></li>
from the base_view.html file but the delete button still shows, any ideas?

Purusothaman Ramanujam
Refresh the cache.. by enabling DEV mode in config.php file
Graham
Graham Mar 20 '13
That fixed it, thanks for your help
Purusothaman Ramanujam
Welcome.