Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Plugin Name: AW Author Box
- Plugin URI: http://www.damiencarbery.com
- Description: For Riyad Arefin in Advanced WordPress Facebook group.
- Author: Damien Carbery
- Version: 0.1
- $Id: $
- */
- add_filter('the_content', 'aw_author_box', 30);
- function aw_author_box($content) {
- $user_id = get_the_author_meta('ID');
- // Start with the lowest capability.
- if (user_can($user_id, 'read')) $user_string = 'Subscriber';
- if (user_can($user_id, 'edit_posts')) $user_string = 'Contributor';
- if (user_can($user_id, 'edit_published_posts')) $user_string = 'Author';
- if (user_can($user_id, 'moderate_comments')) $user_string = 'Editor';
- if (user_can($user_id, 'activate_plugins')) $user_string = 'Administrator';
- $author_box = sprintf('Author: <a href="%s">%s</a> (%s)', get_author_posts_url($user_id), get_the_author_meta('display_name'), $user_string );
- return $content . $author_box;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement