• Resolved bobadoo

    (@bobadoo)


    Hi there,

    In your documentation on the plugin website (https://docs.sproutinvoices.com/article/28-edit-notification-templates) you mention you can add custom notifications using the ‘sprout_notifications’ filter. I’ve tried that with the code below but the new notifications never appear in the admin area. Is there more that needs to be done to make this work?

    I’d appreciate any direction on this. Thanks!

    add_filter( ‘sprout_notifications’, ‘register_new_notifications’, 15, 1);

    function register_new_notifications( $notifications = array() ){
    // echo ‘

    ';
        // print_r($notifications);
        $notifications['this_is_a_new_one'] = array(
                    'name' => __( 'New Notification ', 'sprout-invoices' ),
                    'description' => __( 'Customize the email sent to an admin when any payment is received.', 'sprout-invoices' ),
                    'shortcodes' => array( 'date', 'name', 'first_name', 'username', 'payment_total', 'payment_id', 'line_item_table', 'line_item_list', 'line_item_plain_list', 'invoice_subject', 'invoice_id', 'invoice_edit_url', 'invoice_url', 'invoice_issue_date', 'invoice_due_date', 'invoice_past_due_date', 'invoice_po_number', 'invoice_terms', 'invoice_notes', 'invoice_total', 'invoice_payments_list', 'invoice_payments_list_html', 'invoice_subtotal', 'invoice_calculated_total', 'invoice_total_due', 'invoice_deposit_amount', 'invoice_total_payments', 'client_name', 'client_edit_url', 'client_address', 'client_company_website' ),
                    'default_title' => sprintf( __( '%s: New thing Here', 'sprout-invoices' ), get_bloginfo( 'name' ) ),
                    'default_content' => SI_Notifications::load_view_to_string( 'notifications/admin-payment', null, false ),
    
            );
        return array_merge( $notifications );
    }
    

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support clgwaltney

    (@clgwaltney)

    Hey there!

    I’m Chris, Support Jedi with Sprout Invoices. Sorry you’re having trouble with this! Our developer, Dan, will be able to help you out with this. He can normally respond within a day or so, but he probably won’t be able to get to this until next week because he is away in Guatemala.

    If you have a Pro (paid) license, feel free to submit a support ticket and we can help you out that way. Thanks for waiting. Cheers!

    Plugin Author Dan Cameron

    (@dancameron)

    Hello,

    Thank you for your patience with this, I just got back (https://sproutinvoices.com/news/diverting-some-support-to-guatemala/
    ) and I finally have reliable internet.

    The filter you have looks good, although it would be nice to see it formatted correctly (i.e. I suggest using gist.github.com). You probably don’t see the notification since there’s some caching that needs to be reset.

    You can reset this cache with this method: SI_Notifications_Control::clear_notification_cache

    Kind Regards,

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Creating new notifications’ is closed to new replies.