1

Im wanting to show a profile/logo pic on author.php via a simple shortcode:

function wpaluploader_showauthorimage() {
$wpaluploader_authorlogo = '<img src="' . get_bloginfo('url'). '/wp-content/uploads/wpal_logos/'.$curauth->ID.''.get_option(wpal_mime) .'"/>';
return $wpaluploader_authorlogo;
}  

I know i need to get:
global
$author
inside this function, however no matter how i go around it i can get it to work, i have a similar shortcode for all other posts/pages which doesnt need the global and $author declarations as they use the wp loop to get the info.

The plugin im working on takes an uploaded image from frontend, renames it to user_id and pops it in a folder, so its pretty important that i can pull this curauth->ID info to display it on author.php via the shortcode

edit, complete working code:

function wpaluploader_showauthorimage() {
global $author, $profileuser;
if(isset($_GET['author_name'])) {
$curauth = get_userdatabylogin(get_the_author_login());
} else {
$curauth = get_userdata(intval($author));
}
$wpaluploader_authorlogo = '<img src="' . get_bloginfo('url'). '/wp-content/uploads/wpal_logos/'.$curauth->ID .''.get_option(wpal_mime) .'" />';
return $wpaluploader_authorlogo;
}
2
  • 1
    /wp-admin/user-edit.php starting on line 99. Just check the hooks and filters there and how $profileuser get's called. Pay attention on the switch. Code is written for ... don't know for what exactly, but definitely against readability.
    – kaiser
    Jun 8, 2011 at 8:47
  • 1
    Ty very much Kaiser, tis done, can you put your comment down as an answer and i will mark it as "answered" regards Martin
    – MartinJJ
    Jun 8, 2011 at 11:21

1 Answer 1

1

/wp-admin/user-edit.php starting on line 99.

Just check the hooks and filters there and how $profileuser get's called.

(Pay attention on the switch.) :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.