Trying to add my own functio to the plugin?
-
Hello,
I am trying to include a function which runs ok in my-theme/functions.php. But when i copy the function in mail.class.php (this is where i need the function) it doesn’t work anymore?
I have added these 2 functions in mail.class.php after modify_mail_operation() and i alter modify_mail_operation() a bit by
$attachments = self::render_tickets();
to test with but i doesn’t work. The pdf isn’t generated it looks like generate_pdf doesn’t work. If however i call eticket.class.php from another file it works as expected.
any pointers, tips?
static function render_tickets(){ /** * some dummy static data to test with, should be the purchase data */ $data['ticket-name'] = 'Nike'; $data['ticket-address'] = 'beaverton'; $pdf_filename = self::generate_pdf($data); //store a copy in a seperate folder copy(WP_CONTENT_DIR .'/uploads/tickets-tmp/'.$pdf_filename, WP_CONTENT_DIR .'/uploads/tickets/'.$pdf_filename); return $pdf_filename; } static function generate_pdf($data) { //using xampp so set root $docRoot = $_SERVER["DOCUMENT_ROOT"] . '/mydomain.com'; //temp store the pdf if(!defined('COUPON_UPLOAD_PATH')) { define ('COUPON_UPLOAD_PATH',$docRoot.'/site/wp-content/uploads/tickets-tmp'); } // Include the main TCPDF library (search for installation path). require_once( $docRoot . '/tcpdf_min/config/lang/en.php' ); require_once( $docRoot . '/tcpdf_min/tcpdf.php' ); require_once( $docRoot . '/tcpdf_min/tcpdf_barcodes_2d.php' ); // include 1D barcode class (search for installation path) require_once( $docRoot . '/tcpdf_min/tcpdf_barcodes_1d.php'); require_once('eticket.class.php'); $pdf = new FACTUURETICKET2014($data, 'P', 'mm', 'A4'); // set document information $pdf->SetCreator(PDF_CREATOR); //etc more tcpdf specific details if ($data['num-of-tickets'] > 1) { //aanvrager $pdf->make_eticket($data); } # Output the PDF document. F to save I inline $pdf->Output('/site/wp-content/uploads/tickets-tmp/eticket-' . $data['ticket-barcode'] . '.pdf', 'F'); }
Anyone some tips?
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Trying to add my own functio to the plugin?’ is closed to new replies.