• Resolved vkarta

    (@vkarta)


    Good afternoon
    Could you please tell me

    How can I add the total amount of withdrawals to the user’s profile?

    I want to display the total amount that the user has withdrawn to their account

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support bukhari10

    (@bukhari10)

    Hello @vkarta

    Thanks for contacting us.

    Currently, there is no option to show the total amount that the user has withdrawn from their account. There is no shortcode or Gutenberg block related to it. Please confirm are you using CashCred to withdraw points or any other myCred addon?

    If you have any questions, feel free to reach out. We’re here to assist you.

    Thanks & Regards
    WP Experts Support Team

    Thread Starter vkarta

    (@vkarta)

    Good afternoon
    Yes, the shortcode for withdrawals is [mycred_cashcred]
    And I receive withdrawal requests in the PU section: cashCred Withdrawal

    Plugin Support bukhari10

    (@bukhari10)

    Hello @vkarta

    Thanks for contacting us,

    You are trying to display the total withdrawal amount for a user on their profile, which is currently not supported by the cashCred addon.

    But we can look at possibilities after discussing with our technical team.

    If you have any questions, feel free to reach out. We’re here to assist you.

    Thanks & Regards
    WP Experts Support Team

    Plugin Support bukhari10

    (@bukhari10)

    Hi @vkarta

    I hope you are doing well. Please confirm which plugin you are using for the user profile.

    Best Regards,
    myCred Support Team

    Plugin Support bukhari10

    (@bukhari10)

    Hi @vkarta

    We have added a custom shortcode so you can show the total amount you have withdrawn (approved CashCred requests) on any page or profile tab.

    Shortcode: [mycred_cashcred_total]

    add_shortcode( 'mycred_cashcred_total', function() {

    if ( ! is_user_logged_in() ) {
    return '';
    }

    $user_id = get_current_user_id();
    $total = 0;

    $posts = get_posts( array(
    'post_type' => 'cashcred_withdrawal',
    'post_status' => 'publish',
    'posts_per_page' => -1,
    'fields' => 'ids',
    'meta_query' => array(
    array( 'key' => 'status', 'value' => 'Approved', 'compare' => '=' ),
    array( 'key' => 'from', 'value' => $user_id, 'compare' => '=' ),
    ),
    ) );

    foreach ( $posts as $post_id ) {
    $points = (float) get_post_meta( $post_id, 'points', true );
    $cost = (float) get_post_meta( $post_id, 'cost', true );
    $total += $points * $cost;
    }

    return 'Total withdrawn: <strong>' . esc_html( number_format( $total, 2 ) ) . '</strong>';} );

    Thanks & Regards
    WP Experts Support Team

Viewing 5 replies - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.