2

Is there a way to add Register buttons to the public events listing page (.../civicrm/?page=CiviCRM&q=civicrm/event/ical&reset=1&list=1&html=1)? I'd like a website visitor to be able to choose to register from this listing, rather than having to go first to the event detail page to find the Register button.

Using 4.7.29 on Wordpress 4.9.2.

Thanks for any help!

2 Answers 2

2

Despite it not really being best practice, but lacking programmers to work thru the API, I created a customized template directory structure as described here. Then I made a copy of the ICalendar.tpl file (the default one found at wordpress/wp-content/plugins/civicrm/civicrm/templates/CRM/Event/Page), placed it in wordpress/wp-content/civicrm-custom/CRM/Event/Page, and made the modifications to show the registration links (see here for how to locate your template file). The modifications were:

  • Before the table begins, add the line {* CNP force registration links *} {assign var="registration_links" value=true;}. This is because the registration link code is actually already there but hidden by default (unless you use the Shopping Cart mode - then it becomes an "Add to Cart"). This sets it to show by default.
  • In the table's header row, the line {if $registration_links}<th>{ts}Register{/ts}</th>{/if} is good as is.
  • In the body of the table, I modified the existing IF as so: {if $registration_links}<td><a {* CNP orig was href="{$event.registration_link}" *} href="{crmURL p='civicrm/event/register' q="id=$event.event_id"}" >{$event.registration_link_text}</a></td>{/if}.
  • I also moved that link column to be the 2nd column on the event listings page, but that's a matter of personal choice.

Afterwards, remember to add this custom template path in CiviCRM at System Settings, Directories, Custom Template Directory (my path was [cms.root]/wp-content/civicrm-custom/).

1
1

Perhaps this file is worth checking: civicrm/templates/CRM/Event/Page/DashBoard.tpl; you may want to have a customized version of the template and put something like a piece of code below into an appropriate place of HTML markup:

<a href="{crmURL p="civicrm/event/register" q="reset=1&id=$id"}" title="{ts}Register now{/ts}">{ts}Register now{/ts} </a>

Please do not forget to follow all CiviCRM guides regarding custom templates creation.

4
  • yurg, thx very much for your reply. I did find the template file you're talking about - problem is I'm too novice to understand where this new code should go. Could you please elaborate a little on that? I know I'm probably just adding another '<td>' but I'm even having trouble identifying the columns that currently show on the event listing page. And I WILL read up on custom template creation - thx for the heads-up.
    – Ruth D
    Feb 16, 2018 at 21:08
  • Might it actually be the ICalendar.tpl file that would need to be modified?
    – Ruth D
    Feb 17, 2018 at 0:00
  • In the ICalendar.tpl file I recognize the columns as being the ones displayed in the event listing. This file actually includes the line "{if $registration_links}<td><a href="{$event.registration_link}">{$event.registration_link_text}</a></td>{/if}". I'm assuming the answer to the IF is "no", but if it were "yes" then the link would display for us?? If so, where is that variable set to "no"?
    – Ruth D
    Feb 17, 2018 at 0:26
  • @RuthD Perfect, you're on the right track: you've got the main idea behind all of this, please keep going!
    – yurg
    Feb 17, 2018 at 19:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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