<?php

use \Illuminate\Support\Facades\Event;

if (defined('MESSENGER_INSTALLED') === false) {
    require_once __DIR__ . '/admin/install/install.php';
}

Event::listen(
    'Members/Admin/MemberOpenTabNav', function ($id = null) {
    if (empty($id)) {
        return '';
    }
    return
        "<li class=\"" . ((stristr($_SERVER['SCRIPT_NAME'], 'view_member_threads.php') !== false) ? ' selected' : '') . "\">
            <a href=\"/plugins/MembersMessaging/admin/view_member_threads.php?id={$id}\">View member messages</a>
        </li>";
}
);