THERE IS NOW A NEW CLUB PLUGIN FOR SILVER MEMBERS AND ABOVE THAT DOES ALL THIS AND A LOT MORE.

This article (and sample files) describes how to add a custom field to the JEvents description - it requires knowledge of basic PHP and MySQL.

Our Goal

We wish to add a text field called "Custom Field" to our event description.

The Code

After installing the sample code plugin (or editing it on your local computer first) take a look at the file jevcustomfield.php.

The first question you must ask yourself is if this custom field is to be at event level or event detail level?  What this means is that at "event level" no repeat exception can have a different value but if you go for event detail level

Taking the methods of this class in turn.

__construct

This basically loads the language file from administrator/languages/xx-XX/xx-XX.plg_jevents_jevcustomfield - based on your language.  Add any language strings you want to use in this file.

Just above the constructor you will see

// boolean flag to say if this custom field relates to the event or the event detail.
var $eventlevel = 0;
This is the flag that sets how to treat this event. If you do NOT want this field to be customised for specific event repeats then change the value to 1.

onEditCustom

This is the function that creats the custom field input in the edit screen.   You'll see how see load the data from the database.  Based on the value of eventlevel it either loads the field based on the event id or the event detail id.

The input fields are added to an array ($customfields) and in turn are an array consisting of a label and the HTML.  The name of the field must start with the prefix custom_

onStoreCustomDetails and onStoreCustomEvents

These store the data in the database.

onDeleteCustomEvent and onDeleteEventDetails

These remove the data from the database when it is no longer needed.

onDisplayCustomFields

This loads the custom field and returns it to the event detail screen.  If you want to use this custom value in a customised template layout then add it to $row e.g.

$row->customfield = $customdata->customfield;

Then this value is available to you in your template override.

creatable

This creates the linked database table if it does not exist already.

JEvents Component

Many component output options

JEvents Modules

Many customisable modules

Event Administration

Event Administration

Attend, Invite, Remind

Sell tickets, send invitations & reminders

Locations & Venues

Maps, addresses, venue information

YOOtheme Integration

Use JEvents data sources and features within YOOtheme.

Themes & Styles

Beautiful responsive themes

Custom Fields, Images, Tags & People

Extend your events

Social Engagement

Engage with your users

Who Sees What & When?

Decide who sees what, where and when!

Extra Modules

More module choices !

Link to content and CCKs

Link your events to articles