Notice

The forum is in read only mode.

Support Forum

Welcome! Support Forums have been reactivated
Welcome the Technical Support section. Help us in assisting you by providing us with a concise and descriptive elaboration of your issues. Be specific and if possible, provide us with a step-by-step instruction in replicating your problem.

Events Module for displaying just selected Events categories

9 years 6 months ago
  • Karl's Avatar
    Topic Author
  • Karl
  • Offline
  • Fresh Boarder
  • Posts: 51
  • Thank you received: 1
Licenses:
JomSocial Expired Socialize Expired

Hi Michal,
as you suggested in Community I post here my question ;-)

Is there a way or solution for the Events Module to show upcomming Events by Category?
Example - I have more News Categories built with K2 at the website and I want to show for each K2 Category a seperate Events Module - here I created exactly the same Categories in Jomsocial for Events - which displays just the Events specially for these Categories...

Example:
K2 News Category I - Module Event Category I
K2 News Catgory II - Module Event Category II
.....
.....

Greets Karl

9 years 6 months ago
Licenses:

Hi, Karl.

I think it could be done... I'll add your thread to my TODO list.
I'll prepare hack in my spare time...
I'll update you with solution - but be aware that it could take some time ;)


- Instead of saying: 'it's not working', explain the problem in detail.
- Screenshots with the URL visible in them and the problem marked are more than welcome.
- Tell us how to replicate the problem, we can't fix it if we can't find it.
- Make sure that your site/server meets JomSocial System Requirements
- Make sure to setup JomSocial Cron Job
- Always provide us with access details to the backend and ftp. We need it to debug problems.
- If you have a similar problem, but a solution you found isn't working, open a new thread instead of 'merging' with an existing one.

- Use the "Thank You" feature on any post that helped you
9 years 6 months ago
  • Karl's Avatar
    Topic Author
  • Karl
  • Offline
  • Fresh Boarder
  • Posts: 51
  • Thank you received: 1
Licenses:
JomSocial Expired Socialize Expired

Thanks Michal... I'm patient :-)

9 years 5 months ago
Licenses:

Hi, Karl.

First you need to add Alternative layout feature to Community - Events module.
Please, follow this instruction:

mod_community_events.php (line 50)
+ replace: require( JModuleHelper::getLayoutPath('mod_community_events') );
+ with: require( JModuleHelper::getLayoutPath('mod_community_events', $params->get('layout', 'default')) );
mod_community_events.xml (line 25)
+ add:
<fieldset name="advanced">
<field name="layout" type="modulelayout" label="JFIELD_ALT_LAYOUT_LABEL" description="JFIELD_ALT_MODULE_LAYOUT_DESC" />
</fieldset>

