Jump to content

Client area panels


Cubeboy

Recommended Posts

I need to get rid of the date when I add files on the admin side.

 

when I upload a file the a clients account in the admin section, it displays in the client area and it time stamps it. how can I remove the time stamp? OR remove the whole hook and add it back with my own var?

 

 

<?php
use WHMCS\View\Menu\Item;

add_hook('ClientAreaHomepagePanels', 1, function (Item $homePagePanels)

{
$homePagePanels->removeChild('your files:dateadded');
});

Link to comment
Share on other sites

18 hours ago, Cubeboy said:

I need to get rid of the date when I add files on the admin side.

when I upload a file the a clients account in the admin section, it displays in the client area and it time stamps it. how can I remove the time stamp? OR remove the whole hook and add it back with my own var?

effectively, you have two options - either load the panels children as an array and loop through it, modifying the labels.... or start again from scratch, query the database, modify the panel and tweak the output to however you want it... as this is just one table to query, and to give you more options to modify the output, it might be easier to recreate the panel.

<?php

# Attached Files HomePagePanel Hook
# Written by brian!

use Illuminate\Database\Capsule\Manager as Capsule;
use WHMCS\View\Menu\Item;

add_hook('ClientAreaHomepagePanels', 1, function (Item $homePagePanels)
{
	$client = Menu::context('client');
	$clientsfiles = Capsule::table('tblclientsfiles')->where('userid', $client->id)->where('adminonly', '0')->get();

	if (count($clientsfiles)) {
		foreach ($clientsfiles as $key => $child){
			$homePagePanels->getChild('Your Files')
				->addChild($key, array(
					'label' => $child->title,
					'uri' => 'dl.php?type=f&id='.$child->id,
				));
		}
	}
});

technically, we should probably check that the panel exists, but it's only being modified if the SQL query gets a result... and if that's the case, the panel should already exist... I think the only thing that could break it would be if you had a second hook that removed the panel.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated