• Resolved deschildred

    (@deschildred)


    I want to display the history of all donations on one page. When I’m using the shortcode [donation_history] it only displays my own donations.

    How do I display a table with date, name and amount of donation?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor Matt Cromwell

    (@webdevmattcrom)

    Hi @deschildred

    If I understand you correctly you want to show ALL donations, regardless of which donor they come from publicly? There is a way to do that with custom code, but I would suggest you also consider that some donors do not want their info displayed that way. Just something to consider.

    We have an example shortcode here which — if you are experienced with PHP — you could customize to your purposes: https://github.com/WordImpress/Give-Snippet-Library/blob/master/useful-queries/better-donor-list-shortcode.php

    If you customize it and run into issues, post your code as a Gist or Pastebin and I’ll take a look and can provide more guidance.

    Keep in mind that this is a custom solution and falls outside the scope of our Support. We provide it to you as an example of how you can extend and customize Give with code, but once you put it on your site, it is fully your responsibility. That said, we encourage you to experiment with snippets like this (in a safe environment) as much as you can.

    Hello There,

    I’ve used the code you show at better-donor-list-shortcode.php as I want to do the same thing as the original post..
    See code there: https://pastebin.com/ebhLK5vh
    result display: https://pastebin.com/TMrruvdk

    with light changes:
    (1) hiding the name.. for now replaced with Anonymous, where would I need to go to change the label of the field to say that the first name would be public, to write first name accordingly. etc. (or if I’d like to add a field that would be the public name).

    (2) added the date.. Is there a place to see/know what variables/columns are accessible?

    (3) btw, code seems to have hiccup.. it shows only 10 last donations?.. Is there a way to show it all? or display numbers of available records, idk. looking for way to show all completed individual donations. Am almost there.

    Thanks!!
    Pascal

    Hello!

    me again,

    (1) still don’t know how to do that one.
    (2) I’ve found how to display post and arrays and etc.
    (3) I’ve found how to display 100 last donations.
    (3.1) How do I display only completed transactions. It seems that there are a lot of pendings, failed, and so on. I just want the completed ones to show.

    That’s what I have right now.
    https://pastebin.com/NtYVzhCH

    Thanks!

    Hello

    (3) is resolved
    This is how you can display only the completed donations, by adding the post_status line shown here to previous code pasted in pastebin link.

    	$args = array(
    		'post_type'      => 'give_payment',
    		'post_status'	=> 'publish',
    		'posts_per_page' => 10000,//$atts['number'],
    	);
    Plugin Contributor Matt Cromwell

    (@webdevmattcrom)

    I just tested your code and it looks like you resolved #1 as well. Well done!

    Let us know if you have other questions at all.

    Hello Matt! thanks!

    actually, i locked it to anonymous.. hardcoded.. I’m considering adding a radio button to ask if the donor wants the “first name” public or not. Giving the option, and, would only display the first_name field.

    if not
        last_name = CAT(first_name, Last_name)
        first_name = "donor"
    end

    this way, no changes to database or anything, i’d just parasite the donation form php code, and change the variable before it’s saved. And on the donation_history, i’d always display the adjusted first_name field.

    Just not sure yet in which php file I should add that radio button… it would be in the form where they fill first_name, last_name. Any hints of where to look would save me from lots of digging!

    thanks & Happy New Year!
    Pascal

    Plugin Contributor Matt Cromwell

    (@webdevmattcrom)

    Hey Pascal,

    I’d highly encourage just saving their checkbox choice as part of the Give payment meta. Keeping actual records of your donors is important for tax purposes and for their own donation history. I think going that route could end up causing you all kinds of problems that you might not anticipate down the road.

    Once you are storing the checkbox state to payment meta, you could just update your existing code to this:

    $anon      = $getmeta['anonymous'];
    $name = ( ($anon == true) ? 'Anonymous' : $firstname );
    ?>
    
    <strong><?php echo $name; ?></strong> donated <strong>$<?php echo $total; ?></strong> on the <?php echo $la_date ?>.<br>

    But if you want to make any customizations to the Give form directly, DO NOT do it to the core plugin at all. Give is highly extensible and made to customize with snippets, and with your theme. Here’s our docs on “Themeing with Give” which describes in detail how you can customize your Give forms through your theme files:
    https://givewp.com/documentation/developers/themeing-with-give/

    Thanks!

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

The topic ‘Donation History’ is closed to new replies.