Answers.Body: <p>As with many problems with Drupal integration civcrm_entity is the answer.</p>
  
  <p>Install the latest civicrm_entity module for Drupal in the usual way (Recommend using Drush if you can).You'll also need to enable the civicrm_entity_views_extras sub module.</p>
  
  <p>We'll be using drupal views to display the results so if you have your Drupal and Civi in different databases then make sure you have civicrm cms integration configured. Go to Civicrm home and choose <code>Administer-&gt;System Settings-&gt;CMS database integration</code>. This will bring up a page of PHP code to paste into your current drupal settings.php to allow drupal views to fetch civicrm data. You might need to change permissions on settings.php and it's enclosing folder to edit the file, remember to change them back.</p>
  
  <p>Now, create a new view to show "civicrm events", click "Create a page" and choose "unformatted list of fields" as Display format.</p>
  
  <p><a href="https://i.sstatic.net/mivuk.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/mivuk.png" alt="Views settings"></a></p>
  
  <p>This will show all events in the system. For our purpose we only wanted to show events on a certain afternoon, so we added a "filter criteria" to only show events starting in the correct timeframe. Worked for us but you may need to find other filtering techniques for other purposes.</p>
  
  <p>Add fields for all the information you want to display. Title, description etc.</p>
  
  <p>The field that does the magic is called "Civicrm Events:event is full" this will return a 0 if there are spots left or 1 if the event is full.</p>
  
  <p>So now your view knows when an event is full, to change what is displayed to the user you'll need another module—<a href="https://www.drupal.org/project/views_conditional" rel="nofollow noreferrer">views conditional</a>—install that and reload the view editor.</p>
  
  <p><a href="https://i.sstatic.net/2lpAr.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/2lpAr.png" alt="Views settings"></a></p>
  
  <p>Add a views conditional field below all other fields and set it up so it checks if the event is full field and returns either the "registration link" or a custom message.</p>
  
  <p><a href="https://i.sstatic.net/qmGkn.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/qmGkn.png" alt="views conditional settings"></a></p>
  
  <p>This should now be working, but you're still seeing the "Registration link text field" and "event is full" field above your conditional output. Click to change the settings of each one to "exclude from display" and check that "registration link text" is linking to where you want it. The setting sometimes seems to reset when I save the view.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-05-01T01:49:34.717Z
Answers.Text: Yep great write up - may be worth adding a comment in para 2 to say "if you have your Drupal and Civi in different databases then ..."
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-05-01T01:51:50.337Z
Answers.Text: Just to clarify - is there actually a bit of magic being supplied here by civicrm_entity? or can it all be done without it?
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-05-01T12:27:03.220Z
Answers.Text: So I'd update this write up with one detail. The "Event is full" field is a custom field provided by the CiviCRM Entity Views Extras submodule of the project
Answers.UserDisplayName: jackrabbithanna
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-05-01T01:13:03.040Z
Answers.LastActivityDate: 2018-05-01T23:58:33.710Z
Answers.LastEditDate: 2018-05-01T23:58:33.710Z
Answers.UserDisplayName: joewickert
Body: <p>We are collecting registrations for a conference and have a number of optional workshops on one of the afternoons. I want to create a summary page of available workshops for participants with a link to register or a message if the workshop is full.</p>
  
  <p>Using Drupal 7 as CMS.</p>
  
Tags: <civievent><drupal-views><registration><civicrm-entity>
Title: How can I show a list of events with summaries and either a register link or message saying they are full?
ThreadText: # How can I show a list of events with summaries and either a register link or message saying they are full?
  
  (Asked by: username_0 on 2018-05-01)
  
  We are collecting registrations for a conference and have a number of optional workshops on one of the afternoons. I want to create a summary page of available workshops for participants with a link to register or a message if the workshop is full.
  
  Using Drupal 7 as CMS.
  
  **Tags:** civievent, drupal-views, registration, civicrm-entity
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2018-05-01. Score: 4
  
  As with many problems with Drupal integration civcrm\_entity is the answer.
  
  Install the latest civicrm\_entity module for Drupal in the usual way (Recommend using Drush if you can).You'll also need to enable the civicrm\_entity\_views\_extras sub module.
  
  We'll be using drupal views to display the results so if you have your Drupal and Civi in different databases then make sure you have civicrm cms integration configured. Go to Civicrm home and choose `Administer->System Settings->CMS database integration`. This will bring up a page of PHP code to paste into your current drupal settings.php to allow drupal views to fetch civicrm data. You might need to change permissions on settings.php and it's enclosing folder to edit the file, remember to change them back.
  
  Now, create a new view to show "civicrm events", click "Create a page" and choose "unformatted list of fields" as Display format.
  
  [![Views settings](https://i.sstatic.net/mivuk.png)](https://i.sstatic.net/mivuk.png)
  
  This will show all events in the system. For our purpose we only wanted to show events on a certain afternoon, so we added a "filter criteria" to only show events starting in the correct timeframe. Worked for us but you may need to find other filtering techniques for other purposes.
  
  Add fields for all the information you want to display. Title, description etc.
  
  The field that does the magic is called "Civicrm Events:event is full" this will return a 0 if there are spots left or 1 if the event is full.
  
  So now your view knows when an event is full, to change what is displayed to the user you'll need another module—[views conditional](https://www.drupal.org/project/views_conditional)—install that and reload the view editor.
  
  [![Views settings](https://i.sstatic.net/2lpAr.png)](https://i.sstatic.net/2lpAr.png)
  
  Add a views conditional field below all other fields and set it up so it checks if the event is full field and returns either the "registration link" or a custom message.
  
  [![views conditional settings](https://i.sstatic.net/qmGkn.png)](https://i.sstatic.net/qmGkn.png)
  
  This should now be working, but you're still seeing the "Registration link text field" and "event is full" field above your conditional output. Click to change the settings of each one to "exclude from display" and check that "registration link text" is linking to where you want it. The setting sometimes seems to reset when I save the view.
  
  > **Comments:**
  > **username_1**: Yep great write up - may be worth adding a comment in para 2 to say "if you have your Drupal and Civi in different databases then ..."  
  > **username_1**: Just to clarify - is there actually a bit of magic being supplied here by civicrm_entity? or can it all be done without it?  
  > **username_2**: So I'd update this write up with one detail. The "Event is full" field is a custom field provided by the CiviCRM Entity Views Extras submodule of the project  
  
  ---
  
  