Error in google_avatar function
-
If you have “allow_url_fopen = 0” when viewing your author page you will get an error.
I updated the function as follows if you want to commit it.
function google_avatar( $id ) { if(ini_get('allow_url_fopen') == 1) { $headers = get_headers("https://profiles.google.com/s2/photos/profile/".$id."?sz=48", 1); $PicUrl = $headers['Location']; } else { $curl = curl_init(); curl_setopt_array( $curl, array(CURLOPT_RETURNTRANSFER => true, CURLOPT_URL => "https://profiles.google.com/s2/photos/profile/".$id."?sz=48" ) ); curl_exec( $curl ); $response_code = curl_getinfo( $curl, CURLINFO_EFFECTIVE_URL ); curl_close( $curl ); } return $PicUrl; }
https://www.ads-software.com/extend/plugins/social-autho-bio/
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Error in google_avatar function’ is closed to new replies.