Quick and dirty solution - create an ’Event’ template and create a document for each event. Create a TV called ’Attendees’ and attach it to the Event template. The idea is that this TV will contain a comma delimited list of webuser ids.
Create a snippet called ’AddMeToEvent’ and add to the Event template; something like this:
<?php
if ( isset($_REQUEST['addme']) ) {
// grab the logged in user's id
$userId = $modx->getLoginUserID();
// get this document id
$docId = $modx->getDocumentIdentifier();
// retrieve the existing value of 'Attendees' for this document
$attendeesTv = $modx->getTemplateVarOutput('Atendees');
// explode in to an array of webuser ids
$attendees = explode(",", $attendeesTv);
// add the new user
array_push($attendees, $userId);
// convert back to a delimited string
$attendeesTv = implode(",", $attendees);
// do sql queries to update/insert into the modx_site_tmplvar_contentvalues table
// see cakeModx's setTV() method for an easy way to do this:
// http://modxcms.com/forums/index.php?topic=35663.0
}
?>
The above would be triggered by a link like this [~[*id*]~]?&addme=1
To output the list of attendees you need another snippet and pass [*Attendees*] to it as a parameter. This snippet would iterate through the list of webuser ids and retrieve each person’s fullname (using eg $modx->getWebUserInfo($userId) - see the
wiki), then output it as a list.