how to implement "if (current_user_can('level_10')) :" ????
-
I bought and installed Digital Calvary’s Prestige Theme 1.4 on WP 3.1.2 and it has a couple of built in custom post types, which are really neat and all. However there are a few features on the custom post write pages that I do not want to be accessible for all users. I am hoping there is some php guru out there who can tell me how to implement admin only access for the sidebar choices? I have been really excited to learn php, but it has been a challenging yet rewarding uphill battle. I thank you for any assistance you might offer.
Goal: Integrate some form of the following into the theme code below
if (current_user_can('level_10')) :(I believe this is the entire snippit of code referring to the sidebar)
/*********************************************************** * Definitions ************************************************************/ /*********************************************************** * Class name: * CPMetaProjectSidebar * Descripton: * Implementation of page siedabar selecting meta box ***********************************************************/ class CPMetaProjectSidebar extends DCC_Meta { /*********************************************************** * Constructor ************************************************************/ public function __construct() { $this->_name = 'page_sidebar'; $this->_std = CMS_NOT_SELECTED; $this->_title = 'Page sidebar:<br /><span class="cms-span-10-normal">(if not set default sidebar will be used)</span>'; $this->_type = 'project'; $this->_desc = ''; } // constructor /*********************************************************** * Public functions ************************************************************/ public function display() { $value = $this->initDisplay(); // title echo '<div style="font-size:10px;line-height:10px;font-weight:bold;margin-top:10px;margin-bottom:4px;">'.$this->_title.'</div>'; // box value $dccp = GetDCCPInterface(); $pi_general = $dccp->getIGeneral(); echo $pi_general->printSidebarsList(300, $this->_name, $value); } // display } // class CPMetaProjectSidebar /*********************************************************** * Class name: * CPMetaProjectDisableSidebar * Descripton: * Implementation of CPMetaProjectDisableSidebar ***********************************************************/ class CPMetaProjectDisableSidebar extends DCC_Meta { /*********************************************************** * Constructor ************************************************************/ public function __construct() { $this->_name = 'project_nosidebar'; $this->_std = ''; $this->_title = 'Check this field if you want to display project as full width page without sidebar.'; $this->_type = 'project'; $this->_desc = ''; } // constructor /*********************************************************** * Public functions ************************************************************/ public function display() { $value = $this->initDisplay(); // title // echo '<div style="font-size:10px;line-height:10px;font-weight:bold;margin-top:10px;margin-bottom:4px;">'.$this->_title.'</div>'; // box value echo '<div style="margin-top:5px;"><input type="checkbox" id="'.$this->_name.'" name="'.$this->_name.'" '.($value ? ' checked="checked" ' : '').' /> <span >'.$this->_title.'</span></div>'; } } // class CPMetaProjectDisableSidebar
The topic ‘how to implement "if (current_user_can('level_10')) :" ????’ is closed to new replies.