How to suppress the Edit buttons for the list of Users Events (front end)

  • Judy Akers
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
5 years 2 months ago - 5 years 2 months ago #122282 by Judy Akers
I need to suppress on the front end, when listing events, the button for Edit.

I tried to create an override based on instructions here: eventbookingdoc.joomservices.com/develop...stomization-override

I did the following:
- created the override folder in the /components/com_eventbooking/helper directory and copied the acl.php file into it.
- created the class EventbookingHelperOverrideAcl extends EventbookingHelperAcl
- copied the code for public static function canEditEvent($event) and changed the return true to return false.

Saved and tested - but the Edit button still appears.

What am I missing? Is the acl.php file not able to be overridden? Where can I find the code to suppress showing the button?

Thank you for any help.
Last edit: 5 years 2 months ago by Judy Akers.

Please Log in or Create an account to join the conversation.

  • Judy Akers
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
5 years 2 months ago #122285 by Judy Akers
I realize this should be in Custom Overrides section. Moving it to www.joomdonation.com/forum/events-bookin...vents-front-end.html

Please Log in or Create an account to join the conversation.

  • Tuan Pham Ngoc
  • Away
  • Administrator
  • Administrator
More
5 years 2 months ago #122287 by Tuan Pham Ngoc
Hello Judy

Unfortunately, not all help methods can be overridden, and the one you are working on cannot.

I want to add why you want to remove that button? It's only shown to user with right permission (super admin and for event owner), so I don't think you have to remove it

Tuan

Please Log in or Create an account to join the conversation.

  • Judy Akers
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
5 years 2 months ago #122652 by Judy Akers
The administrator of the website prefers to keep the Event creation away from the event owners because of problems in the past.

As it turns out, I was able to suppress the Edit button with a template override in the /components/com_eventbooking/themes/default/events/default.php file. The override file is saved as template/{templatename}/html/com_eventbooking/events/default.php

Please Log in or Create an account to join the conversation.

  • Tuan Pham Ngoc
  • Away
  • Administrator
  • Administrator
More
5 years 2 months ago #122662 by Tuan Pham Ngoc
OK Judy. That's correct way. Maybe you can share your modified file here in case someone needs it?

Tuan

Please Log in or Create an account to join the conversation.

  • Judy Akers
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
5 years 2 months ago - 5 years 2 months ago #122679 by Judy Akers
Sure - It is a 1 line change (around line 67) to remove/comment out the following code to remove the Edit button from appearing on the “Your Events” (Users Events menu item) page for the event owner/coordinator:

<a class="btn" href="<?php echo JRoute::_('index.php?option=com_eventbooking&view=event&layout=form&id=' . $row->id . '&Itemid=' . $this->Itemid . '&return=' . $this->return); ?>"><i class="icon-pencil"></i><?php echo JText::_('EB_EDIT'); ?></a>

I am having problems uploading the file, so here is the full text.

<?php
/**
* @package Joomla
* @subpackage Event Booking
* @author Tuan Pham Ngoc
* @copyright Copyright (C) 2010 - 2019 Ossolution Team
* @license GNU/GPL, see LICENSE.php
*/

defined('_JEXEC') or die;

JHtml::_('formbehavior.chosen', 'select');
?>
<h1 class="eb-page-heading"><?php echo JText::_('EB_USER_EVENTS'); ?></h1>
<form method="post" name="adminForm" id="adminForm" action="<?php echo JRoute::_('index.php?option=com_eventbooking&view=events&Itemid='.$this->Itemid); ; ?>">
<div class="filters btn-toolbar clearfix mt-2 mb-2">
<?php echo $this->loadTemplate('search_bar'); ?>
</div>
<?php
if(count($this->items))
{
?>
<table class="table table-striped table-bordered table-considered">
<thead>
<tr>
<th>
<?php echo JText::_('EB_TITLE'); ?>
</th>
<th width="18%">
<?php echo JText::_('EB_CATEGORY'); ?>
</th>
<th class="center" width="10%">
<?php echo JText::_('EB_EVENT_DATE'); ?>
</th>
<th width="7%">
<?php echo JText::_('EB_NUMBER_REGISTRANTS'); ?>
</th>
<th width="5%" nowrap="nowrap">
<?php echo JText::_('EB_STATUS'); ?>
</th>
<th width="1%" nowrap="nowrap">
<?php echo JText::_('EB_ID'); ?>
</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="6">
<div class="pagination"><?php echo $this->pagination->getPagesLinks(); ?></div>
</td>
</tr>
</tfoot>
<tbody>
<?php
$k = 0;
for ($i=0, $n=count( $this->items ); $i < $n; $i++)
{
$row = $this->items[$i];
$link = JRoute::_(EventbookingHelperRoute::getEventRoute($row->id, 0, $this->Itemid));
?>
<tr class="<?php echo "row$k"; ?>">
<td>
<a href="<?php echo $link; ?>" target="_blank">
<?php echo $row->title ; ?>
</a>
<span class="pull-right">
/* <a class="btn" href="<?php echo JRoute::_('index.php?option=com_eventbooking&view=event&layout=form&id=' . $row->id . '&Itemid=' . $this->Itemid . '&return=' . $this->return); ?>"><i class="icon-pencil"></i><?php echo JText::_('EB_EDIT'); ?></a>
*/
<?php
if (EventbookingHelperAcl::canChangeEventStatus($row->id))
{
if ($row->published == 1)
{
$link = JRoute::_('index.php?option=com_eventbooking&task=event.unpublish&id=' . $row->id . '&Itemid=' . $this->Itemid . '&return=' . $this->return, false);
$text = JText::_('EB_UNPUBLISH');
$class = 'icon-unpublish';
}
else
{
$link = JRoute::_('index.php?option=com_eventbooking&task=event.publish&id=' . $row->id . '&Itemid=' . $this->Itemid . '&return=' . $this->return, false);
$text = JText::_('EB_PUBLISH');
$class = 'icon-publish';
}
?>
<a class="btn" href="<?php echo $link ; ?>"><i class="<?php echo $class;?>"></i><?php echo $text ; ?></a>
<?php
}
?>
</span>
</td>
<td>
<?php echo $row->category_name ; ?>
</td>
<td class="center">
<?php echo JHtml::_('date', $row->event_date, $this->config->date_format, null); ?>
</td>
<td class="center">
<?php echo (int) $row->total_registrants ; ?>
</td>
<td class="center">
<?php
if ($row->published)
{
echo JText::_('EB_PUBLISHED');
}
else
{
echo JText::_('EB_UNPUBLISHED');
}
?>
</td>
<td class="center">
<?php echo $row->id; ?>
</td>
</tr>
<?php
$k = 1 - $k;
}
?>
</tbody>
</table>
<?php
}
?>
</form>
Last edit: 5 years 2 months ago by Judy Akers.
The following user(s) said Thank You: Tuan Pham Ngoc

Please Log in or Create an account to join the conversation.

  • Tuan Pham Ngoc
  • Away
  • Administrator
  • Administrator
More
5 years 2 months ago #122682 by Tuan Pham Ngoc
Great. Thanks for sharing the code

Tuan

Please Log in or Create an account to join the conversation.

Moderators: Tuan Pham Ngoc