Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-18-2013, 11:37 AM   PM User | #1
ComClerk
New to the CF scene

 
Join Date: Mar 2013
Location: West Coast
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
ComClerk is an unknown quantity at this point
HELP ME Apply the "add_cap" CSS Function to Single User in Wordpress (Self-Hosted)

This is probably a really easy thing for many of you, but I have yet to find a Specific Example of how to properly implement CSS Code since there are so many Variables, I can never tell if it's just and "example", or if it's the actual Code I'm supposed to use whenever someone gives me an example.

I have a Theme Installed into my Wordpress.org Site (Self hosted), so for a while, I had no clue how to even edit my main CSS since the only options given was the "Theme Editor" and the "Plugin Editor".

Until I installed something called "Jetpack" which allows me to edit my main CSS Code without effecting my Theme.

My goal is: to "Add Capabilities" to one Specific User - I'm having someone do some "On-Site" SEO and I don't want them to have access to anything but the ability to edit some MetaData, etc.

The "ad_cap" function is referenced HERE

Notice at the Link above, how it says: "There is no public function called add_cap() - just the class methods inside WP_Roles, WP_Role, WP_User that can add capabilities."

So I found the "WP_User" Section here in the "wp-includes/capabilities.php" on Line 394 which looks like this:

<---------on Line 411, it says this. I assume this is where I put the User's ID number??

So I found the User's (subscriber on our site who will be doing the on-site SEO) Number which was 25, and replaced the 0 with the 25.

So then, I figured, since I didn't really need any other Functions, I skipped down to Line 871 (deleted all Code in between too) to the "ad_cap" Function per User (Not to be confused to the "ad_cap" Function to Roles) - This is JUST for a User NOT a Role.

So here were he Instructions & along with the function on Line 871:




So the Name of the Capability I wanted to add was called: "manage_options" (see complete List of Capabilities HERE)

So my Confusion is here was, I couldn't tell what it meant when it said: "@param string $cap Capability Name"(see red arrows in above pic)

Was I supposed to REPLACE every instance that said "$cap" with the actual Cap Name: "manage_options"??? Or just place the Cap Name BESIDE it?

Or when it says "$this->ID", do I replace the word "ID" with the User's ID# "25"??

Anyways, this is what my final piece looked like with the parts I Added/Edited Underlined in Bold in THIS COLOR:


class*WP_User*{
var*$ID*=*25;
function add_cap( $cap manage_options, $grant = true ) {
$this->caps[$manage_options]*=*$grant;
update_user_meta(*$this->ID,*$this->cap_key,*$this->caps*);
}
}

- - - - - - - - - - - - - - - - - --- - -

CAN SOMEONE PLEASE TELL ME WHAT I DID WRONG??? I'm actually looking to hire a programmer for Freelance work with our Company (we are the fastest growing Micro Job Marketplace in the World - with over 35,000 Members just a SEOClerks alone)

So anyone who helps me to do this, I will gladly consider you for more work right away.

Thanks!!
-Jordan
ComClerk is offline   Reply With Quote
Reply

Bookmarks

Tags
code, css, html, javascript, wordpress

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:22 AM.


Advertisement
Log in to turn off these ads.