Phoenix, Thanks a lot for that - I'm also away for the next two weeks so won't be able to do much with it until then. Its quite possible that the other site admin will be on here and take this forward though. Otherwise I'll look forward to getting stuck in when I get back.
I've modified the code, but it's not in the download yet, so that,
the list of proposed ranks is shown (as before)
the red button displays to implement the change (as before)
when clicked, the change happens automatically (based on rank title) and immediately returns to the listing i.e. all done in a fraction of a second, and ready to change the next one you choose.
At this point the changed rank will convert to the green button, signifying completion - it's clean and tidy, but does popup an alert asking you if you really meant to change the rank.
The more I think about it, it's better to just add an extra field for the rank minimum amount to the bbranks table and work directly from that table - a quick review of Dragonfly core code tells me that adding the extra field shouldn't conflict with a 'vanilla' core (also cuts out a db query).
Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Transition complete - as mentioned above, plus it now works off an extra field in the bbranks table, without any apparent conflicts with the existing ranks administration.
Also supporters can see their own data like proposed rank, donations, and last donation date - it does provide a plain red button if there is a rank disparity.
Non-supporter users just see basic PM, rank and date joined. Non-users just see rank and date joined, if they are allowed to view the module.
I'll package the new download, v9.1.2, later today.
Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
PhoenixOffline
Joined: Mar 18, 2004
Posts: 1543
Location: Netosphere
Phoenix - this is superb and straight away led me to an email problem where we'd missed Paypal's emails and therefore had a list of rank / donation mismatches, so very very useful right from the outset.
I do have a couple of anomalies though where the treasury module recognizes that a donation has been made, and this can be seen on the users profile page as well as in the treasury payment list, but he is not showing up in the supporters list.
I'm going to have to stop for a while now, but will try and work out what the difference is between his details and someone else who is showing up. Perhaps is user error too (I'm 'the other admin' so coming in a little blind on this).
Attachment:
padbeat.gif
Description
Filesize
12.88 KiB
Viewed
9 Time(s)
You are not allowed to view/download this attachment
Please enter your server specs in your user profile! 😢
PhoenixOffline
Joined: Mar 18, 2004
Posts: 1543
Location: Netosphere
hmm, Supporters is generated by joining users table and treasury table on user_id, so it's most probable (especially from earlier versions where user_id wasn't used) that padbeat is missing his user_id in the _trans_trans table.
However, if you were to edit (without changing anything) padbeat's transactions, the table should update the missing user_id just from saving the transaction and padbeat should magically appear in Supporters
Now that we have Supporters, we could (with an option to allow it) automatically update ranks when a donation is received, excepting those with special ranks not designated as supporter ranks e.g. mods, admins, etc. This still leaves Supporters as a quick check that all is okay.
It might also be helpful to have a link that permits manual adjustment of ranks for those special ones you have for mods etc.
Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
So to put this right do you see any problem with this:
<?php
//Basic report
$duffEntries = $db->sql_count($prefix."_treas_trans where user_id = '0' AND custom IS NOT NULL");
echo("There are $duffEntries entries in your treasury table where a user id is not defined and should be");
//Uncomment to go for it!
/*
echo("<br/>Running the update script<br />");
$sql = "SELECT t.id, u.user_id
FROM ".$user_prefix."_users u
JOIN ".$prefix."_treas_trans t
ON u.username = t.custom
WHERE t.user_id = '0' AND t.custom IS NOT NULL";
$result = $db->sql_query($sql);
if ($row = $db->sql_fetchrow($result))
{
do
{
$sql = "update ".$prefix."_treas_trans set user_id = ".$row['user_id']." where id = ".$row['id'];
$db->sql_query($sql);
}
while ( $row = $db->sql_fetchrow($result) );
}
$duffEntries = $db->sql_count($prefix."_treas_trans where user_id = '0' AND custom IS NOT NULL");
echo("There are $duffEntries entries in your treasury table where a user id is not defined and should be");
*/
?>
Please enter your server specs in your user profile! 😢
Last edited by hqarrse on Sun Mar 18, 2007 3:46 am; edited 1 time in total
An addition to try and sweep up some username changes and other oddities:
echo("<br/>Running EMail Address Comparison<br />");
$sql = "SELECT t.id, u.user_id
FROM ".$user_prefix."_users u
JOIN ".$prefix."_treas_trans t
ON t.payer_email = u.user_email WHERE t.user_id = '0' AND length(u.user_email) > 4";
$result = $db->sql_query($sql);
if ($row = $db->sql_fetchrow($result))
{
do
{
$sql = "update ".$prefix."_treas_trans set user_id = ".$row['user_id']." where id = ".$row['id'];
$db->sql_query($sql);
}
while ( $row = $db->sql_fetchrow($result) );
}
$duffEntries = $db->sql_count($prefix."_treas_trans where user_id = '0' AND custom IS NOT NULL");
echo("There are $duffEntries entries in your treasury table where a user id is not defined and should be after email comparison");
Pretty simplistic but *seems* to have worked with a few exceptions, which !
Automatic idea would be very good for us with the comment you made about special ranks being left for manual control, and also no automatic 'demotion'.
I've just been toying with ideas for monitoring this automation - 'automatic change made' flag and so on, but I don't think anything like that is necessary, just an enable / disable option.
Please enter your server specs in your user profile! 😢
PhoenixOffline
Joined: Mar 18, 2004
Posts: 1543
Location: Netosphere
hmm, you did have some oddities, but hardly surprising given the changes in treasury, plus my occasional screw-up, and the risk with manual additions (though that was tightened up recently). In theory, your remaining exceptions should only be genuine non-member donations.
Since we have a rank_value for special ranks used for supporters, it's a pretty easy check for zero value to ensure that non-supporter special ranks remain untouched.
I guess an extra field could be added to the _treas_trans table to signify a rank change occurred with that last donation. Simplest way to add the option will be to add it to the _config_custom table, and trigger it from Supporters admin since that is required for it to work.
One downside - if you do have an anomaly where a supporter has a higher rank than treasury indicates, it will reduce the rank. I do have such a scenario myself on one site.
Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
I hope I didn't offend by those posts - they were in no way meant as negative, just as a possible help and for you comment. The data in the table I was trying them on has had every generation of your module, fiddled with and broken by us at times in the past, and may have even been taken across from an older phpnuke one a few years ago (I can't remember), so some anomalies were inevitable!
Phoenix,
Just to clear up a bit of confusion ..... (hopefully) ....
I have been posting on here as hqarrse until the top of this page. From then on its been the other site admin. He also uses the handle hqarrse on the main Dragonfly site so we've decided that it would be easier for him to adopt it on here too.
My user on DF is BadCO so I've adopted the same one on here ..... hopefully all is clear now?
Now back on topic - the supporters module is looking excellent and definitely a big improvement for us. I gather that hqarrse's script revealed several hundred discrepancies but then we have been running variants of this module for at least 2-3 years. In fact it may even have crossed over when we transferred from phpnuke in 2004 .....
There can be only one
Please enter your server specs in your user profile! 😢