Needs work
Project:
Blacklist
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
19 Nov 2009 at 13:03 UTC
Updated:
19 Apr 2013 at 12:36 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
jpramas commentedthere's an easy fix for this ... and I mean easy ... I'm not a coder - just someone who has been a Drupal project manager and knows how to open up a module file with a code editor like Smultron ...
so, to get a longer-lasting blacklist for bad naughty people, just go into your Drupal server files, then find your Blacklist folder in your modules folder, open it up and then edit the blacklist.module file as follows:
find the following code on lines 452 and 453 of the blacklist.module file
function _expiration() {
return array(900, 1800, 3600, 7200, 10800, 21600, 32400, 43200, 64800, 86400, 172800, 259200, 604800, 1209600, 2419200);
note that these are the numbers of seconds that correspond to the time drop-down menu in the Blacklist Add tab - where you add people to your blacklist ...
simply add the number of seconds corresponding to a 1 year ban and a 10 year ban; so the relevant code now looks like this
function _expiration() {
return array(900, 1800, 3600, 7200, 10800, 21600, 32400, 43200, 64800, 86400, 172800, 259200, 604800, 1209600, 2419200, 31556926, 315569260);
save and close
go back and try adding someone to your blacklist and you'll find that you can ban someone for 1 year and 5 hours, and 10 years and 2 days ... which may not be forever but is as close as you can get with my little fix ... I tried to do a 100 year ban, but the system wouldn't accept it when I tried to use it on a blacklisted user ...
anyhow, this should solve your problem ... and if your site is still around in 10 years and 2 days, I will happily congratulate you ...
;>
Comment #2
stborchert@jpramas: this is 1) not a patch and 2) not a real solution.
Comment #3
jpramas commentedwell, it's an option and it works for all practical purposes ... but if you'd rather not use it, you're obviously free not to do so ... just trying to help out since the developers apparently didn't ... and note, I didn't mark the status "fixed" ...
Comment #4
senpai commentedWorking on this today. My plan is to add a 'never' option to the dropdown list, then change the _find_expiration() function so that it only evaluates the time-to-expire if the $time_left is greater than 0.
Comment #5
senpai commentedHere we go. Thanks to kscheirer for the MySQL Doomsday Time of 2147483647, and to comment #1 for the 100-year inspiration.
See the screenshots for the details on how this patch is supposed to work. I sure hope this gets in, cause we're rolling out this patched module for Qualcomm at the end of the month.
and
Comment #6
snufkin commentedWould it not be nicer for the user to simply treat the never option as a special case? Still the 27 year expiration is a bit confusing, plus if you want to sort by Expiration you wont find users who are blacklisted for eternity.
Comment #7
senpai commentedIf you're OK with me adding another column to the DB table in order to house an 'expires?' boolean, I'll do it. ;)
Of course, I could also just theme the Blacklisted Users page so that if the date('2147483647') it'll output a "never" string...
Which way is better for the module?
Comment #8
colinstillwell commentedI know this issue is extremely old, but thought I would share this anyway. One of the sites I am maintaining for a client uses Drupal 5 and required this exact functionality. The patch attached earlier in this issue almost worked for 5, but needed tweaking slightly. I have attached a revised version for Drupal 5 if anyone needs it!
Comment #9
snufkin commentedWhat version did you do the patch against? I can't apply it to the d6 dev, would you do us a favour and reroll for that? I am not sure if i'll have enough time to review much of the patch, but if it cleanly applies to 6 dev i am happy to add it and roll a new release.
Comment #10
colinstillwell commentedHi Snufkin,
My patch is for Drupal 5, not 6. The patch earlier in this issue relates to 6 and mine makes it work for 5. May have been a better idea for me to create a seperate issue? Not sure, I am new here so apologies :-).
Cheers,
Colin.
Comment #11
snufkin commentedAh I see. I'll roll it into the 5.x branch then, we can port it to D6 later.
Comment #12
snufkin commentedThis is now committed to D5, thanks (http://drupalcode.org/project/blacklist.git/commit/705b2dc). I'll switch the version now back to D6.
Comment #13
colinstillwell commentedLovely stuff :-)