Version 4.3.0
This commit is contained in:
1 parent
96997ddd8e
commit
fe1acf984a
1349 files changed
+116159
-67711
No files matched your search
@@ -261,11 +261,25 @@ class _User extends \IPS\Node\Model
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( "core_staff_directory_name_{$this->id}", FALSE, array( 'escape' => TRUE ) );
|
||||
}
|
||||
|
||||
return \IPS\Member::load( $this->type_id )->name;
|
||||
$member = \IPS\Member::load( $this->type_id );
|
||||
|
||||
if( $member->member_id )
|
||||
{
|
||||
return $member->name;
|
||||
}
|
||||
|
||||
return \IPS\Member::loggedIn()->language()->addToStack('deleted_member');
|
||||
}
|
||||
else
|
||||
{
|
||||
return \IPS\Member\Group::load( $this->type_id )->name;
|
||||
try
|
||||
{
|
||||
return \IPS\Member\Group::load( $this->type_id )->name;
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack('deleted_group');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -349,17 +363,22 @@ class _User extends \IPS\Node\Model
|
||||
public function save()
|
||||
{
|
||||
parent::save();
|
||||
static::updateEmptySetting();
|
||||
static::updateEmptySetting( FALSE );
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if there are any records and update setting so we can hide the link if there is nothing
|
||||
*
|
||||
* @param bool|NULL $value If we already know the value (because we've just set it), will save a query
|
||||
* @return void
|
||||
*/
|
||||
public static function updateEmptySetting()
|
||||
public static function updateEmptySetting( $value = NULL )
|
||||
{
|
||||
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => !( (bool) \IPS\Db::i()->select( 'COUNT(*)', 'core_leaders' )->first() ) ), array( 'conf_key=?', 'staff_directory_empty' ) );
|
||||
unset( \IPS\Data\Store::i()->settings );
|
||||
if ( $value == NULL )
|
||||
{
|
||||
$value = !( (bool) \IPS\Db::i()->select( 'COUNT(*)', 'core_leaders', NULL, NULL, NULL, NULL, NULL, \IPS\Db::SELECT_FROM_WRITE_SERVER )->first() );
|
||||
}
|
||||
|
||||
\IPS\Settings::i()->changeValues( array( 'staff_directory_empty' => $value ) );
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user