Woocommerce custom emails without header and footer

Seems I’ve managed to find the solution. $mailer = $woocommerce->mailer(); must be called before the Get mail template function send_activation_link() { global $woocommerce; //My other code here…. $mailer = $woocommerce->mailer(); ob_start(); // Get mail template woocommerce_get_template(’emails/customer-reset-password-link.php’, array( ‘user_login’ => $user_login, ‘blogname’ => $blogname, ’email_heading’ => $email_heading, ‘key’ => $key )); // Get contents $message = … Read more

Two functions utilizing registration_errors filter

Identifying errors via error code Run add_user_to_SF with an earlier priority, to make it execute first add_filter( ‘registration_errors’, ‘add_user_to_SF’, 9, 3 );` Let’s assume you have two possible errors in your add_user_to_SF: function add_user_to_SF( $errors, $sanitized_user_login, $user_email ) { $has_errors = false; if ( /* some condition that should throw an error */ ) { … Read more

Plugin developement and SVN

Two things to note, URL requirement when registering plugin is currently worded as: Plugin URL (required, must be a link to a ZIP file of the working plugin) So you can simply put packed up plugin somewhere (your server, public Dropbox folder, etc) to provide it for review. It doesn’t have to be established site … Read more

How a deprecated function can crash WordPress site while upgrading

Where… The following files hold the deprecated functions: ~/wp-includes/deprectated.php ~/wp-includes/pluggable-deprectated.php … Take a look at them and then through their replacement functions, where the calls to _deprecated_function() happen. Why… Normally a crash shouldn’t happen. In the “real” PHP world, you’d get an E_DEPRECATED Warning. In WordPress you’ll get a trigger_error() return caused by _deprecated_function() calls. … Read more

Registering and using actions which return results in a Plugin class

Some actions hooks need to be fired on specific events. Try this code: class SpektrixPlugin { public function __construct(){ add_action(‘init’, array(&$this, ‘init’)); } public function spektrix_list_events($getPrices = FALSE) { $api = new SpektrixApiClient(); return $api->getAllEvents($getPrices); } public function init(){ add_action( ‘spektrix_list_events’, array ( $this, ‘spektrix_list_events’ )); } } $SpektrixEvents = new SpektrixPlugin(); I’ve tested this … Read more