I can use this with PHP visibility feature to get a block to show on the Event Page.

$match = FALSE;
if (current_path() == 'civicrm/event/register' && isset($_GET['id']) && $_GET['id'] == 74) { $match = TRUE; }
return $match;

However, if they submit the first page and there is a validation error, they get sent back to the URL of: /civicrm/event/register and the visibility setting no longer works.

Does anyone have a way to fix this?

Drupal 7.x CiviCRM 5.5


One option is to use .extra.tpl files to load the data you wish to display, rather than the block. An explanation of the technique is here. This avoids having to worry about whether something that's in scope for CiviCRM isn't in scope for the PHP visibility block.

Another is to check the value of the $_REQUEST or $_POST supervariables for some element that is specific to this page (e.g. I'm guessing the page ID is in there somewhere). If so, you could test for the presence of that value.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.