Module that can specify event categories

  • paulkenna
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
13 years 7 months ago #5054 by paulkenna
Module that can specify event categories was created by paulkenna
On my site we offer "events" and "trainings"

I can have multiple menu items that are restricted by categories. I'd like to have a module on the right hand side of the trainings showing only upcoming trainings, on the right side of the events showing only upcoming events and elsewhere on the site showing all categories.

My website is www.skillshare.com.au

Looking at the code of the module it looks quite possible to hack but it would be best to have a proper module backend with a selector of the appropriate categories built in.

Regards

Paul Kenna
skillshare.com.au

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

  • paulkenna
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
13 years 6 months ago #5151 by paulkenna
Replied by paulkenna on topic Re: Module that can specify event categories
I've managed to hack the existing module to achieve what I needed

Basically I modified the sql statement in mod_eb_events.php to the following:

$sql = 'SELECT a.id, a.title, a.event_date, a.category_id, b.name AS category_name FROM #__eb_events AS a LEFT JOIN #__eb_categories AS b ON a.category_id = b.id WHERE b.id=2 AND a.published=1 AND event_date >= NOW() AND (cut_off_date = "'.$db->getNullDate().'" OR cut_off_date >= NOW()) ORDER BY event_date LIMIT '.$numberEvents;



The change is the "WHERE b.id=2 AND" to attempt to limit the category to the second category of the 5 categories that I had set up.

Now this is a pretty ugly way of doing this and I have little understanding of SQL or PHP but I have been able to set up a number of different modules depending on the category I hard code into it.

If this is the first time you have tried this and you wish to maintain the original module you will have to rename the module, amend all the file names in the module and then zip it up and upload it in the normal way.

regards

Paul Kenna
Melbourne

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

Moderators: Tuan Pham Ngoc