* Plugin Name: GLM Members Database Conditions
* Plugin URI: http://www.gaslightmedia.com/
* Description: Gaslight Media Members Database.
- * Version: 1.0.1
+ * Version: 1.0.2
* Author: Gaslight Media
* Author URI: http://www.gaslightmedia.com/
* License: GPL2
* @package glmMembersDatabaseConditionsAddOn
* @author Chuck Scott <cscott@gaslightmedia.com>
* @license http://www.gaslightmedia.com Gaslightmedia
- * @version 1.0.1
+ * @version 1.0.2
*/
/*
* so that we're sure the other add-ons see an up to date
* version from this plugin.
*/
-define('GLM_MEMBERS_CONDITIONS_PLUGIN_VERSION', '1.0.1');
+define('GLM_MEMBERS_CONDITIONS_PLUGIN_VERSION', '1.0.2');
define('GLM_MEMBERS_CONDITIONS_PLUGIN_DB_VERSION', '0.0.2');
// This is the minimum version of the GLM Members DB plugin require for this plugin.
*
* Also note that parameters will be in the context of the main admin controller constructor.
*/
+function glmConditionsRemoveDashboard () {
+ global $current_user, $menu, $submenu, $config;
+
+ // If user isn't an administrator
+ if (in_array('subscriber', $current_user->roles) && !$config['settings']['enable_members']) {
+
+ // Get rid of the main WordPress admin "Dashboard"
+ reset( $menu );
+ $page = key( $menu );
+ while( ( __( 'Dashboard' ) != $menu[$page][0] ) && next( $menu ) ) {
+ $page = key( $menu );
+ }
+ if( __( 'Dashboard' ) == $menu[$page][0] ) {
+ unset( $menu[$page] );
+ }
+ reset($menu);
+
+ // Also redirect user away from main WordPress dashboard should they get there.
+ if ( preg_match( '#wp-admin/?(index.php)?$#', $_SERVER['REQUEST_URI'] ) && ( 'index.php' != $menu[$page][2] ) ) {
+ wp_redirect( get_option( 'siteurl' ) . '/wp-admin/admin.php?page=glm-members-admin-menu-conditions-conditions');
+ }
+ if ( preg_match( '#wp-admin/?(profile.php)?$#', $_SERVER['REQUEST_URI'] ) && ( 'profile.php' != $menu[$page][2] ) ) {
+ wp_redirect( get_option( 'siteurl' ) . '/wp-admin/admin.php?page=glm-members-admin-menu-conditions-conditions');
+ }
+
+ }
+}
+add_action('admin_menu', 'glmConditionsRemoveDashboard');