Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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;
}
share|improve this question
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 '11 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 '11 at 11:21

1 Answer 1

up vote 1 down vote accepted

/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.) :)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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