From d35d07a9560ba9bde31a3da9155fb726b48777b0 Mon Sep 17 00:00:00 2001 From: Tobias Kaestle Date: Fri, 15 Sep 2017 00:54:27 +0200 Subject: [PATCH] added pdflib to plugin, added certificate class, added button to frontend --- includes/class-vca-asm-profile.php | 20 ++++++++++++++++---- templates/frontend-form.php | 2 +- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/includes/class-vca-asm-profile.php b/includes/class-vca-asm-profile.php index ef925a7..42dbcb2 100755 --- a/includes/class-vca-asm-profile.php +++ b/includes/class-vca-asm-profile.php @@ -130,9 +130,22 @@ public function save_extra_profile_fields( $user_id ) { global $vca_asm_geography, $vca_asm_mailer; - if ( ! current_user_can( 'edit_user', $user_id ) ) { - return false; - } + if ( ! current_user_can( 'edit_user', $user_id ) ) { + return false; + } + + $this_user = new WP_User( $user_id ); + + if ( isset($_POST['download-certificate'] )) { + + require_once( VCA_ASM_ABSPATH . '/includes/class-vca-asm-certificate.php' ); + + $certificate = new VcA_ASM_Certificate(); + $certificate->setUser($this_user); + echo $certificate->getCertificate(); + //die(); + + } if ( isset( $_POST['deleteme'] ) && $_POST['deleteme'] == 'forever' ) { wp_delete_user( $user_id ); @@ -158,7 +171,6 @@ public function save_extra_profile_fields( $user_id ) break; case 'membership': - $this_user = new WP_User( $user_id ); if( in_array( 'city', $this_user->roles ) ) { update_user_meta( $user_id, $field['id'], '2' ); } else { diff --git a/templates/frontend-form.php b/templates/frontend-form.php index e926b02..86d1893 100755 --- a/templates/frontend-form.php +++ b/templates/frontend-form.php @@ -80,7 +80,7 @@ case 'select': $output .= '