Support

Home Forums Ticketing Add-on Adding Course completion certificate to my events page

Adding Course completion certificate to my events page

Posted: November 7, 2013 at 9:28 am


James Simon

November 7, 2013 at 9:28 am

OK, So I was able to get the course certificate stuff I saw in this post working:

https://eventespresso.com/topic/simple-attendee-addon-action-similar-idea-to-ticketing/

Thanks Dean and Sean

However, Now I only want the certificate to show up on the event page if the person has attended the event.

I modified the my_events_page.php with a few changes

added this line to give the header

<?php echo $ticketing_installed == true?'<th class=”manage-column column-author” id=”certification” scope=”col” style=”width:10%;”>’.__(‘Certification’,’event_espresso’).'</th>’:”; ?>

Added this line to create the certificate link

//New ticketing system suport
if (function_exists(‘espresso_certificate_launch’)){
$certification_link = espresso_certificate_links($registration_id, $attendee_id);
}

and finally added this line to show the link

<?php echo $ticketing_installed == true?'<td class=”post-title page-title column-title”>’.$certification_link.'</td>’:”; ?>

Probably not perfect but given my limited php knowledge it is the best I could do.

Now I would like to add an if condition around the line that shows the link to check if the person has attended the event.

Any help on this would be much appreciated.

Thanks In Advance


James Simon

November 7, 2013 at 10:40 am

OK so I got it working against todays date. Anotherwards if the class has past show a certificate in the my events page by changing the code to this.

<?php if(strtotime($start_date) < strtotime(‘now’) ) {

echo $ticketing_installed == true?'<td class=”post-title page-title column-title”>’.$certification_link.'</td>’:”;

}

?>

However, I would still like to trigger it off of has attended and am not sure what I should be checking against.

Any ideas?

Thanks


Dean

November 8, 2013 at 1:40 am

Hi James,

In the default my_events_page.php you can’t check against whether they have attended.

You would need to modify the SQL query to grab that data, so on line 61 add to the end of the $events = $wpdb->get_results section the following:

, a.checked_in

Now you can add a variable like $hasuserattended = $event->checked_in

Then you can make your if statements etc from that.

The response should be a number 0 for not checked in, and then a number for the number of check ins, normally this is just one, unless the user has a ticket that allows multiple check ins.


James Simon

November 8, 2013 at 10:59 am

Thanks Dean, That is great stuff. One final question. Where should I save this new file so it is not overwritten on future upgrades of event espresso. I noticed these files do not fall under the template directory.

Thanks In Advance

Keep up the great work.


Dean

November 10, 2013 at 11:33 pm

Hi James,

Unfortunately the my_events_page.php isn’t a standard template so there isn’t anywhere it can go to not be over written. The best advice I can currently give is to keep a copy offline. I will add a feature request to see if we can make the file into a template file in future versions.

One option would be to copy the event_espresso_my_events function from that file to the custom_functions.php file in the uploads/espresso directory (create it if needed) and the edits will survive updates. One issue though is you will either need to copy over the user_vars.php to the same location or fiddle with the code to get an include working without errors.

The support post ‘Adding Course completion certificate to my events page’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso