Create fundraisers leaderboard in Fundraising

Hi,

I am just wondering if it is possible to set up a fundraisers leaderboard.

E.g. We have a service club that is holding an event for us, and ideally we would like to be able to create a leaderboard that is just from that fundraiser. I have used advanced custom fields to enable people to enter the "group" they are a part of, but I don't know how to use that data to create a leaderboard, or if it is possible.

Help would be greatly appreciated! :slight_smile:

  • Jude
    • DEV MAN

    Hey @Georgie

    While this is possible it will need quite a bit of custom code to work smoothly. You basically need a function to loop through the raised donations and sort by the custom groups field you created and sum the totals and store this as a new record.

    Then finally do an ASC sort on the newly created record and pretty print it on the front end as a table and Viola !! Leaderboard !

    Of course if you are not familiar with custom code please take a look at our jobs board

    https://premium.wpmudev.org/wordpress-development/

    Cheers
    Jude

  • Georgie
    • Flash Drive

    Hi Jude

    Thanks for your reply! I'm fairly new to php but what I lack in skill I make up for in perseverance! As it's for a charity we're trying to keep our costs as low as possible so I will give it a go first.

    I think I can do what you have suggested, but I have a further question. Would it be possible to keep track of it if one user had created multiple fundraisers? So say in February I decide to give up coffee and raise $300, then in June I run a fun run and raise about $200. Will it be possible to show the total of both fundraisers on the board and, preferably, on the buddy press profile?

    Thanks again!

  • Georgie
    • Flash Drive

    Hi!

    Sorry to bother you again.

    I have gotten to the point where I can display a list of user names & have isolated the donation, but it just says 'manual payment' instead of the dollar amount. How can I get it to print the actual amount? I've looked through the tables as suggested but am not seeing the answer easily!

    Cheers

    Georgie

  • Georgie
    • Flash Drive

    Hi, could someone help please? :slight_smile:

    This is my code so far:

    $args = array(
        'post_type' => 'donation',
    );
    $loop = new WP_Query($args);
    
    while($loop->have_posts()): $loop->the_post();
    
    the_title();
    
    endwhile;
    wp_reset_query();

    Obviously it shouldn't be calling the_title() but I have no idea what to put in it to call the donation amount. I have tried pledge_amount, get_donation_amount() and wdf_donation_amount but I get nothing. I can't find the right meta key in the table.

    Thanks so much!

  • Jude
    • DEV MAN

    Hey @Georgie

    Sorry about the delay here

    You need to take a look at the wdf_transaction key in the wp_postmeta table. It has a serialized array with all the data about the donation. You need to extract the donation amount from here

    Hope that helps

    Cheers
    Jude

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.