Quantcast
Channel: Blogs
Viewing all articles
Browse latest Browse all 1747

Displaying remaining participant slots on events

$
0
0

I'm currently undertaking a vast overhaul of how our site (greenrenters.org) displays and handles events as they are our main interaction point with the public. I'll document what I learn in a series of blog posts and here's the first.

Some say that showing what's left to people motivates them more to take action and do something, wethere or not you think that's true is a completely different story, but here's some code to add (probably in a locally overriden 'CRM/Event/Page/EventInfo.tpl' file). For teh below to work, you need to have maximum participants on an event enabled.

{crmAPI var="ParticipantS" entity="Participant" action="get" sequential="1" event_id=$event.id }
// Gets the current particiapnst registered for the event

{* $x=$event.max_participants, $y=$ParticipantS.count *}
// Assigns our variables for the calculation below

Remaining - {math equation="x - y" x=$event.max_participants y=$ParticipantS.count}
// Subtract the current particpants from the maximum.


Viewing all articles
Browse latest Browse all 1747

Trending Articles