Skouat PayPal most recent donor

Extensions, styles and support for everything else about phpBB

Who else would like kasimi to share the mod?

Yes 🤡
1
100%
No 😭
0
No votes
Maybe 😱
0
No votes
Don't give a hoot 🤣
0
No votes
 
Total votes: 1

User avatar
wads24
Distinguished Donor
Posts: 26
Joined: 26 Aug 2018, 02:16
Location: Idaho

Skouat PayPal most recent donor

Post by wads24 »

Hi Kasimi!

Can you share the code edit you did too add most recent donor to the statistics?
Screenshot_20210317-114904_Chrome.jpg
I made the suggestion to skouat here 🤡 :beer: :beer:

Oh! Oh! I guess that mod doesn't work anymore. I just donated and it didn't change to my username. You tricked me kasimi!
😂😭🤡🤣😡🆘😁👀😛🏠
You do not have the required permissions to view the files attached to this post.
I am a crazed lunatic that has desires... :lol: :lol: :D
User avatar
Blasto
Donor
Posts: 2
Joined: 30 Jan 2021, 22:17

Re: Skouat PayPal most recent donor

Post by Blasto »

You could make a sql select from the group and order by join time i guess.
User avatar
wads24
Distinguished Donor
Posts: 26
Joined: 26 Aug 2018, 02:16
Location: Idaho

Re: Skouat PayPal most recent donor

Post by wads24 »

Blasto wrote: ↑22 Mar 2021, 09:22 You could make a sql select from the group and order by join time i guess.
Thanks.
I don't know how to do that... I'll try researching
I am a crazed lunatic that has desires... :lol: :lol: :D
User avatar
Blasto
Donor
Posts: 2
Joined: 30 Jan 2021, 22:17

Re: Skouat PayPal most recent donor

Post by Blasto »

I’ll give it a try tonight for you.
User avatar
wads24
Distinguished Donor
Posts: 26
Joined: 26 Aug 2018, 02:16
Location: Idaho

Re: Skouat PayPal most recent donor

Post by wads24 »

Blasto wrote: ↑24 Mar 2021, 13:35 I’ll give it a try tonight for you.
Sorry to bother you... Did you give it a try?
I am a crazed lunatic that has desires... :lol: :lol: :D
User avatar
kasimi
mChat developer
Posts: 1154
Joined: 06 Oct 2016, 09:56
Location: Germany

Re: Skouat PayPal most recent donor

Post by kasimi »

  • Latest donor

    In the event skouat.ppde.donors_group_user_add_before, store the latest donor in the config table:

    Code: Select all

    $this->config->set('latest_donor_id', $event['payer_id'] ?: ANONYMOUS);
    Alternatively, you can fetch it from the database on ever page load but remember to cache the query result.

    In the event core.index_modify_page_title, fetch user info for the latest donor and send the data to the template:

    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']),
    ]);
    With this entry in a language file:

    Code: Select all

    'LATEST_DONOR' => 'Thanks to the latest donor <strong>%1$s</strong>',
    you can then render it in your template file, for example:

    Code: Select all

    {{ lang('LATEST_DONOR', LATEST_DONOR, LATEST_DONOR_COLOR) }}
  • Donation amount over the last 30 days

    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),
    ]);
    
    With this entry in a language file:

    Code: Select all

    'DONATE_RECEIVED' => 'Donations over the last %1$d days <strong>%2$s</strong>',
    you can then render it in your template file, for example:

    Code: Select all

    {{ lang('DONATE_RECEIVED', DONATE_DAYS, DONATE_AMOUNT) }}
User avatar
wads24
Distinguished Donor
Posts: 26
Joined: 26 Aug 2018, 02:16
Location: Idaho

Re: Skouat PayPal most recent donor

Post by wads24 »

Thanks I'll give it a try...

I donated to your site a while ago and I didn't see the username change at the bottom of your website. Do these modifications work with the new version of scout PayPal?
I am a crazed lunatic that has desires... :lol: :lol: :D
User avatar
kasimi
mChat developer
Posts: 1154
Joined: 06 Oct 2016, 09:56
Location: Germany

Re: Skouat PayPal most recent donor

Post by kasimi »

Good question. I'm not running the latest version. Time for an update I guess. :)

Who is online

Users browsing this forum: CCBot [Bot], SEMrush [Bot] and 0 guests