'.$author_name.'';
}
$author_description = esc_html( $author[AD_Author::description] );
$image_size = 75;
$author_image = get_avatar( $author_email, $image_size);
if(isset($author[AD_Profile_DB::use_custom_image]) && $author[AD_Profile_DB::use_custom_image] != ""){
//use custom author image url
$author_image_url = esc_html( $author[AD_Profile_DB::custom_image_url]);
$author_image = '
';
}
if($author_description == ""){
$author_bio = '';
}else{
$author_bio = '
';
$author_bio .= '
';
$author_bio .= '
';
$author_bio .= $author_image;
$author_bio .= '
';
$author_bio .= '
';
$author_bio .= '
';
$author_bio .= '
'.$author_name.'
';
$author_bio .= '
'.$author_description.'
';
$author_bio .= ad_get_all_social_media($author);
$author_bio .= '
';
$author_bio .= '
';
$author_bio .= '
';
}
return $author_bio;
}
/**
* Check whether the about author box for this author should be displayed
* @param unknown_type $username
* @return boolean
*/
function ad_can_display_user($username){
$display_author = true;
if(get_the_author_meta(AD_Author::disable_about_author)){
$display_author = false;
}
return $display_author;
}
/**
* Get custom field for custom author (if any)
*/
function ad_get_author_from_custom_field(){
global $post;
return get_post_meta($post->ID, AD_Config::custom_field_in_post_for_author_details, true);
}
/**
* Get Author details from wordpress user profile
* @return multitype:string NULL
*/
function ad_get_author_details_from_wordpress_user_profile(){
$wordpres_author_details = array(
AD_Author::first_name => get_the_author_meta(AD_Author::user_firstname),
AD_Author::last_name => get_the_author_meta(AD_Author::user_lastname),
AD_Author::user_email => get_the_author_meta(AD_Author::user_email),
AD_Author::user_url => get_the_author_meta(AD_Author::user_url),
AD_Author::description => get_the_author_meta(AD_Author::description),
AD_Author::twitter => get_the_author_meta(AD_Author::twitter),
AD_Author::facebook => get_the_author_meta(AD_Author::facebook),
AD_Author::google_plus => get_the_author_meta(AD_Author::google_plus),
AD_Author::linkedin => get_the_author_meta(AD_Author::linkedin),
AD_Author::flickr => get_the_author_meta(AD_Author::flickr),
AD_Author::youtube => get_the_author_meta(AD_Author::youtube),
AD_Author::vimeo => get_the_author_meta(AD_Author::vimeo),
AD_Author::skype => get_the_author_meta(AD_Author::skype),
AD_Author::xing => get_the_author_meta(AD_Author::xing),
AD_Profile_DB::display_html_block => null
);
return $wordpres_author_details;
}
function ad_get_author_details_from_database($username, $convert_line_feeds_to_br = false){
global $wpdb;
$database_author_details=null;
$author_profile_db = new AD_Profile_DB($wpdb);
$result = $author_profile_db->get_row_by_username($username);
if($result){
$author_description = $result->description;
if($convert_line_feeds_to_br){
$author_description = $author_description;
}
$database_author_details = array(
AD_Author::first_name => $result->first_name,
AD_Author::last_name => $result->last_name,
AD_Author::user_email => $result->email,
AD_Author::user_url => $result->url,
AD_Author::description => $author_description,
AD_Author::twitter => $result->twitter,
AD_Author::facebook => $result->facebook,
AD_Author::google_plus => $result->google_plus,
AD_Author::linkedin => $result->linkedin,
AD_Author::flickr => $result->flickr,
AD_Author::youtube => $result->youtube,
AD_Author::vimeo => $result->vimeo,
AD_Author::skype => $result->skype,
AD_Author::xing => $result->xing,
AD_Profile_DB::use_custom_image => $result->use_custom_image,
AD_Profile_DB::custom_image_url => $result->custom_image_url,
AD_Profile_DB::display_html_block => $result->display_html_block,
AD_Profile_DB::html_block => $result->html_block
);
}
return $database_author_details;
}
function ad_get_all_social_media($author){
$content = ad_add_social_media($author, AD_Author::facebook) .
ad_add_social_media($author, AD_Author::twitter).
ad_add_social_media($author, AD_Author::linkedin).
ad_add_social_media($author, AD_Author::google_plus).
ad_add_social_media($author, AD_Author::flickr).
ad_add_social_media($author, AD_Author::youtube).
ad_add_social_media($author, AD_Author::vimeo).
ad_add_social_media($author, AD_Author::skype).
ad_add_social_media($author, AD_Author::xing);
if($content!=""){
$content = ''.$content.'
';
}
return $content;
}
function ad_add_social_media($author, $media_type){
global $ad_plugin_dir_path;
$social_media_id = $author[$media_type];
if($social_media_id==null || $social_media_id==""){
//User does not use this social media
return "";
}
$social_media_content = '';
if($media_type == AD_Author::twitter){
$social_media_content .= '';
}else if($media_type == AD_Author::facebook){
$social_media_content .= '
';
}else if($media_type == AD_Author::google_plus){
$social_media_content .= '
';
}else if($media_type == AD_Author::linkedin){
$social_media_content .= '
';
}else if($media_type == AD_Author::flickr){
$social_media_content .= '
';
}else if($media_type == AD_Author::youtube){
$social_media_content .= '
';
}else if($media_type == AD_Author::vimeo){
$social_media_content .= '
';
}else if($media_type == AD_Author::skype){
$social_media_content .= '
';
}else if($media_type == AD_Author::xing){
$social_media_content .= '
';
}
return $social_media_content;
}