UBB.Dev
Posted By: Anno Finished-[6.5] Time ban and notifications 1.04 - 10/14/2004 11:34 AM
Mod Name / Version: Time ban and notifications 1.04

Version 1.04

Description:
In previous versions of UBBThreads there has been a notification of staff when a user was banned or unbanned.
In the 6.5 this feature disappeared.
This mod ads this feature back.
In addition to this the mod adds the ability to specify the ban duration. If the user tries to login before the ban time is over, he is shown the time that still remains until he is going to be unbanned. After the time is over, the user is automatically unbanned when he tries to login.
The banned user receives an email about his ban, the ban reason and the ban duration. He also receives an email if he is manually unbanned.

Working Under: UBB.Threads 6.5

Mod Status: Finished

Any pre-requisites: none

Author(s): Anno

Date: 10/14/04

Credits: Ythan for testing and bug finding

Files Altered:
/admin/showuser.php
/admin/changeuser.php
/templates/default/admin/showuser.tmpl
/ubbt.inc.php

New Files:
none

Database Altered:
yes

Info/Instructions:
In the attachment.

Disclaimer: Please backup every file that you intend to modify.
If the modification modifies the database, it's a good idea to backup your database before doing so.

Note: If you modify your UBB.Threads code, you may be giving up your right for "official" support from Infopop.If you need official support, you'll need to restore unmodified files.
"2132 Views"

The spiders seem busy.....
Nice!
Posted By: Anno Re: Finished-[6.5] Time ban and notifications 1.01 - 10/16/2004 11:38 AM
A small bug was found where the status of a time banned user was set to permanaent if his profile was edited after the ban.

If you already installed the mod, then

in admin/changeuser.php

## Search for:
if ($user['U_Status'] == "Administrator") {
$updatestatus = ",U_Status = '$newstatus'";
}
else {
$updatestatus = "";
}

## Replace with:
if ($user['U_Status'] == "Administrator") {
$updatestatus = ",U_Status = '$newstatus'";
}
else {
$updatestatus = "";
}

//if the status changed insert the ban duration an reason, else not
$ubanover = "";
$ubanreason = "";
if ($check != $isbanned) { /* status changed */
$ubanover = ",U_BanOver = '$banover'";
$ubanreason = ",U_BanReason = '$banreason'";
}


## Search for:
U_FloodControl = '$floodcontrol',
U_BanOver = '$banover',
U_BanReason = '$banreason'

## Replace with:
U_FloodControl = '$floodcontrol'
$ubanover
$ubanreason


That's it.

I will update the instructions in he attachement.
When writing in ban time and ban comment, but forgetting to uncheck the Member has Access Rights? it still sends PM's to admins and mods, would it not be smart to have a check for that field beeing unchecked, or automaticly uncheck when ban reason and/or time have been entered?
>When writing in ban time and ban comment, but forgetting to uncheck the Member
>has Access Rights? it still sends PM's to admins and mods

It doesn't. There is a check in place if the status changed, and only THEN it sends the notification.

This is the part of the code that does the check:

