3 Responses to Automatically Send Emails With Export of Totals

  1. George August 16, 2018 at 9:18 pm #

    That’s great, good luck with your implementation!
    Btw, if you decide to share it publicly on GitHub for instance, please let me know!

    Cheers

  2. Felix August 16, 2018 at 1:40 pm #

    Thank you this is perfect and exactly what I was looking for. You have been a big help.

  3. George August 16, 2018 at 10:29 am #

    Hi Felix,

    The main function for generating a report for totals is Affiliates_Totals::get_mass_payment_file( $service, $params, get_option( 'blog_charset' ) );

    $service string parameter can be either paypal or export.
    $params is an array that must contain at least a ‘tables’ entry. Other options can be ‘from_date’, ‘thru_date’, ‘minimum_total’, ‘affiliate_status’, ‘referral_status’, ‘currency_id’, ‘affiliate_id’, ‘affiliate_name’, ‘affiliate_user_login’, ‘orderby’, ‘order’

    For example

    global $wpdb, $affiliates_db;
    $service = 'export';
    $params = array();
    $params['tables'] = array(
    'affiliates' => $affiliates_db->get_tablename( 'affiliates' ),
    'affiliates_users' => $affiliates_db->get_tablename( 'affiliates_users' ),
    'referrals' => $affiliates_db->get_tablename( 'referrals' ),
    'users' => $wpdb->users
    );
    ob_start();
    Affiliates_Totals::get_mass_payment_file( $service, $params, get_option( 'blog_charset' ) );
    $report = ob_get_contents();
    ob_end_clean();
    wp_mail(...);

    the above will export a totals file and $report has the file contents to string which can be used with wp_mail().

    Hope it helps.

    Kind regards,
    George

We use cookies to optimize your experience on our site and assume you're OK with that if you stay.
OK, hide this message.

Affiliates · Contact · Jobs · Terms & Conditions · Privacy Policy · Documentation · Downloads · Useful Plugins · My Account

Share