Here you go:
1- First create a new user profile field in your admincp, make it admin viewable/editable only, note its ID.
2- Create a new template (in all template sets) with this name: "error_unallowedip". Its content is:
"Your IP is not in the allowed IP pool for this user!"
edit functions.php, find:
PHP Code:
global $enablebanning,$banip,$webmasteremail,$session;
Replace it as:
PHP Code:
global $enablebanning,$banip,$webmasteremail,$session,$bbuserinfo;
find:
PHP Code:
$addresses=explode(" ", preg_replace("/[[:space:]]+/", " ", $banip) );
while (list($key,$val)=each($addresses)) {
if (strstr(" ".$ipaddress," ".trim($val))!="") {
eval("standarderror(\"".gettemplate("error_banip")."\");");
}
}
}
AFTER THAT add:
PHP Code:
$banip2 = trim($bbuserinfo['fieldX']);
if ($banip2 and $bbuserinfo['userid']>0)
{
$ipaddress=getenv("REMOTE_ADDR");
$addresses2=explode(" ", preg_replace("/[[:space:]]+/", " ", $banip2) );
while (list($key,$val)=each($addresses2))
{
if (trim($val) AND substr($ipaddress,0,strlen(trim($val)))==trim($val)) {$IPallowed=1;}
}
if ($IPallowed==0) {eval("standarderror(\"".gettemplate("error_unallowedip")."\");");}
}
(Replace X with your userprofilefield ID!)
Now you can enter allowed IPs for any member to the userprofile field in their edit user page in your admin cp. Seperate IPs with space and you can use partial IP's too. If you enter IPs to this field for a user, user will be disallowed access if his IP does not match to any IPs in that pool. If you leave that field blank or if user is guest, he won't be affected by this hack.
Enjoy.