• Resolved andrewsa

    (@andrewsa)


    I’ve been Googling for hours, but I have had no luck, I am looking to create a different administration panel theme for contributors, basically, I’d like them to see just a stripped down version of my admin panel. Similar to what PopSugar.com has for users.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter andrewsa

    (@andrewsa)

    Tried messing with it myself, but I am simply not experienced enough with WordPress to code it properly.

    After more googling, I found this:

    https://www.smashingmagazine.com/2009/12/14/advanced-power-tips-for-wordpress-template-developers-reloaded/

    Specifically, the hiding fields based on user roles makes use of the following code:

    //if current user level is less than 3, remove the postcustom meta box
         if ($current_user->user_level < 3)

    I tried to insert it into this plugin:

    <?php
    /*
    Plugin Name: Planet X7
    Plugin URI: https://www.sevban.com/wordpress/planet-x7-wordpress-admin-theme
    Description: Planet X7 theme for WordPress adminisrator area.
    Author: Sevban &Otilde;zt&uuml;rk a.k.a peex
    Version: 1.0.4
    Author URI: https://www.sevban.com
    */
    
    function planetx7_header() {
    	$site_uri = get_settings('siteurl');
    	$plugin_uri = $site_uri . '/wp-content/plugins/planet-x7/';
    	echo '
    	<link rel="stylesheet" type="text/css" href="' . $plugin_uri . 'planet-x7.css?version=1.0.4" />
    	';
    	}
    	global $userdata;
         global $current_user;
    require(ABSPATH . WPINC . ‘/pluggable.php’);
    
         get_currentuserinfo();
    if ($current_user->user_level < 3)
    add_action('admin_head', 'planetx7_header');
    
    ?>

    and I get the error: Call to undefined function: get_currentuserinfo()

    Can someone possibly insert get_currentuserinfo() into the theme plugin to call the css only when the user is a < 3 role?

    Thanks in advance

    Not sure about all the code in your function or outside your function there but the structure would be more like this:

    add_action('admin_head', 'planetx7_header');
    
    function planetx7_header() {
      global $current_user;
      get_currentuserinfo();
      $site_uri = get_settings('siteurl');
      $plugin_uri = $site_uri . '/wp-content/plugins/planet-x7/';
      if ($current_user->user_level < 3) {
        echo '<link rel="stylesheet" type="text/css" href="' . $plugin_uri . 'planet-x7.css?version=1.0.4" />';
      }
    }
    Thread Starter andrewsa

    (@andrewsa)

    Thank you very much for you help, Micheal. I appreciate you taking the time to help me with this.

    I was able to accomplish this by inserting the following code into admin-header.php

    <?php
    global $current_user;
    	        get_currentuserinfo();
         if ($current_user->user_level < 3){
    	echo '<link rel="stylesheet" type="text/css" href="experimental.css" />';
    }
    ?>

    It specifically calls the CSS when user role is < 3.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Different Administration Theme for Contributors?’ is closed to new replies.