public static function admin_init() { global $pagenow; require_once self::$plugin_dir . 'includes/options.php'; $user_list = array(-1 => sprintf(__('WordPress Notification Email (%s)', 'the-hack-repair-guys-admin-login-notifier'), get_option('admin_email'))); $users = get_users(array('role' => 'administrator')); foreach ($users as $key => $user) { $user_list[$user->ID] = "{$user->data->display_name} ( {$user->data->user_email} )"; } $fields = array("general" => array('title' => '', 'callback' => '', 'options' => array('notify' => array('title' => __('Email Notifications to:', 'the-hack-repair-guys-admin-login-notifier'), 'args' => array('values' => $user_list, 'description' => __('The email contacts selected above will be notified each time an administrator logs into this dashboard', 'the-hack-repair-guys-admin-login-notifier')), 'callback' => 'checklist'), 'exclude_ip' => array('title' => __('Exclude IP addresses', 'the-hack-repair-guys-admin-login-notifier'), 'args' => array('description' => __('A comma-separated list of IP addresses that will not trigger a notification email.', 'the-hack-repair-guys-admin-login-notifier')), 'callback' => 'text')))); $tabs = array(); HackRepair_Admin_Login_Notifier_Options::init('hackrepair-admin-login-notifier', __('Admin Login Notifier', 'the-hack-repair-guys-admin-login-notifier'), __("The Hack Repair Guy's Admin Login Notifier: Settings", 'the-hack-repair-guys-admin-login-notifier'), $fields, $tabs, 'HackRepair_Admin_Login_Notifier', 'hackrepair-admin-login-notifier-settings'); }
public static function init($str = 'tiny', $menu_title, $title, $fields, $tabs, $parent_class, $file = false, $role = false) { self::$fields = $fields; self::$tabs = $tabs; self::$file = $file ? $file : __FILE__; self::$id = $str . '_options'; self::$menu_title = $menu_title; self::$title = $title; self::$parent_class = $parent_class; self::$role = $role ? $role : self::$role; self::build_settings(); add_options_page(self::$title, self::$menu_title, self::$role, self::$file, array('HackRepair_Admin_Login_Notifier_Options', 'page')); }