WordPress.org

Profiles

AR.Mukul

  • Member Since: August 20th, 2014
  • http://armukulphotography.wordpress.com
  • https://armukul.com
  • Photography at Al faqihi group
  • @armukulphotography on WordPress.org
  • Find me on:

Bio/Description

Live your Life, Live your Dream

Interests

/*
Plugin Name: Name of Plugin
Plugin URI: Link to plugin information
Description: Plugin Description
Author: Plugin author’s name
Author URI: Link to the author’s web site
Version: Must be set in the plugin for WordPress 2.3+
Text Domain: Optional. Unique identifier, should be same as the one used in
plugin_text_domain()
Domain Path: Optional. Only useful if the translations are located in a
folder above the plugin’s base path. For example, if .mo files are
located in the locale folder then Domain Path will be “/locale/” and
must have the first slash. Defaults to the base folder the plugin is
located in.
Network: Optional. Specify “Network: true” to require that a plugin is activated
across all sites in an installation. This will prevent a plugin from being
activated on a single site when Multisite is enabled.
* / # Remove the space to close comment

function user_can_access_admin_page() {
global $pagenow;
global $menu;
global $submenu;
global $_wp_menu_nopriv;
global $_wp_submenu_nopriv;
global $plugin_page;
global $_registered_pages;

$parent = get_admin_page_parent();

if ( !isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$parent][$pagenow] ) )
return false;

if ( isset( $plugin_page ) ) {
if ( isset( $_wp_submenu_nopriv[$parent][$plugin_page] ) )
return false;

$hookname = get_plugin_page_hookname($plugin_page, $parent);

if ( !isset($_registered_pages[$hookname]) )
return false;
}

if ( empty( $parent) ) {
if ( isset( $_wp_menu_nopriv[$pagenow] ) )
return false;
if ( isset( $_wp_submenu_nopriv[$pagenow][$pagenow] ) )
return false;
if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$pagenow][$plugin_page] ) )
return false;
if ( isset( $plugin_page ) && isset( $_wp_menu_nopriv[$plugin_page] ) )
return false;
foreach (array_keys( $_wp_submenu_nopriv ) as $key ) {
if ( isset( $_wp_submenu_nopriv[$key][$pagenow] ) )
return false;
if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$key][$plugin_page] ) )
return false;
}
return true;
}

if ( isset( $plugin_page ) && ( $plugin_page == $parent ) && isset( $_wp_menu_nopriv[$plugin_page] ) )
return false;

if ( isset( $submenu[$parent] ) ) {
foreach ( $submenu[$parent] as $submenu_array ) {
if ( isset( $plugin_page ) && ( $submenu_array[2] == $plugin_page ) ) {
if ( current_user_can( $submenu_array[1] ))
return true;
else
return false;
} else if ( $submenu_array[2] == $pagenow ) {
if ( current_user_can( $submenu_array[1] ))
return true;
else
return false;
}
}
}

foreach ( $menu as $menu_array ) {
if ( $menu_array[2] == $parent) {
if ( current_user_can( $menu_array[1] ))
return true;
else
return false;
}
}

return true;
}

WordPress Origin Story

function user_can_access_admin_page() {
global $pagenow;
global $menu;
global $submenu;
global $_wp_menu_nopriv;
global $_wp_submenu_nopriv;
global $plugin_page;
global $_registered_pages;

$parent = get_admin_page_parent();

if ( !isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$parent][$pagenow] ) )
return false;

if ( isset( $plugin_page ) ) {
if ( isset( $_wp_submenu_nopriv[$parent][$plugin_page] ) )
return false;

$hookname = get_plugin_page_hookname($plugin_page, $parent);

if ( !isset($_registered_pages[$hookname]) )
return false;
}

if ( empty( $parent) ) {
if ( isset( $_wp_menu_nopriv[$pagenow] ) )
return false;
if ( isset( $_wp_submenu_nopriv[$pagenow][$pagenow] ) )
return false;
if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$pagenow][$plugin_page] ) )
return false;
if ( isset( $plugin_page ) && isset( $_wp_menu_nopriv[$plugin_page] ) )
return false;
foreach (array_keys( $_wp_submenu_nopriv ) as $key ) {
if ( isset( $_wp_submenu_nopriv[$key][$pagenow] ) )
return false;
if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$key][$plugin_page] ) )
return false;
}
return true;
}

if ( isset( $plugin_page ) && ( $plugin_page == $parent ) && isset( $_wp_menu_nopriv[$plugin_page] ) )
return false;

if ( isset( $submenu[$parent] ) ) {
foreach ( $submenu[$parent] as $submenu_array ) {
if ( isset( $plugin_page ) && ( $submenu_array[2] == $plugin_page ) ) {
if ( current_user_can( $submenu_array[1] ))
return true;
else
return false;
} else if ( $submenu_array[2] == $pagenow ) {
if ( current_user_can( $submenu_array[1] ))
return true;
else
return false;
}
}
}

foreach ( $menu as $menu_array ) {
if ( $menu_array[2] == $parent) {
if ( current_user_can( $menu_array[1] ))
return true;
else
return false;
}
}

return true;
}

  • AR.Mukul’s profile was updated

    3 years ago