Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: May 2001
Posts: 550
Code Monkey
Code Monkey
Offline
Joined: May 2001
Posts: 550
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.

Last edited by Anno; 01/20/2005 3:32 AM.
Sponsored Links
Joined: May 2001
Posts: 550
Code Monkey
Code Monkey
Offline
Joined: May 2001
Posts: 550
"2132 Views"

The spiders seem busy.....

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Nice!

Joined: May 2001
Posts: 550
Code Monkey
Code Monkey
Offline
Joined: May 2001
Posts: 550
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.

Joined: Aug 2002
Posts: 32
User
User
Offline
Joined: Aug 2002
Posts: 32
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?


Organizer
Sponsored Links
Joined: May 2001
Posts: 550
Code Monkey
Code Monkey
Offline
Joined: May 2001
Posts: 550
>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

Joined: Aug 2002
Posts: 32
User
User
Offline
Joined: Aug 2002
Posts: 32
Hmm, strange, thouht I did all according to instructions, have to check thorugh then and find my bug....


Organizer
Joined: Aug 2002
Posts: 32
User
User
Offline
Joined: Aug 2002
Posts: 32
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...

Last edited by Organizer; 11/13/2004 8:39 PM.
Joined: Oct 2003
Posts: 2,305
Old Hand
Old Hand
Joined: Oct 2003
Posts: 2,305
I use a modified version of this for a penalty box on IIP

Joined: Oct 2004
Posts: 1
Lurker
Lurker
Offline
Joined: Oct 2004
Posts: 1
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)?

Sponsored Links
Joined: Dec 2004
Posts: 36
Junior Member
Junior Member
Offline
Joined: Dec 2004
Posts: 36
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?


nosleep
Joined: May 2001
Posts: 550
Code Monkey
Code Monkey
Offline
Joined: May 2001
Posts: 550
Opps, yes, this is the right place to add the code, yes.

Joined: Dec 2004
Posts: 36
Junior Member
Junior Member
Offline
Joined: Dec 2004
Posts: 36
I would like to assign one of my mods to be able to do time bans. How should I do that please?


nosleep
Joined: May 2001
Posts: 550
Code Monkey
Code Monkey
Offline
Joined: May 2001
Posts: 550
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)

Joined: Oct 2003
Posts: 23
User
User
Joined: Oct 2003
Posts: 23
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);

Last edited by JoshPet; 01/29/2005 3:17 PM.

Sorry for my english.
Joined: Dec 2004
Posts: 36
Junior Member
Junior Member
Offline
Joined: Dec 2004
Posts: 36
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?


nosleep
Joined: May 2001
Posts: 550
Code Monkey
Code Monkey
Offline
Joined: May 2001
Posts: 550
Delete the lines that contain

$html -> send_message

Joined: Dec 2004
Posts: 36
Junior Member
Junior Member
Offline
Joined: Dec 2004
Posts: 36
in admin/changeuser.php and/or where else? there are multiple references to that line.


nosleep
Joined: May 2001
Posts: 550
Code Monkey
Code Monkey
Offline
Joined: May 2001
Posts: 550
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.

Joined: Dec 2004
Posts: 36
Junior Member
Junior Member
Offline
Joined: Dec 2004
Posts: 36
thank you. logic - slapping myself because I didn't think


nosleep
Joined: Jan 2003
Posts: 338
Enthusiast
Enthusiast
Offline
Joined: Jan 2003
Posts: 338
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

Joined: May 2001
Posts: 550
Code Monkey
Code Monkey
Offline
Joined: May 2001
Posts: 550
www.php.net/nl2br

Are you sure you followed the instructions exactly?

Joined: Jan 2003
Posts: 338
Enthusiast
Enthusiast
Offline
Joined: Jan 2003
Posts: 338

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

Joined: May 2001
Posts: 550
Code Monkey
Code Monkey
Offline
Joined: May 2001
Posts: 550
Hmm....
Give me a day.

Joined: May 2001
Posts: 550
Code Monkey
Code Monkey
Offline
Joined: May 2001
Posts: 550
Try the instructions in the attachemnt.
Attachments

Joined: Jun 2002
Posts: 47
User
User
Offline
Joined: Jun 2002
Posts: 47
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.

Joined: May 2001
Posts: 550
Code Monkey
Code Monkey
Offline
Joined: May 2001
Posts: 550
You mean in the "old" instructions, the 1.03?

Joined: Jan 2003
Posts: 338
Enthusiast
Enthusiast
Offline
Joined: Jan 2003
Posts: 338
[]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


Joined: Jun 2002
Posts: 47
User
User
Offline
Joined: Jun 2002
Posts: 47
Old as in I just downloaded it a few hours ago....

Joined: Sep 2006
Posts: 8
Lurker
Lurker
Offline
Joined: Sep 2006
Posts: 8
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

Last edited by cgregg; 12/07/2006 12:58 AM.

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Posts: 70
Joined: January 2007
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)