Categories
Uncategorized WordPress

Users / Roles / Capabilities

I presented on August 30, 2010 to the DC WordPress group on the topic of the Users / Roles / Capabilities system in WordPress.  I presented a small number of slides, and wrote four simple plugins to demonstrate some specific features.   My slides (In HTML / CSS / JS, not some proprietary format) are available at http://aaron.jorb.in/slides/dcwp0810/.  You can navigate through them with your arrow keys, or you press esc and it will take you to thumbnails where you can jump around.

I’ve also posted each of the plugins I wrote, along with a detailed explanation of them.

Shortcodes for Discrimination – Provides shortcodes that allow either users or non users to see certain content

Personalize Read More – Changes the Read More link to call out logged in users by name

Add Role – This adds a role for managing links and removes editors ability to

Replacing Jabber, AIM, and Yahoo messenger with twitter on profile Pages

Repository containing all the code: http://code.google.com/p/wp-user-plugins/

Happy Coding.

Categories
Code Programming Uncategorized WordPress

Adding a twitter box to the Profile page in WordPress

I haven’t used AIM in years and I haven’t used Yahoo Messager in even longer.  What I do use is twitter.  Therefore, having a box in the WordPress admin for twitter name is better and with some code I wrote for the , super easy.

[php]
add_filter(‘user_contactmethods’, ‘jorbin_user_contactmethods’);

/**
* Removes AIM, YAHOO, and Jabber boxes from profile page and adds Twitter in it’s place
*
*/
function jorbin_user_contactmethods($user_contactmethods){
$new_user_contactmethods[‘twitter’] = __(‘Twitter’);

return $new_user_contactmethods;
}
[/php]

Filtering user_contactmethods is one of the easiest things you can do. All you need to do is return an array where the key is the code based name you want and the value is the public facing name. Easy. As. Pie.

Categories
Code Programming Uncategorized WordPress

Add Role

This simple plugin, built for my WordPress DC Presentation on the Users API adds a role called link master, that gets the capability to edit links and also read private posts and pages and also removes the ability for editors to manage categories.

Continue reading “Add Role”

Categories
Code Programming Uncategorized WordPress

Personalized Read More

Want to make the read more link in WordPress call out the user if they are logged in?  As part of my DC WordPress presentation, i showed that it’s easy as pie and only about 10 lines of code.

Continue reading “Personalized Read More”

Categories
Code Programming Uncategorized WordPress

WordPress Shortcodes for Users and Non Users

One of the plugins I wrote for the DC WordPress group’s meeting on Users / Roles / Capabilities demonstrates how to create shortcode that makes some content only visable by users with a certain capability and other content only visable to non logged in viewers.  You can download Shortcodes for Discrimination (along with the other three ) from google code.  Beyond the jump, I go over the code and an explanation of how it works.

Continue reading “WordPress Shortcodes for Users and Non Users”