Code: Select all
//Example from core.viewtopic_modify_post_data event
$attachments = $event['attachments'];
if($event['has_approved_attachments'])
{
$attachments_parse = $elements = array();
if(!empty($rowset[$topic_data['topic_first_post_id']]))
{
foreach ($attachments as $key => $attachment)
{
foreach ($attachment as $id => $item)
{
if(!$item['attach_class']) //Here i filter the attachments by a custom field, to show or not the item
{
$elements[] = $item;
}
}
$attachments_parse[$key] = $elements;
}
$event['topic_data'] = $topic_data;
$event['attachments'] = $attachments_parse;
}
}
Thanks in advance!