if ($check != $isbanned) {
//the status changed, let's motify the admins and mods
Hmm, strange, thouht I did all according to instructions, have to check thorugh then and find my bug....
I have no clue on what I am talking about, but I did not get it to work in 6.5 without some changes.

Since $isbanned always was 1 in my test, i was banning another moderator as test... this is when it always sent an banned PM (maybe mail) even if the $hasaccess checkbox was not changed... is this check if status moderator to avoid banning of mods? I never tried banning a normal user btw. but are experimenting there maybe now... if i have time.

I changed like this, and now it works for me, thought i dont really know what I have done

if ($hasaccess == "1") {
$isbanned = "0";
}
else {
$isbanned = "1";
}

Then later when one used showuser.php to look for the ban status it always said permanently banned... so i had to change the list(x,x,x,x,x) thing to fetch variables $banover and $banreason from the query...

list(xxxxxxxxxxxxxxxx,$floodcontrol,$banover,$banreason)=$dbh->fetch_array($sth);

have no clue what I am doing wrong from the start, does any of this make any sense, i am really newbie in php things...
I use a modified version of this for a penalty box on IIP
I'm getting the following error when trying to edit a user as an admin:

PHP Parse error: parse error, unexpected $ in /admin/showuser.php on line 714, referer: showprofile.php?Cat=0&User=1981&Board=mkmf&what=ubbthreads&page=0

Since showuser.php doesn't have 714 lines, I'm guessing there's something wrong with showuser.tmpl?

Any ideas (i've tryed adding the mod from scratch two times now)?
I have no such code in changeuser.php (6.5):

Code
## Search for: <br />if ($status == "Moderator") { <br />	$isbanned = "1"; <br />} <br />else { <br />	$isbanned = "0"; <br />} <br />


instead I have:

Code
// If !$hasaccess user is banned. <br />if (!$hasaccess) { <br />	$isbanned = "1"; <br />} <br />else { <br />	$isbanned = "0"; <br />}


shall I apply modification to the code I have?
Opps, yes, this is the right place to add the code, yes.
I would like to assign one of my mods to be able to do time bans. How should I do that please?
Posted By: Anno Re: Finished-[6.5] Time ban and notifications 1.01 - 01/02/2005 12:41 PM
well...the easiest would be to give him permission to edit users. Then he will be able to access this function(but also other functions that deal with user settings)
Small bag in "Time ban and notifications 1.02" Attachment
need to add
#### in admin/showuser.php

## Search for:
list($lname,$dname,$email,$femail,$fullname,$sig,$homepage,$occ,$hobbies,
$loc,$bio,$textcols,$textrows,$extra1,$extra2,$extra3,$extra4,$extra5,
$picture,$visible,$acceptpriv,$onlineformat,$birthday,$showbday,$picwidth,
$picheight,$display,$view,$postsper,$textcols,$textrows,$stylesheet,
$preview,$picview,$picposts,$chosenlanguage,$flatposts,$timeoffset,
$frontpage,$startpage,$showsigs,$timeformat,$ereplies,$notify,$adminemails,
$emailformat,$regdate,$regip,$lastpost,$lastpostip,$rating,$rates,$usertitle,
$namecolor,$status,$banned,$coppa,$groups,$floodcontrol)=$dbh->fetch_array($sth);
## Replace with:
list($lname,$dname,$email,$femail,$fullname,$sig,$homepage,$occ,$hobbies,
$loc,$bio,$textcols,$textrows,$extra1,$extra2,$extra3,$extra4,$extra5,
$picture,$visible,$acceptpriv,$onlineformat,$birthday,$showbday,$picwidth,
$picheight,$display,$view,$postsper,$textcols,$textrows,$stylesheet,
$preview,$picview,$picposts,$chosenlanguage,$flatposts,$timeoffset,
$frontpage,$startpage,$showsigs,$timeformat,$ereplies,$notify,$adminemails,
$emailformat,$regdate,$regip,$lastpost,$lastpostip,$rating,$rates,
$usertitle,$namecolor,$status,$banned,$coppa,$groups,$floodcontrol,
$banover,$banreason)=$dbh->fetch_array($sth);
I don't want any mails to admins or mods when a user is banned by me. Where in the code can I disable the mailing please?
Delete the lines that contain

$html -> send_message
in admin/changeuser.php and/or where else? there are multiple references to that line.
ok...
You don't to notify anybody when the user is banned by you and only you or in general?

If you simply want to disable all PMs on banning occurences, then you simply delete/comment out all those lines. In all the modified scripts.
thank you. logic - slapping myself because I didn't think
Great
I installed it and....

When I wrote any number in ban timer is always display that is pernament ban
Reason of ban doesn't see in PM, but in code, in changeuser.php are lines:

$banreason = $html -> do_markup($banreason);
$banreason =nl2br($banreason);
$banreason = eregi_replace("{$config['images']}", "{$config['imageurl']}" , $banreason);

What is mean "nl2br" in code

I feel that is sth wrong
www.php.net/nl2br

Are you sure you followed the instructions exactly?

Are you sure you followed the instructions exactly? [/]

yes when this 'error' appeared I check all new script again.
Next I rewrite all mods again in new/orginal files - the same result
Hmm....
Give me a day.
Try the instructions in the attachemnt.

Attached File
I noticed with the new instuctions it is missing one thing.

At the end of the editing of the admin/showuser.php file it shows this
---------------
}else{
$banreason_display = <<<END
<textarea name="banreason" rows="5" cols="30" id="banreason"></textarea>
END;
$banduration_display = <<<END
<input type="text" name="banduration" size="5" id="banduration" />
END;
--------------------------

After the last END; there should be a }

It should look like this:
-------------------------
}else{
$banreason_display = <<<END
<textarea name="banreason" rows="5" cols="30" id="banreason"></textarea>
END;
$banduration_display = <<<END
<input type="text" name="banduration" size="5" id="banduration" />
END;

}
--------------------------------
With out that bracket, I ended up getting a Parse Error.

Just thought I would mention it. I was using the Time Ban and Notification 1.03 txt file when I ran into the problem.
You mean in the "old" instructions, the 1.03?
[]UnixSpot said:
I noticed with the new instuctions it is missing one thing.

At the end of the editing of the admin/showuser.php file it shows this
---------------
}else{
$banreason_display = <<<END
<textarea name="banreason" rows="5" cols="30" id="banreason"></textarea>
END;
$banduration_display = <<<END
<input type="text" name="banduration" size="5" id="banduration" />
END;
--------------------------

After the last END; there should be a }

It should look like this:
-------------------------
}else{
$banreason_display = <<<END
<textarea name="banreason" rows="5" cols="30" id="banreason"></textarea>
END;
$banduration_display = <<<END
<input type="text" name="banduration" size="5" id="banduration" />
END;

}
--------------------------------
With out that bracket, I ended up getting a Parse Error.

Just thought I would mention it. I was using the Time Ban and Notification 1.03 txt file when I ran into the problem. [/]

I found it, but here was my bug
When I made copy&pase operations, I had

xxxx = xxxx
in Anno mods is xxxx .= xxxx

And all problems disappeared

Old as in I just downloaded it a few hours ago....
DOH! The attachment/link isn't working...anybody got instructions for this that will work under 6.5.5 ??


nevermind.... it's amazing what you can find when you look right in front of ya (or a few posts above your new one), lol
© UBB.Developers