WordPress.org

Ready to get started?Download WordPress

Forums

myCRED
[resolved] Notification email needs more options (4 posts)

  1. hamzahali
    Member
    Posted 1 year ago #

    Hello,

    I was adding notification email for adding and deduction of funds (Addon). But when in that i dont see any option for putting how much points have been added or deducted,

    It only has a shortcode for balance.

    I think its a must to have a option for amount added/deducted and the reason for the same (Log details)

    Hope you can added this feature also.

    http://wordpress.org/extend/plugins/mycred/

  2. Gabriel
    Member
    Plugin Author

    Posted 1 year ago #

    The amount that is deducted / added to a users account can be accessed by using the %amount% shortcode in your email template. You can also use:

    %entry% for the log template.
    %data% if you are storing custom information in the data column that you want to also display.

    I completely agree that the Email Notice add-on could use some more features and I have received some very good and valid suggestions that I am looking into. Same goes for the documentation for this add-on.

  3. hamzahali
    Member
    Posted 1 year ago #

    When i am using %entry% i am not getting correct output,

    I am getting Payment for Order: #%order_id%, in the email.
    #%order_id% in not able to take order value, just getting #%order_id%

    See email reproducted below

    Hello admin

    Rupees -180 were Deducted from your account for Payment for Order: #%order_id%,

    Now your current balance is Rs 4 140.00

    Thanks

  4. Gabriel
    Member
    Plugin Author

    Posted 1 year ago #

    Sorry for the delay.

    If you are using WooCommerce, add this on line 241 in mycred/addons/gateway/carts/mycred-woocommerce.php:

    /**
     * Parse Email Notice
     * @since 1.2.2
     * @version 1.0
     */
    add_filter( 'mycred_email_before_send', 'mycred_woo_parse_email' );
    function mycred_woo_parse_email( $email )
    {
    	if ( $email['request']['ref'] == 'woocommerce_payment' ) {
    		$order = new WC_Order( (int) $email['request']['ref_id'] );
    		if ( isset( $order->id ) ) {
    			$url = esc_url( add_query_arg( 'order', $order->id, get_permalink( woocommerce_get_page_id( 'view_order' ) ) ) );
    
    			$content = str_replace( '%order_id%', $order->id, $email['request']['entry'] );
    			$email['request']['entry'] = str_replace( '%order_link%', '<a href="' . $url . '">#' . $order->id . '</a>', $content );
    		}
    	}
    	return $email;
    }

    If you are using Marketpress add this on line 500 in mycred/addons/gateway/carts/mycred-marketpress.php:

    /**
     * Parse Email Notice
     * @since 1.2.2
     * @version 1.0
     */
    add_filter( 'mycred_email_before_send', 'mycred_woo_parse_email' );
    function mycred_woo_parse_email( $email )
    {
    	if ( $email['request']['ref'] == 'marketpress_payment' ) {
    		$order = get_post( (int) $email['request']['ref_id'] );
    		if ( isset( $order->id ) ) {
    			$track_link = '<a href="' . mp_orderstatus_link( false, true ) . $order_id . '/' . '">#' . $order->post_title . '/' . '</a>';
    
    			$content = str_replace( '%order_id%', $order->post_title, $email['request']['entry'] );
    			$email['request']['entry'] = str_replace( '%order_link%', $track_link, $content );
    		}
    	}
    	return $email;
    }

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.