Jump to content


From mediawiki.org
Not to be confused with Extension:Campaigns.
MediaWiki extensions manual
Release status: stable
Implementation Special page , Skin
Description Provides features for event organizers and participants
Author(s) Campaigns Team
Compatibility policy Snapshots releases along with MediaWiki. Master is not backward compatible.
MediaWiki >= 1.43
Database changes Yes
Tables campaign_events
License GNU General Public License 2.0 or later
Help Help:Extension:CampaignEvents
  • $wgCampaignEventsProgramsAndEventsDashboardAPISecret
  • $wgCampaignEventsEnableWikimediaParticipantQuestions
  • $wgCampaignEventsProgramsAndEventsDashboardInstance
  • campaignevents-enable-registration
  • campaignevents-delete-registration
  • campaignevents-organize-events
  • campaignevents-email-participants
Quarterly downloads 9 (Ranked 129th)
Translate the CampaignEvents extension if it is available at translatewiki.net
Issues Open tasks · Report a bug


  • Download and move the extracted CampaignEvents folder to your extensions/ directory.
    Developers and code contributors should install the extension from Git instead, using:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/CampaignEvents
  • Add the following code at the bottom of your LocalSettings.php file:
    wfLoadExtension( 'CampaignEvents' );
  • Run the update script which will automatically create the necessary database tables that this extension needs.
  • Schedule a cronjob that runs the #script to update timezones (optional), and one for the #script to aggregate participant answers.
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.


User rights[edit]

Right Description
campaignevents-enable-registration Enable event registrations
campaignevents-delete-registration Delete event registrations
campaignevents-organize-events Organize events
campaignevents-email-participants Email event participants


Variable name Default value Description
$wgCampaignEventsProgramsAndEventsDashboardInstance null Determines which instance of the P&E Dashboard should be used, if any. Supported values are 'production', 'staging', or null to not use the dashboard.
$wgCampaignEventsProgramsAndEventsDashboardAPISecret null API secret to use with the selected P&E Dashboard instance. Must be configured if you intend to use the P&E Dashboard.
$wgCampaignEventsEnableWikimediaParticipantQuestions true Whether to enable Wikimedia-specific questions that can be asked to participants, such as whether they belong to a Wikimedia affiliate.

The extension can be configured to store data into a database other than the main wiki DB. You do so by configuring the virtual-campaignevents domain, see Manual:$wgVirtualDomainsMapping . For instance:

$wgVirtualDomainsMapping['virtual-campaignevents'] = [ 'db' => 'my_central_db' ];

This is especially useful in combination with a central database that stores event for a whole wiki family. Note, if you do so, that the wiki farm needs to use central user IDs .


Documentation of all the API endpoints is available.

Maintenance scripts[edit]

Script to update timezones[edit]

The extension stores the local time and timezone for each event, to guarantee that the local time remains accurate even if time zone rules change. However,internally it also stores UTC timestamps so that certain operations like sorting are possible. The UTC timestamps may go out of sync with the local ones if time zone rules change, which happens more commonly than you may think. You can read more details. In order to mitigate that, the extension provides a maintenance script that recomputes the UTC timestamps for all events according to the latest timezone rules, and stores them back into the database.

In order for this to work, you have to make sure that PHP has access to the latest version of the tz database. The PHP manual provides some context about this. The easiest solution is to install the timezonedb PECL package and make sure to keep it up-to-date.

Assuming that PHP has access to the latest timezone rules, you can run the script with:

$ php maintenance/run.php ./extensions/CampaignEvents/maintenance/UpdateUTCTimestamps.php

The script also takes an optional --timezone parameter where you can specify the name of a time zone whose rules changed; this parameter can be repeated multiple times. If passed, the script will only update events whose timezone matches one of the timezones specified via this parameter.

If you upgrade the time zone database automatically (e.g., with a cronjob), you can make that job also execute this script, so that you don't have to do it manually every time you upgrade the time zone database.

Script to aggregate participant answers[edit]

The extension provides a maintenance script that aggregates participant answers after a 90 day period. The script can be run with:

$ php maintenance/run.php ./extensions/CampaignEvents/maintenance/AggregateParticipantAnswers.php

The script should be configured to run automatically (e.g., as a cronjob) to make sure that PII isn't retained for longer than it needs to.

See also[edit]