Could you provide instructions what file to open, find and replace it add before or after...?kasimi wrote: ↑23 May 2021, 19:33
- Latest donor
In the eventskouat.ppde.donors_group_user_add_before
, store the latest donor in the config table:Alternatively, you can fetch it from the database on ever page load but remember to cache the query result.Code: Select all
$this->config->set('latest_donor_id', $event['payer_id'] ?: ANONYMOUS);
In the eventcore.index_modify_page_title
, fetch user info for the latest donor and send the data to the template:
With this entry in a language file:Code: Select all
$row = $this->user_loader->get_user($this->config['latest_donor_id'], true); $this->template->assign_vars([ 'LATEST_DONOR' => get_username_string('full', $this->config['latest_donor_id'], $row['username'], $row['user_colour']), 'LATEST_DONOR_COLOR' => $row['user_id'] == ANONYMOUS ? 'inherit' : ('#' . $row['user_colour']), ]);
you can then render it in your template file, for example:Code: Select all
'LATEST_DONOR' => 'Thanks to the latest donor <strong>%1$s</strong>',
Code: Select all
{{ lang('LATEST_DONOR', LATEST_DONOR, LATEST_DONOR_COLOR) }}
- Donation amount over the last 30 days
With this entry in a language file:Code: Select all
$days = 30; $sql_queries = ' SELECT SUM(CASE WHEN t.settle_amount = 0 THEN t.mc_gross ELSE t.settle_amount END) AS donations_sum FROM ' . $this->table_transactions . ' t WHERE t.test_ipn = 0 AND t.confirmed = 1 AND t.payment_date >= UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL ' . $days . ' DAY))'; $result = $this->db->sql_query($sql, 3600); $donations_sum = $this->db->sql_fetchfield('donations_sum', 0, $result); $this->db->sql_freeresult($result); $this->template->assign_vars([ 'DONATE_DAYS' => $days, 'DONATE_AMOUNT' => (int) round($donations_sum), ]);
you can then render it in your template file, for example:Code: Select all
'DONATE_RECEIVED' => 'Donations over the last %1$d days <strong>%2$s</strong>',
Code: Select all
{{ lang('DONATE_RECEIVED', DONATE_DAYS, DONATE_AMOUNT) }}
I'm not sure which files to make edits.