Current time: 02-07-2012, 11:41 AM Hello There, Guest! (LoginRegister)

 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Suspend Reason
04-15-2009, 06:44 AM (This post was last modified: 04-17-2009 01:20 PM by umarsa.)
Post: #1
Suspend Reason
Hello all,

I switched to THT a few months back but i was having timeout issues so i went back to cp-creator. Yesterday i thought you guys might have fixed it and decided to install it again and it works perfectly. The only thing i couldnt help thinking about is WHY ON EARTH CANT THERE BE A SUSPEND MESSAGE??!?

So i was looking through the code and found the function "suspend" in the file "whm.php", i edited the command line from "$action = "/xml-api/suspendacct?user=" . strtolower($user);" (line 83) and replaced with this "$action = "/xml-api/suspendacct?reason=test&user=" . strtolower($user);". This worked like a dream, the reason showed up in my WHM, i was so pleased Big Grin

So i was wondering if you can implement this into the new or next version, the cronjob that automatically suspends for posts should have a reason like "THT: Not Enough Posts". Also in the admin panel when the admin suspends a user the reason should be something like "THT: Suspended by (ADMIN_USERNAME)" with of course the ADMIN_USERNAME replaced with the admin that is logged in.

For now i have implemented this myself. Here is a breif way if anyone wants to do it.

Open WHM.php (sorry guys i can only help with cpanel/whm)

Find
Code:
$action = "/xml-api/suspendacct?user=" . strtolower($user);
(around line 83)

Edit this with
Code:
$tht_suspend_reason = str_replace(" ", "%20", $tht_suspend_reason);
$action = "/xml-api/suspendacct?reason=THT:_$tht_suspend_reason&user=" . strtolower($user);

Find
Code:
public function suspend($user, $server) {
(around line 81)

Edit this with
Code:
public function suspend($user, $server, $tht_suspend_reason) {


Open class_server.php in includes.

Find
Code:
public function suspend($id) { # Suspends a user account from the package ID

Replace with
Code:
public function suspend($id, $reason_suspend) { # Suspends a user account from the package ID

Find
Code:
if($this->servers[$server]->suspend($data2['user'], $server) == true) {
(around line 220)

Replace with
Code:
if($this->servers[$server]->suspend($data2['user'], $server, $reason_suspend) == true) {


Open users.php in the admin/pages folder.

Find
Code:
                        case "sus":
                            $command = $server->suspend($pack['id']);
(around line 50)

Replace with
Code:
                        case "sus": {
                        $db->query("SELECT * FROM `<PRE>staff` WHERE `id` =".$_SESSION['user']);
                        $data = $db->fetch_array($query);
                        $client = $db->staff($_SESSION['user']);
                            $command = $server->suspend($pack['id'], "Suspended_by_".$client["user"]);
                            }

Save and close all files.

In not sure if
Code:
$db->query("SELECT * FROM `<PRE>staff` WHERE `id` =".$_SESSION['user']);
                        $data = $db->fetch_array($query);
Is needed...

Im gonna need some help as to where to edit for the cron, i have looked in cron.php and compiler.php but i cant find it lol.

Well you get the point, can you implement something like this in the next version.

Thanks,
Umar Salim
Find all posts by this user
04-15-2009, 04:36 PM
Post: #2
RE: Suspend Reason
very nice Smile

Nick - TheHostingTool Staff Coordinator

[Image: standard.png]

Visit this user's website Find all posts by this user
04-15-2009, 04:43 PM
Post: #3
RE: Suspend Reason
Thanks but sadly you cant use spaces in the api reason Sad
Find all posts by this user
04-17-2009, 12:48 PM
Post: #4
RE: Suspend Reason
you probably could if you escape the space with" \"

Nick - TheHostingTool Staff Coordinator

[Image: standard.png]

Visit this user's website Find all posts by this user
04-17-2009, 01:18 PM
Post: #5
RE: Suspend Reason
Okay i tried it and it didnt work.

I have tried %20 and it works perfectly Smile

I will edit my first post and put that in.
Find all posts by this user
04-17-2009, 09:49 PM
Post: #6
RE: Suspend Reason
good work, very nice

Nick - TheHostingTool Staff Coordinator

[Image: standard.png]

Visit this user's website Find all posts by this user
04-17-2009, 09:50 PM
Post: #7
RE: Suspend Reason
Thanks.

Its so easy to add things lol its the ajax that is hard Sad
Find all posts by this user
04-20-2009, 03:06 PM
Post: #8
RE: Suspend Reason
Hello.

I can confirm that this feature will be included in 1.2

Rich - Ex lead developer
Visit this user's website Find all posts by this user
04-20-2009, 03:58 PM
Post: #9
RE: Suspend Reason
Woohoo, but i would also like to add, in the THT admin panel when you click the suspend button it should ask why you want to suspend them.

Another thing that needs to be included is if the user catches up on posts hes unsuspended, i made a little something that does this but it will only work on my server sadly.
Find all posts by this user
04-20-2009, 04:05 PM
Post: #10
RE: Suspend Reason
(04-20-2009 03:58 PM)umarsa Wrote:  Woohoo, but i would also like to add, in the THT admin panel when you click the suspend button it should ask why you want to suspend them.

Another thing that needs to be included is if the user catches up on posts hes unsuspended, i made a little something that does this but it will only work on my server sadly.

Hello,

Yeah, version 1.2 will do all that Big Grin

Rich - Ex lead developer
Visit this user's website Find all posts by this user


Forum Jump:


User(s) browsing this thread: 1 Guest(s)