Version 5.0.13
This commit is contained in:
1 parent
b89858b2ff
commit
5efe744c5f
1407 files changed
+69690
-30177
No files matched your search
@@ -15,8 +15,11 @@ namespace IPS\forums\extensions\core\Announcements;
|
||||
|
||||
use IPS\core\Announcements\Announcement;
|
||||
use IPS\Extensions\AnnouncementsAbstract;
|
||||
use IPS\forums\Forum;
|
||||
use IPS\Helpers\Form\FormAbstract;
|
||||
use IPS\Helpers\Form\Node;
|
||||
use IPS\Node\NodeGroup;
|
||||
use OutOfRangeException;
|
||||
use function defined;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
@@ -55,6 +58,35 @@ class Forums extends AnnouncementsAbstract
|
||||
return new Node( 'announce_forums', ( $announcement AND $announcement->ids ) ? explode( ",", $announcement->ids ) : 0, FALSE, array( 'class' => 'IPS\forums\Forum', 'zeroVal' => 'any', 'multiple' => TRUE, 'permissionCheck' => function ( $forum )
|
||||
{
|
||||
return $forum->sub_can_post and !$forum->redirect_url;
|
||||
} ), NULL, NULL, NULL, 'announce_forums' );
|
||||
}, 'nodeGroups' => true ), NULL, NULL, NULL, 'announce_forums' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the stored IDs into something that makes sense for the Announcement
|
||||
* Default is a comma-separated string, but some locations may override
|
||||
*
|
||||
* @see Announcement::loadAllByLocation()
|
||||
* @param string $ids
|
||||
* @return array
|
||||
*/
|
||||
public function getAnnouncementIds( string $ids ) : array
|
||||
{
|
||||
$return = [];
|
||||
foreach( parent::getAnnouncementIds( $ids ) as $id )
|
||||
{
|
||||
if( mb_substr( $id, 0, 1 ) == 'g' )
|
||||
{
|
||||
$group = Forum::availableNodeGroups()[ mb_substr( $id, 1 ) ] ?? null;
|
||||
if( $group )
|
||||
{
|
||||
$return = array_merge( $return, $group->nodeIds() );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$return[] = $id;
|
||||
}
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user