WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Different Administration Theme for Contributors? (5 posts)

  1. andrewsa
    Member
    Posted 4 years ago #

    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.

  2. MichaelH
    Member
    Posted 4 years ago #

  3. andrewsa
    Member
    Posted 4 years ago #

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

    After more googling, I found this:

    http://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: http://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: http://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

  4. MichaelH
    Member
    Posted 4 years ago #

    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" />';
      }
    }
  5. andrewsa
    Member
    Posted 4 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic