Add the "Post new Event" to the view

miky_italy - February 4, 2009 - 11:57
Project:Event Views
Version:5.x-2.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

Like the Drupal Forum have the "Post new forum topic" link, it is good to have a "Post new Event" to the summary view.
For that purpose I just added this code to the event.module in the "function event_page" at line 301 :

  global $user;

then @ line 360 :

  $output .= '<ul>';
  if ($user->uid) {
    $output .= '<li>'. l(t('Post new Event.'), "node/add/event") .'</li>';
  } else {
    $output .= '<li>'. t('<a href="@login">Login</a> to post a new Event.', array('@login' => url('user/login', drupal_get_destination()))) .'</li>';
  }
  $output .= '</ul>';

It works well and ask to login in case user is anonymous just like the forum does ;)
Regards,
Michele

 
 

Drupal is a registered trademark of Dries Buytaert.