CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • HOOK / Changes on civicrm function
Pages: [1]

Author Topic: HOOK / Changes on civicrm function  (Read 389 times)

jchnews

  • I post occasionally
  • **
  • Posts: 41
  • Karma: 0
  • CiviCRM version: 4.2
  • CMS version: Wordpress
  • MySQL version: 5.1
  • PHP version: 5.3.x
HOOK / Changes on civicrm function
December 13, 2015, 05:58:01 am
Hello,

I would like to change the pdf filename for invoice
If i have well understand i have to use a wordpress hook and copy the modified function in wordpress functions.php ?
Could you please give me the way to do it

Thanks

Code: [Select]
// hook into civicrm_pre
add_filter( 'civicrm_pre', 'my_plugin_pre_callback', 10, 4 );
function my_plugin_pre_callback( $op, $objectName, $objectId, &$objectRef ) {
  // your code here
}

Original function
Code: [Select]
  static public function putFile($html, $name = 'Mycustominvoicename.pdf') {
    require_once "vendor/dompdf/dompdf/dompdf_config.inc.php";
    $doc = new DOMPDF();
    $doc->load_html($html);
    $doc->render();
    $html = $doc->output();
    $config = CRM_Core_Config::singleton();
    $fileName = $config->uploadDir . $name;
    file_put_contents($fileName, $html);
    return $fileName;
  }

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • HOOK / Changes on civicrm function

This forum was archived on 2017-11-26.