PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.6.6
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.6.6
1.8.13 1.8.12.3 1.8.12.2 1.8.12.1 1.8.12 1.8.11.3 1.8.11.2 1.8.11.1 1.8.11 1.6.6 1.6.60 1.6.7 1.6.8 1.6.9 1.7.0 1.7.0.1 1.7.0.11 1.7.0.12 1.7.0.14 1.7.0.2 1.7.0.3 1.7.0.5 1.7.0.6 1.7.0.7 1.7.0.9 All 211 releases
charitable / templates / shortcodes / my-donations.php

my-donations.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.6.6, at templates/shortcodes/my-donations.php

176 lines 5.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Displays a table of the user's donations, with links to the donation receipts.
4 *
5 * Override this template by copying it to yourtheme/charitable/shortcodes/my-donations.php
6 *
7 * @author Studio 164a
8 * @package Charitable/Templates/Account
9 * @since 1.4.0
10 * @version 1.6.0
11 */
12
13 // Exit if accessed directly.
14 if ( ! defined( 'ABSPATH' ) ) {
15 exit;
16 }
17
18 $user = array_key_exists( 'user', $view_args ) ? $view_args['user'] : charitable_get_user( get_current_user_id() );
19 $donations = $view_args['donations'];
20
21 /**
22 * Do something before rendering the donations.
23 *
24 * @param object[] $donations An array of donations as a simple object.
25 * @param array $view_args All args passed to template.
26 */
27 do_action( 'charitable_my_donations_before', $donations, $view_args );
28
29 if ( empty( $donations ) ) : ?>
30
31 <p><?php _e( 'You have not made any donations yet.', 'charitable' ); ?></p>
32
33 <?php else : ?>
34
35 <table class="charitable-my-donations charitable-table">
36 <thead>
37 <tr>
38 <th scope="col"><?php _e( 'Date', 'charitable' ); ?></th>
39 <?php
40 /**
41 * Add a column header after the donation date header. Any output should be wrapped in <th></th>.
42 *
43 * @since 1.5.0
44 *
45 * @param object[] $donations An array of donations as a simple object.
46 * @param array $view_args All args passed to template.
47 */
48 do_action( 'charitable_my_donations_table_header_after_date', $donations, $view_args );
49 ?>
50 <th scope="col"><?php _e( 'Campaign', 'charitable' ); ?></th>
51 <?php
52 /**
53 * Add a column header after the campaign header. Any output should be wrapped in <th></th>.
54 *
55 * @since 1.5.0
56 *
57 * @param object[] $donations An array of donations as a simple object.
58 * @param array $view_args All args passed to template.
59 */
60 do_action( 'charitable_my_donations_table_header_after_campaigns', $donations, $view_args );
61 ?>
62 <th scope="col"><?php _e( 'Amount', 'charitable' ); ?></th>
63 <?php
64 /**
65 * Add a column header after the amount header. Any output should be wrapped in <th></th>.
66 *
67 * @since 1.5.0
68 *
69 * @param object[] $donations An array of donations as a simple object.
70 * @param array $view_args All args passed to template.
71 */
72 do_action( 'charitable_my_donations_table_header_after_amount', $donations, $view_args );
73 ?>
74 <th scope="col"><?php _e( 'Status', 'charitable' ); ?></th>
75 <?php
76 /**
77 * Add a column header after the status header. Any output should be wrapped in <th></th>.
78 *
79 * @since 1.5.4
80 *
81 * @param object[] $donations An array of donations as a simple object.
82 */
83 do_action( 'charitable_my_donations_table_header_after_status', $donations );
84 ?>
85 <th scope="col"><?php _e( 'Receipt', 'charitable' ); ?></th>
86 <?php
87 /**
88 * Add a column header after the receipt header. Any output should be wrapped in <th></th>.
89 *
90 * @since 1.5.0
91 *
92 * @param object[] $donations An array of donations as a simple object.
93 * @param array $view_args All args passed to template.
94 */
95 do_action( 'charitable_my_donations_table_header_after_receipt', $donations, $view_args );
96 ?>
97 </tr>
98 </thead>
99 <tbody>
100 <?php foreach ( $donations as $donation ) : ?>
101 <tr>
102 <td><?php echo mysql2date( 'F j, Y', get_post_field( 'post_date', $donation->ID ) ); ?></td>
103 <?php
104 /**
105 * Add a cell after the donation date. Any output should be wrapped in <td></td>.
106 *
107 * @since 1.5.0
108 *
109 * @param object $donation The donation as a simple object.
110 * @param array $view_args All args passed to template.
111 */
112 do_action( 'charitable_my_donations_table_after_date', $donation );
113 ?>
114 <td><?php echo $donation->campaigns; ?></td>
115 <?php
116 /**
117 * Add a cell after the list of campaigns. Any output should be wrapped in <td></td>.
118 *
119 * @since 1.5.0
120 *
121 * @param object $donation The donation as a simple object.
122 * @param array $view_args All args passed to template.
123 */
124 do_action( 'charitable_my_donations_table_after_campaigns', $donation );
125 ?>
126 <td><?php echo charitable_format_money( $donation->amount ); ?></td>
127 <?php
128 /**
129 * Add a cell after the donation amount. Any output should be wrapped in <td></td>.
130 *
131 * @since 1.5.0
132 *
133 * @param object $donation The donation as a simple object.
134 * @param array $view_args All args passed to template.
135 */
136 do_action( 'charitable_my_donations_table_after_amount', $donation );
137 ?>
138 <td><?php echo charitable_get_donation( $donation->ID )->get_status_label(); ?></td>
139 <?php
140 /**
141 * Add a cell after the donation status. Any output should be wrapped in <td></td>.
142 *
143 * @since 1.5.4
144 *
145 * @param object $donation The donation as a simple object.
146 */
147 do_action( 'charitable_my_donations_table_after_status', $donation );
148 ?>
149 <td><a href="<?php echo esc_url( charitable_get_permalink( 'donation_receipt_page', array( 'donation_id' => $donation->ID ) ) ); ?>"><?php _e( 'View Receipt', 'charitable' ); ?></a></td>
150 <?php
151 /**
152 * Add a cell after the link to the receipt. Any output should be wrapped in <td></td>.
153 *
154 * @since 1.5.0
155 *
156 * @param object $donation The donation as a simple object.
157 * @param array $view_args All args passed to template.
158 */
159 do_action( 'charitable_my_donations_table_after_receipt', $donation, $view_args );
160 ?>
161 </tr>
162 <?php endforeach ?>
163 </tbody>
164 </table>
165
166 <?php
167 endif;
168
169 /**
170 * Do something after rendering the donations.
171 *
172 * @param object[] $donations An array of donations as a simple object.
173 * @param array $view_args All args passed to template.
174 */
175 do_action( 'charitable_my_donations_after', $donations, $view_args );
176