Title: redirect1's Replies | WordPress.org

---

# redirect1

  [  ](https://wordpress.org/support/users/redirect1/)

 *   [Profile](https://wordpress.org/support/users/redirect1/)
 *   [Topics Started](https://wordpress.org/support/users/redirect1/topics/)
 *   [Replies Created](https://wordpress.org/support/users/redirect1/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/redirect1/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/redirect1/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/redirect1/engagements/)
 *   [Favorites](https://wordpress.org/support/users/redirect1/favorites/)

 Search replies:

## Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)

 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Is updating to 2.0.3 advisable?](https://wordpress.org/support/topic/is-updating-to-203-advisable/)
 *  [redirect1](https://wordpress.org/support/users/redirect1/)
 * (@redirect1)
 * [19 years, 11 months ago](https://wordpress.org/support/topic/is-updating-to-203-advisable/page/2/#post-400596)
 * I have the same probelm with category access plugin
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [Echo the role name of logged in user](https://wordpress.org/support/topic/echo-the-role-name-of-logged-in-user/)
 *  Thread Starter [redirect1](https://wordpress.org/support/users/redirect1/)
 * (@redirect1)
 * [19 years, 12 months ago](https://wordpress.org/support/topic/echo-the-role-name-of-logged-in-user/#post-390070)
 * Hi phunky… tnx for your reply. I solved with this your function mod:
 * <?php function get_role_from_db() {
    global $wpdb, $userdata; get_currentuserinfo();
   $ruoloutente = explode(‘”‘,$wpdb->get_var(“SELECT meta_value FROM wp_usermeta
   WHERE meta_key = ‘wp_capabilities’ and user_id = ‘$userdata->ID'”)); echo $ruoloutente[
   1]; } ?> I forgot the “global $wpdb” variabile… 😛 I can call it without an echo,
   and work perfectly if I put it in the sidebar, in a plugin, or in a widget in
   functions.php of my template. Only don’t work if i put the entire function in
   a phpexec widget (it’s a text widget that can eval() php code), but i think it’s
   a bug that i must discuss with the widget’s author…
 * In any way, if there is some less dirty function that can do this, i appreciate
   a little help… thanks to all replyers
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [Echo the role name of logged in user](https://wordpress.org/support/topic/echo-the-role-name-of-logged-in-user/)
 *  Thread Starter [redirect1](https://wordpress.org/support/users/redirect1/)
 * (@redirect1)
 * [20 years ago](https://wordpress.org/support/topic/echo-the-role-name-of-logged-in-user/#post-390063)
 * I don’t get an error… nothing will display after the function call… but if i 
   try the same code outside of a function it worck perfectly.
 * I know about the $userdata variable but, the function you suggest me don’t work
   if i put it in a template file… i used the code without the function (as I mentioned
   above) and the role is shown correctly.
 * in practice:
    1)the code only work outside a function in the template (i will
   try to put the function in other file and the call in the template or the widget)
   2)the code don’t work in a widget
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [Echo the role name of logged in user](https://wordpress.org/support/topic/echo-the-role-name-of-logged-in-user/)
 *  Thread Starter [redirect1](https://wordpress.org/support/users/redirect1/)
 * (@redirect1)
 * [20 years ago](https://wordpress.org/support/topic/echo-the-role-name-of-logged-in-user/#post-390038)
 * I tried to put the function directly in my sidbar for a test but don’t work… 
   i tryied this:
 * <?php
    global $userdata; get_currentuserinfo(); $role = explode(‘”‘,$wpdb->get_var(“
   SELECT meta_value FROM wp_usermeta WHERE meta_key = ‘wp_capabilities’ and user_id
   = ‘$userdata->ID'”)); echo $role[1]; ?>
 * and work very well… but i use widgets, and when i putted in my function.php (
   or use phpexec widget), all under the widget in the home page disappear… where
   i’m wrong?? 🙁
 * This is the code i used for functions.php:
 * function widget_user_role() {
    global $userdata; get_currentuserinfo(); $role
   = explode(‘”‘,$wpdb->get_var(“SELECT meta_value FROM wp_usermeta WHERE meta_key
   = ‘wp_capabilities’ and user_id = ‘$userdata->ID'”)); echo $role[1]; } if ( function_exists(‘
   register_sidebar_widget’) ) register_sidebar_widget(__(‘User Role’), ‘widget_user_role’);
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [Echo the role name of logged in user](https://wordpress.org/support/topic/echo-the-role-name-of-logged-in-user/)
 *  Thread Starter [redirect1](https://wordpress.org/support/users/redirect1/)
 * (@redirect1)
 * [20 years ago](https://wordpress.org/support/topic/echo-the-role-name-of-logged-in-user/#post-390018)
 * For Bossy: No.. sorry for my english, but i need something that return the user
   role of the user that is logged in, like the Phunky dirty function :D…
 * I will try his way for the moment…
 * if someone have another metod to do this is very apreciate…
 * Thanks
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [Echo the role name of logged in user](https://wordpress.org/support/topic/echo-the-role-name-of-logged-in-user/)
 *  Thread Starter [redirect1](https://wordpress.org/support/users/redirect1/)
 * (@redirect1)
 * [20 years ago](https://wordpress.org/support/topic/echo-the-role-name-of-logged-in-user/#post-389924)
 * anyone?
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [Exclude category from single post navigation (prev/next)](https://wordpress.org/support/topic/exclude-category-from-single-post-navigation-prevnext/)
 *  [redirect1](https://wordpress.org/support/users/redirect1/)
 * (@redirect1)
 * [20 years ago](https://wordpress.org/support/topic/exclude-category-from-single-post-navigation-prevnext/#post-306484)
 * Hi… there is a way to exclude multiple categories in 2.0.2 in single post view?
   I have patched the file with the changeset 3508 [http://trac.wordpress.org/changeset/3508](http://trac.wordpress.org/changeset/3508)…
   But it exclude only one category. Also trying in descending order…only the last
   categories in the order it’s excluded

Viewing 7 replies - 1 through 7 (of 7 total)