Version 4.3.0
This commit is contained in:
1 parent
96997ddd8e
commit
fe1acf984a
1349 files changed
+116159
-67711
No files matched your search
@@ -0,0 +1,49 @@
|
||||
//<?php
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
class cms_hook_Forum extends _HOOK_CLASS_
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* [Node] Get buttons to display in tree
|
||||
*
|
||||
* @param string $url Base URL
|
||||
* @param bool $subnode Is this a subnode?
|
||||
* @return array
|
||||
*/
|
||||
public function getButtons( $url, $subnode=FALSE )
|
||||
{
|
||||
$buttons = parent::getButtons( $url, $subnode );
|
||||
|
||||
if ( isset( $buttons['delete'] ) AND $this->isUsedByCms() )
|
||||
{
|
||||
unset( $buttons['delete']['data'] );
|
||||
}
|
||||
|
||||
return $buttons;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this Forum used by any cms category for record/comment topics?
|
||||
*
|
||||
@return bool|\IPS\cms\Databases
|
||||
*/
|
||||
public function isUsedByCms()
|
||||
{
|
||||
foreach ( \IPS\cms\Databases::databases() as $database )
|
||||
{
|
||||
if ( $database->forum_record and $database->forum_forum and $database->forum_forum == $this->id )
|
||||
{
|
||||
return $database;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user