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;
}
/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.) 🙂