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.

how to set the default category value shown in the page of "create event"

8 years 1 month ago
Licenses:
JomSocial Expired iSEO Active Socialize Expired

ISSUE SUMMARY:
how to set the default category value shown in the page of "create event"? I have created several event categories in the backend. In the front end, I want to show a default category value instead of showing "please select a category". I already foundd the code in localhost/components/com_community/templates/jomsocial/layouts/events.forms.php

line 104 to line 107

<div class="joms-form__group">
<span><?php echo JText::_('COM_COMMUNITY_EVENTS_CATEGORY'); ?> <span class="joms-required">*</span></span>
<?php echo $lists; ?>
</div>

Can you tell me how to set the default categoryid (catid)? I have tried <?php echo $event ->catid = '1'; ?> and <?php echo $event[catid] = '1'; ?>. But it didn't work. Thank you. I highly appreciate your reply.

8 years 1 month ago
  • Dimas's Avatar
  • Dimas
  • Visitor
  • Thank you received: 0
Licenses:

Hi,

Please you modify this file components/com_community/views/events/view.html.php, find this code :

$lists['categoryid'] = CCategoryHelper::getSelectList('events', $cTree, $event->catid, true);
change to be like this :
$eventCat = empty($event->catid) || $event->catid==0?1:$event->catid;
$lists['categoryid'] = CCategoryHelper::getSelectList('events', $cTree, $eventCat, true);

not tested yet, but I hope it will work.

8 years 1 month ago
Licenses:
JomSocial Expired iSEO Active Socialize Expired

Hi, Dimas, thank you very much for your quick response. I am trying to add more function in the event function.

I have modified the events.forms.php, and make it load different events.forms based on the uri address through



$currenturi = $_SERVER["REQUEST_URI"];
$currentlasturi = basename($currenturi);

switch($currentlasturi){
case "wedding": //Form Page
include("/components/com_community/templates/jomsocial/layouts/events.formswedding.php");
break;
case "announce-wedding": //Form Page
include("/components/com_community/templates/jomsocial/layouts/events.formswedding.php");
case "birthdayparty": //Form Page
include("/components/com_community/templates/jomsocial/layouts/events.formsbirthdayparty.php");
.......
Now I am trying to set the event catid in the events.formswedding.php, events.formsbirthdayparty.php directly...... which can pass the validation of
if(!$event->catid){
$validated = false;
$mainframe->enqueueMessage(JText::_('COM_COMMUNITY_SELECT_CATEGORY'), 'error');
}
in localhost/components/com_community/controllers/events.php (line 2190- 2193)
My question is: is there a simple way to set the event catid in the code of
<div class="joms-form__group">
<span><?php echo JText::_('COM_COMMUNITY_EVENTS_CATEGORY'); ?> <span class="joms-required">*</span></span>
<?php echo $lists; ?>
</div>
? If I can set the event category id directly and pass the form validation, I will hide the "select category" part in the form. I have googled 3 days to solve this problem and tried various ways. But I failed. You are a specialist. I think you can help me. Thank you.

8 years 1 month ago
  • Dimas's Avatar
  • Dimas
  • Visitor
  • Thank you received: 0
Licenses:

use this code :

$event->catid= empty($event->catid) || $event->catid==0?1:$event->catid;
$lists['categoryid'] = CCategoryHelper::getSelectList('events', $cTree, $eventCat, true);

should fix the missing catId since you define the default catid if it empty..and then if you wanna hide the event category selection you can delete this code :
<div class="joms-form__group">
<span><?php echo JText::_('COM_COMMUNITY_EVENTS_CATEGORY'); ?> <span class="joms-required">*</span></span>
<?php echo $lists; ?>
</div>
and replace to :
<input type="hidden" name="catid" id="catid" value="<?php echo $event->catid?>">

8 years 1 month ago
Licenses:
JomSocial Expired iSEO Active Socialize Expired

Hi, Dimas, you are great. Thank you so much.

8 years 1 month ago
  • Dimas's Avatar
  • Dimas
  • Visitor
  • Thank you received: 0
Licenses:

you're welcome.. glad can help you :)

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