Or use my demo files (upload them to ROOT/modules/mod_community_events.

This is a core file hack so you need to have copy of modified files ans they will be overwritten after next upgrade.
Alternative layout feature will be available in JomSocial 3.3.

Now as you have alternative layout feature you can set as many modules for Events as you need and every one could be set to display other category of events.

Copy this file:

ROOT/modules/mod_community_events/tmpl/default.php

to:

ROOT/templates/your-template/html/mod_community_events (if you don't have "html" or "mod_community_events" folders, feel free to create them).

Now rename file to something similar to this: events-category-3.php so you'll know which file is for which category.

Then edit file and replace this:

<div>
    <div class="app-box-content"> 
        <ul class="cThumbDetails cResetList">
            <?php foreach ($events as $event) { ?>
                <li <?php if (!empty($event->summary)): ?>class="jomNameTips" title="<?php echo CStringHelper::escape($event->summary); ?>" <?php endif; ?>>
                    <b class="cThumb-Calendar cFloat-L">
                        <b><?php echo CEventHelper::formatStartDate($event, JText::_('M')); ?></b>
                        <b><?php echo CEventHelper::formatStartDate($event, JText::_('d')); ?></b>
                    </b>
                    <div class="cThumb-Detail">
                        <a href="<?php echo $event->getLink(); ?>" class="cThumb-Title"><?php echo CStringHelper::escape($event->title); ?></a>
                        <div class="cThumb-Location">
                            <?php echo CStringHelper::escape($event->location); ?>
                        </div>
                        <div class="cThumb-Members small">
                            <a href="<?php echo $event->getGuestLink(COMMUNITY_EVENT_STATUS_ATTEND); ?>">
                                <?php echo JText::sprintf((!CStringHelper::isSingular($event->confirmedcount)) ? 'COM_COMMUNITY_EVENTS_ATTANDEE_COUNT_MANY' : 'COM_COMMUNITY_EVENTS_ATTANDEE_COUNT', $event->confirmedcount); ?>
                            </a>
                        </div>
                    </div>
                </li>
            <?php } ?>
        </ul>
    </div>
    <div class="app-box-footer">
        <a href="<?php echo CRoute::_('index.php?option=com_community&view=events'); ?>"><?php echo JText::_('COM_COMMUNITY_FRONTPAGE_VIEW_ALL_EVENTS'); ?></a>
    </div>
</div>

with this:
<div>
    <div class="app-box-content"> 
        <ul class="cThumbDetails cResetList">
            <?php foreach ($events as $event) { ?>
            <?php if($event->catid == 3) { ?>
                <li <?php if (!empty($event->summary)): ?>class="jomNameTips" title="<?php echo CStringHelper::escape($event->summary); ?>" <?php endif; ?>>
                    <b class="cThumb-Calendar cFloat-L">
                        <b><?php echo CEventHelper::formatStartDate($event, JText::_('M')); ?></b>
                        <b><?php echo CEventHelper::formatStartDate($event, JText::_('d')); ?></b>
                    </b>
                    <div class="cThumb-Detail">
                        <a href="<?php echo $event->getLink(); ?>" class="cThumb-Title"><?php echo CStringHelper::escape($event->title); ?></a>
                        <div class="cThumb-Location">
                            <?php echo CStringHelper::escape($event->location); ?>
                        </div>
                        <div class="cThumb-Members small">
                            <a href="<?php echo $event->getGuestLink(COMMUNITY_EVENT_STATUS_ATTEND); ?>">
                                <?php echo JText::sprintf((!CStringHelper::isSingular($event->confirmedcount)) ? 'COM_COMMUNITY_EVENTS_ATTANDEE_COUNT_MANY' : 'COM_COMMUNITY_EVENTS_ATTANDEE_COUNT', $event->confirmedcount); ?>
                            </a>
                        </div>
                    </div>
                </li>
                <?php } ?>
            <?php } ?>
        </ul>
    </div>
    <div class="app-box-footer">
        <a href="<?php echo CRoute::_('index.php?option=com_community&view=events'); ?>"><?php echo JText::_('COM_COMMUNITY_FRONTPAGE_VIEW_ALL_EVENTS'); ?></a>
    </div>
</div>

I've added a php condition here:

<?php if($event->catid == 3) { ?>

It means that if category id of loaded event is equal to 3, then it should be displayed below.
Now just replace 3 with event category ID you need (you'll find category ID in Backend -> Components -> JomSocial -> Events -> Events Category first column of table).

After that browse to Event module in backend, click on lats tab called "Advanced" and from "Alternative Layout" select list choose your file: prntscr.com/4ykhdb

Copy and rename events-category-3.php in ROOT/templates/your-template/html/mod_community_events for each category and edit file entering proper category ID.

Then copy Event module in backend and choose proper alternative layout for each module.

I attached demo file also. So you can use it right away.


- Instead of saying: 'it's not working', explain the problem in detail.
- Screenshots with the URL visible in them and the problem marked are more than welcome.
- Tell us how to replicate the problem, we can't fix it if we can't find it.
- Make sure that your site/server meets JomSocial System Requirements
- Make sure to setup JomSocial Cron Job
- Always provide us with access details to the backend and ftp. We need it to debug problems.
- If you have a similar problem, but a solution you found isn't working, open a new thread instead of 'merging' with an existing one.

- Use the "Thank You" feature on any post that helped you

This message has attachments files.
Please log in or register to see it.

The following user(s) said Thank You: Jeremy, zesharck, Karl
9 years 5 months ago
  • Karl's Avatar
    Topic Author
  • Karl
  • Offline
  • Fresh Boarder
  • Posts: 51
  • Thank you received: 1
Licenses:
JomSocial Expired Socialize Expired

Hi Michal!
Thank´s very much for this hack. I noticed today that you already have done this...
I think I should buy glasses :-D

Best regards, Karl

Moderators: Piotr Garasiński
Powered by Kunena Forum

Join 180,000 websites creating Amazing communities

JomSocial is the most complete, easy-to-use addon that turns Joomla CMS into a
full -fledged, social networking site

TRY NOW BUY NOW