• t
  • g
  • B
  • Z
  • @
  • e

portfolio & blog of senior web developer, Fahd Murtaza



  • About
  • Portfolio
  • WordPress
  • CV
  • Blog
  • Contact

  • About
  • Portfolio
  • WordPress
  • CV
  • Blog
  • Contact

WP plugin: Get Author Profile

June 23rd, 2007 by Fahd

WP plugin: Get Author Profile

Get Author Profile is a pretty basic WordPress plugin that lets you manually access an author’s (i.e. user’s) profile. The main purpose is to let you provide author information outside The Loop, such as for a sidebar intro of the blog owner or to list contributors to your blog.

(Note to WordPress 1.2 users: This is now a WordPress 1.5+ plugin. See the July 9th update.)

When the get_author_profile() function is called with a specific numeric User ID, you can make use of global variables related to that author’s profile, or alternatively display their information with the function author_profile().

Usage:

<?php get_author_profile(auth_ID); ?>

Usage notes: To get information on more than one user profile, simply run get_author_profile() again with another user ID to reset the author variables (but only after you’re done with the previous profile info!). get_author_profile() is “author template aware,” so if you drop it in a theme’s author.php without providing a user ID, it will set the user variables to the ‘current’ user.

Parameter:

auth_ID
(integer) Numeric user ID of a specific author. This is the “ID” number found under the Users administration page. This then enables the following global variables:

  • $author_aim (AOL Instant Messenger ID)
  • $author_displayname (display format selected under Users > Profile)
  • $author_email
  • $author_firstname
  • $author_icq (ICQ number)
  • $author_jabber (Jabber/Google Instant Messenger ID – WP 2.0 only)
  • $author_lastname
  • $author_level
  • $author_login
  • $author_msn (Microsoft Instant Messenger ID)
  • $author_nicename (login in url encoded format)
  • $author_nickname
  • $author_posts (post count)
  • $author_posts_link (URL to all posts)
  • $author_profile (Profile/”About yourself”)
  • $author_url (”Website”)
  • $author_yim (Yahoo Instant Messenger ID)

Also in the mix is the following template tag:

<?php author_profile('authcase', display); ?>

You can use this after get_author_profile() has been called in your template to display various author profile elements without having to echo the variables. The ‘authcase’ (first) parameter accepts:

authcase
(string) Type of infomation to display. Valid values duplicate variables from above:

  • 'aim'
  • 'displayname'
  • 'email'
  • 'firstname'
  • 'icq'
  • 'jabber'
  • 'lastname'
  • 'level'
  • 'login'
  • 'msn'
  • 'nicename'
  • 'nickname' (Default)
  • 'posts'
  • 'posts_link'
  • 'profile'
  • 'url'
  • 'yim'

The display (second) parameter takes either TRUE (display or echo the value) or FALSE (return the value for use in other PHP code). Defaults to TRUE.

Example:

<?php get_author_profile(1); ?>
<div class="profile">
<ul>
<li id="myprofile">Blog Owner:
<ul>
<li><?php author_profile('firstname'); ?> <?php author_profile('lastname'); ?></li>
<li>Jabber: <?php author_profile('jabber'); ?></li>
<li>AIM: <?php author_profile('aim'); ?></li>
<li>Notes: <?php author_profile('profile'); ?></li>
</ul>
</li>
</ul>
</div>

Update [Jul-09-2005] 0.3 Fixes problems with the plugin in WordPress 1.5. This version is also author template aware, meaning you can use get_author_profile() in an author.php theme template without an user ID, and it will set the author variables dynamically for the ‘current’ author. This is now a WordPress 1.5+ plugin. For WordPress 1.2 users, version 0.2 is here.

Update [Jul-11-2005] 0.4 adds a new parameter to author_profile(): display. Information above edited to reflect that. Not sure why I left something like that out originally…

Update [Jan-08-2006] 0.5 represents changes to run under WordPress 2.0 (should still work in 1.5.x). Only thing notably new (outside code changes and additions) are three variables: $author_jabber (author_profile(’jabber’)), $author_nicename (author_profile(’nicename’)) and $author_displayname author_profile(’displayname’)). $author_displayname is the name format users select under “How to display name” on the Users control panel. A few profile elements were removed in WordPress 2.0, these being the MSN IM and ICQ fields. However, if you upgraded from a previous version of WordPress these will be retained in your users’ data (technically, in the new usermeta table).

Update [Jan-12-2006] 0.5.1 – Bug fix to get_author_profile() when no author is passed as an argument (i.e. author queries).

Posted in Blogging Engines, Open Source, PHP, Wordpress

Post a Comment

Click here to cancel reply.

Your email is never published nor shared. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

  • Categories


Want to Hire Me?


Fahd Murtaza is the guy behind fahdmurtaza.com: your source for getting your web development projects done. Fahd sepcialises in Open Source Web Development and his favorite is WordPress. This site is a platform to his web development portfolio and blog all on a newly designed responsive website—try viewing it on your mobile.

If after viewing Fahd's portfolio, you think he might be just the guy to hire for your web / application development; check out the web development pricing page, then find out how to hire Fahd with a web development project idea and a brief of requirements.

 


Fahd Murtaza has put together a number of Web Development Articles that will help you see what he does, how he does it. You will also be able to see the level of work, and passion, that Fahad puts into each and every job. Understanding a little about the process can make the idea of investing good money much more palatable. People have always appreciated my Agile techniques. Its time you

Fahd Murtaza, Web Developer, Programmer, Wordpress Expert
U
This is portfolio & blog of senior web developer Fahd Murtaza, who has 9 years experience in: website development, WordPress, drupal, CMS and CRM application development with passion of making web better; one site at a time.


@
Mobile +968 93 678 199
email info@fahdmurtaza.com
Google Talk: fahdim@gmail.com
Skype fahd.murtaza
Location Muscat, Oman.


_
Developed using my beloved, love of my life, WordPress, built on the responsive, grid based, mobile optimised, Foundation Framework, and a modified Foundation theme. More Info →


Follow Fahd: Twitter / Google+ / Instagram / Facebook / Dribbble / Tumblr / Posterous/ flickr /
Copyright © 2006-2012 Fahd Murtaza

    • WordPress.org
    • Documentation
    • Support Forums
    • Feedback