• Hola gente del foro, le comento que agregue el plugin Author Exposed a mi blog. Tengo la necesidad de modificarlo, como podran observar en esta imagen en la información del autor del post, aparece el avatar, aqui esta el problema. El avatar que aparece es de gravatar, y mis usuarios no lo utilizan, para su imagen de avatar utilizo el plugin Simple local avatars, que permite a cada usuario subir su propio avatar.
    A la hora de modificar Author exposed, no puedo lograr que aparezca el avatar que los usuarios suben, si alguien me pueda dar una ayuda con el codigo se los voy a agradecer, a continuación el código de author exposed:

    <?php
    /*
    Plugin Name: Author Exposed
    Plugin URI: http://colorlightstudio.com/2010/06/01/wordpress-plugin-author-exposed-v-1-1/
    Description: Simple and elegant way to get more information about author.
    Version: 1.1
    Author: Igor Penjivrag
    Author URI: http://colorlightstudio.com
    */
    
    /*  Copyright 2008  Igor Penjivrag  (email : igor@colorlightstudio.com)
    
        This program is free software; you can redistribute it and/or modify
        it under the terms of the GNU General Public License as published by
        the Free Software Foundation; either version 2 of the License, or
        (at your option) any later version.
    
        This program is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        GNU General Public License for more details.
    
        You should have received a copy of the GNU General Public License
        along with this program; if not, write to the Free Software
        Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    */
    
    function author_exposed() {
    	global $authordata;
    	$nick = get_the_author();
    
    // Gravatar Photo
    
    	$mail = get_the_author_email();
    	$gravatar = 'http://www.gravatar.com/avatar.php?gravatar_id=' .md5($mail);
    
    // Get ID for hidden DIV
    
    	$div_id = 'a'.get_the_ID();
    
    // Hidden DIV output
    
    	$author_posts_link = get_author_posts_url($authordata->ID, $authordata->user_nicename );
    
    	$hidden_div = '<span id="'.$div_id.'" class="mydiv" style="display:none;"><img src="'.$gravatar.'" alt="gravatar" /><span class="ae_close"><a href="javascript:;" onmousedown="toggleDiv(\''.$div_id.'\');">cerrar</a></span><span class="ae_top"><b>Autor: '.get_the_author().'</b></span>
    		<span class="ae_body"><b>Nombre</b>: '.get_the_author_firstname().' '.get_the_author_lastname().'<br /><b>Email:</b> '.get_the_author_email().'<br /><b>Sitio:</b> <a href="'.get_the_author_url().'">'.get_the_author_url().'</a><br /></span><span class="ae_about"><b>Mensaje:</b> '.get_the_author_description().'</span><span class="ae_body"><a href="'.$author_posts_link.'">Mas Juegos de '.get_the_author().'</a> ('.get_the_author_posts().')</span></span>';
    
    // Show it
    
    	echo ('<a href="javascript:;" onmousedown="toggleDiv(\''.$div_id.'\');"><b>Autor: </b>'.$nick.'</a>'.$hidden_div);
    
    }
    
    // Hook
    
    	add_filter('the_author_posts_link', 'author_exposed');  
    
    // Add JavaScript and Styles to header
    
    	add_action('wp_head', 'add_head');
    	function add_head() {
    	echo '<script type="text/javascript" src="'.get_option(siteurl).'/wp-content/plugins/author-exposed/javascript/skripta.js"></script><link rel="stylesheet" href="'.get_option('siteurl').'/wp-content/plugins/author-exposed/css/ae_style.css" type="text/css" />';
    }
    
    ?>

Viendo 15 respuestas - de la 1 a la 15 (de un total de 16)
  • cambia esto

    $mail = get_the_author_email();
    $gravatar = ‘http://www.gravatar.com/avatar.php?gravatar_id=&#8217; .md5($mail);

    por esto

    $mail = get_the_author_email();
    if (function_exists(‘get_simple_local_avatar’))
    $gravatar = get_simple_local_avatar($mail);
    else
    $gravatar = ‘http://www.gravatar.com/avatar.php?gravatar_id=&#8217; .md5($mail);

    Iniciador del debate gringofer

    (@gringofer)

    Hola, muchas gracias por responder.
    Remplace lo que me dijo en el codigo, pero ahora no aparece ningun avatar, ni el de gravatar ni el de local avatar…

    viendolo mas de cerca al parecer get_simple_local_avatar retorna un tag de imagen completo (<img>) y en realidad lo que tu necesitas es solamente el source de la imagen….

    quizas lo que podrias hacer es modificar tambien el plugin simple local avatar para que en vez de la imagen como tag <img> te devuelva solamente la url de la imagen

    prueba agregando un parametro por defecto en la funcion get_avatar en Simple_Local_Avatars, como $onlySrc = false (cambiando obviamente la cantidad de variables que acepta el filtro) mas algunos otros cambios, creo que podrias retornar solo la URL de la imagen

    saludos!

    Iniciador del debate gringofer

    (@gringofer)

    Hola Julio,

    Despues de tanto intentar por varios dias, no eh logrado resolverlo, aqui dejo el codigo original de la funcion get_avatar
    Para ver si me puedes dar una ayuda mas 😀

    public function get_avatar( $avatar = '', $id_or_email, $size = 96, $default = '', $alt = false ) {
    
    		if ( is_numeric($id_or_email) )
    			$user_id = (int) $id_or_email;
    		elseif ( is_string( $id_or_email ) && ( $user = get_user_by( 'email', $id_or_email ) ) )
    			$user_id = $user->ID;
    		elseif ( is_object( $id_or_email ) && ! empty( $id_or_email->user_id ) )
    			$user_id = (int) $id_or_email->user_id;
    
    		if ( empty( $user_id ) )
    			return $avatar;
    
    		$local_avatars = get_user_meta( $user_id, 'simple_local_avatar', true );
    
    		if ( empty( $local_avatars ) || empty( $local_avatars['full'] ) )
    			return $avatar;
    
    		$size = (int) $size;
    
    		if ( empty( $alt ) )
    			$alt = get_the_author_meta( 'display_name', $user_id );
    
    		// generate a new size
    		if ( empty( $local_avatars[$size] ) ) {
    			$upload_path = wp_upload_dir();
    			$avatar_full_path = str_replace( $upload_path['baseurl'], $upload_path['basedir'], $local_avatars['full'] );
    			$image_sized = image_resize( $avatar_full_path, $size, $size, true );
    			// deal with original being >= to original image (or lack of sizing ability)
    			$local_avatars[$size] = is_wp_error($image_sized) ? $local_avatars[$size] = $local_avatars['full'] : str_replace( $upload_path['basedir'], $upload_path['baseurl'], $image_sized );
    			// save updated avatar sizes
    			update_user_meta( $user_id, 'simple_local_avatar', $local_avatars );
    		} elseif ( substr( $local_avatars[$size], 0, 4 ) != 'http' ) {
    			$local_avatars[$size] = home_url( $local_avatars[$size] );
    		}
    
    		$author_class = is_author( $user_id ) ? ' current-author' : '' ;
    		$avatar = "<img alt='" . esc_attr( $alt ) . "' src='" . $local_avatars[$size] . "' class='avatar avatar-{$size}{$author_class} photo' height='{$size}' width='{$size}' />";
    
    		return apply_filters( 'simple_local_avatar', $avatar );
    	}

    Muchas gracias por tu ayuda, saludos!

    voy a ver si mas tarde durante el día te puedo entregar una respuesta mas concisa, saludos!

    a ver si esto te sirve:

    en author-exposed.php

    <?php
    /*
    Plugin Name: Author Exposed
    Plugin URI: http://colorlightstudio.com/2010/06/01/wordpress-plugin-author-exposed-v-1-1/
    Description: Simple and elegant way to get more information about author.
    Version: 1.1
    Author: Igor Penjivrag
    Author URI: http://colorlightstudio.com
    */
    
    /*  Copyright 2008  Igor Penjivrag  (email : igor@colorlightstudio.com)
    
        This program is free software; you can redistribute it and/or modify
        it under the terms of the GNU General Public License as published by
        the Free Software Foundation; either version 2 of the License, or
        (at your option) any later version.
    
        This program is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        GNU General Public License for more details.
    
        You should have received a copy of the GNU General Public License
        along with this program; if not, write to the Free Software
        Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    */
    
    function author_exposed() {
    	global $authordata;
    	$nick = get_the_author();
    
    // Gravatar Photo
    
    	$mail = get_the_author_email();
    	$gravatar = 'http://www.gravatar.com/avatar.php?gravatar_id=' .md5($mail);
    	if ( function_exists('get_simple_local_avatar') ) {
    		$gravatar = get_simple_local_avatar($email, 96, '', false, true);
    	}
    
    // Get ID for hidden DIV
    
    	$div_id = 'a'.get_the_ID();
    
    // Hidden DIV output
    
    	$author_posts_link = get_author_posts_url($authordata->ID, $authordata->user_nicename );
    
    	$hidden_div = '<span id="'.$div_id.'" class="mydiv" style="display:none;"><img src="'.$gravatar.'" alt="gravatar" /><span class="ae_close"><a href="javascript:;" onmousedown="toggleDiv(\''.$div_id.'\');">close</a></span><span class="ae_top"><b>Author: '.get_the_author().'</b></span>
    		<span class="ae_body"><b>Name</b>: '.get_the_author_firstname().' '.get_the_author_lastname().'<br /><b>Email:</b> '.get_the_author_email().'<br /><b>Site:</b> <a href="'.get_the_author_url().'">'.get_the_author_url().'</a><br /></span><span class="ae_about"><b>About:</b> '.get_the_author_description().'</span><span class="ae_body"><a href="'.$author_posts_link.'">See Authors Posts</a> ('.get_the_author_posts().')</span></span>';
    
    // Show it
    
    	echo ('<a href="javascript:;" onmousedown="toggleDiv(\''.$div_id.'\');">'.$nick.'</a>'.$hidden_div);
    
    }
    
    // Hook
    
    	add_filter('the_author_posts_link', 'author_exposed');  
    
    // Add JavaScript and Styles to header
    
    	add_action('wp_head', 'add_head');
    	function add_head() {
    	echo '<script type="text/javascript" src="'.get_option(siteurl).'/wp-content/plugins/author-exposed/javascript/skripta.js"></script><link rel="stylesheet" href="'.get_option('siteurl').'/wp-content/plugins/author-exposed/css/ae_style.css" type="text/css" />';
    }
    
    ?>

    en simple-local-avatar.php

    <?php
    /**
     Plugin Name: Simple Local Avatars
     Plugin URI: http://get10up.com/plugins/simple-local-avatars-wordpress/
     Description: Adds an avatar upload field to user profiles if the current user has media permissions. Generates requested sizes on demand just like Gravatar! Simple and lightweight.
     Version: 1.3.1
     Author: Jake Goldman (10up LLC), Oomph Inc
     Author URI: http://get10up.com
    
        Plugin: Copyright 2011 Jake Goldman (email : jake@get10up.com)
    
        This program is free software; you can redistribute it and/or modify
        it under the terms of the GNU General Public License as published by
        the Free Software Foundation; either version 2 of the License, or
        (at your option) any later version.
    
        This program is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        GNU General Public License for more details.
    
        You should have received a copy of the GNU General Public License
        along with this program; if not, write to the Free Software
        Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    
        NOTE: Previous versions may have accidentally and incorrectly attributed the
    	copyright to employers of Mr. Goldman. While credit is given to all contributors
    	to the current version, including Mr. Goldman's employers, the copyright belongs
    	- and has always belonged - to Mr. Goldman, personally.
    */
    
    /**
     * add field to user profiles
     */
    
    class Simple_Local_Avatars {
    	private $user_id_being_edited;
    
    	public function __construct() {
    		add_filter( 'get_avatar', array( $this, 'get_avatar' ), 10, 6 );
    
    		add_action( 'admin_init', array( $this, 'admin_init' ) );
    
    		add_action( 'show_user_profile', array( $this, 'edit_user_profile' ) );
    		add_action( 'edit_user_profile', array( $this, 'edit_user_profile' ) );
    
    		add_action( 'personal_options_update', array( $this, 'edit_user_profile_update' ) );
    		add_action( 'edit_user_profile_update', array( $this, 'edit_user_profile_update' ) );
    
    		add_filter( 'avatar_defaults', array( $this, 'avatar_defaults' ) );
    	}
    
    	public function get_avatar( $avatar = '', $id_or_email, $size = 96, $default = '', $alt = false, $onlySrc = false ) {
    
    		if ( is_numeric($id_or_email) )
    			$user_id = (int) $id_or_email;
    		elseif ( is_string( $id_or_email ) && ( $user = get_user_by( 'email', $id_or_email ) ) )
    			$user_id = $user->ID;
    		elseif ( is_object( $id_or_email ) && ! empty( $id_or_email->user_id ) )
    			$user_id = (int) $id_or_email->user_id;
    
    		if ( empty( $user_id ) )
    			return $avatar;
    
    		$local_avatars = get_user_meta( $user_id, 'simple_local_avatar', true );
    
    		if ( empty( $local_avatars ) || empty( $local_avatars['full'] ) )
    			return $avatar;
    
    		$size = (int) $size;
    
    		if ( empty( $alt ) )
    			$alt = get_the_author_meta( 'display_name', $user_id );
    
    		// generate a new size
    		if ( empty( $local_avatars[$size] ) ) {
    			$upload_path = wp_upload_dir();
    			$avatar_full_path = str_replace( $upload_path['baseurl'], $upload_path['basedir'], $local_avatars['full'] );
    			$image_sized = image_resize( $avatar_full_path, $size, $size, true );
    			// deal with original being >= to original image (or lack of sizing ability)
    			$local_avatars[$size] = is_wp_error($image_sized) ? $local_avatars[$size] = $local_avatars['full'] : str_replace( $upload_path['basedir'], $upload_path['baseurl'], $image_sized );
    			// save updated avatar sizes
    			update_user_meta( $user_id, 'simple_local_avatar', $local_avatars );
    		} elseif ( substr( $local_avatars[$size], 0, 4 ) != 'http' ) {
    			$local_avatars[$size] = home_url( $local_avatars[$size] );
    		}
    		if ( $onlySrc)
    			return $local_avatars[$size];
    		$author_class = is_author( $user_id ) ? ' current-author' : '' ;
    		$avatar = "<img alt='" . esc_attr( $alt ) . "' src='" . $local_avatars[$size] . "' class='avatar avatar-{$size}{$author_class} photo' height='{$size}' width='{$size}' />";
    
    		return apply_filters( 'simple_local_avatar', $avatar );
    	}
    
    	public function admin_init() {
    		load_plugin_textdomain( 'simple-local-avatars', false, dirname( plugin_basename( __FILE__ ) ) . '/localization/' );
    
    		register_setting( 'discussion', 'simple_local_avatars_caps', array( $this, 'sanitize_options' ) );
    		add_settings_field( 'simple-local-avatars-caps', __('Local Avatar Permissions','simple-local-avatars'), array( $this, 'avatar_settings_field' ), 'discussion', 'avatars' );
    	}
    
    	public function sanitize_options( $input ) {
    		$new_input['simple_local_avatars_caps'] = empty( $input['simple_local_avatars_caps'] ) ? 0 : 1;
    		return $new_input;
    	}
    
    	public function avatar_settings_field( $args ) {
    		$options = get_option('simple_local_avatars_caps');
    
    		echo '
    			<label for="simple_local_avatars_caps">
    				<input type="checkbox" name="simple_local_avatars_caps" id="simple_local_avatars_caps" value="1" ' . @checked( $options['simple_local_avatars_caps'], 1, false ) . ' />
    				' . __('Only allow users with file upload capabilities to upload local avatars (Authors and above)','simple-local-avatars') . '
    			</label>
    		';
    	}
    
    	public function edit_user_profile( $profileuser ) {
    	?>
    	<h3><?php _e( 'Avatar','simple-local-avatars' ); ?></h3>
    
    	<table class="form-table">
    		<tr>
    			<th><label for="simple-local-avatar"><?php _e('Upload Avatar','simple-local-avatars'); ?></label></th>
    			<td style="width: 50px;" valign="top">
    				<?php echo get_avatar( $profileuser->ID ); ?>
    			</td>
    			<td>
    			<?php
    				$options = get_option('simple_local_avatars_caps');
    
    				if ( empty($options['simple_local_avatars_caps']) || current_user_can('upload_files') ) {
    					do_action( 'simple_local_avatar_notices' );
    					wp_nonce_field( 'simple_local_avatar_nonce', '_simple_local_avatar_nonce', false );
    			?>
    					<input type="file" name="simple-local-avatar" id="simple-local-avatar" /><br />
    			<?php
    					if ( empty( $profileuser->simple_local_avatar ) )
    						echo '<span class="description">' . __('No local avatar is set. Use the upload field to add a local avatar.','simple-local-avatars') . '</span>';
    					else
    						echo '
    							<input type="checkbox" name="simple-local-avatar-erase" value="1" /> ' . __('Delete local avatar','simple-local-avatars') . '<br />
    							<span class="description">' . __('Replace the local avatar by uploading a new avatar, or erase the local avatar (falling back to a gravatar) by checking the delete option.','simple-local-avatars') . '</span>
    						';
    				} else {
    					if ( empty( $profileuser->simple_local_avatar ) )
    						echo '<span class="description">' . __('No local avatar is set. Set up your avatar at Gravatar.com.','simple-local-avatars') . '</span>';
    					else
    						echo '<span class="description">' . __('You do not have media management permissions. To change your local avatar, contact the blog administrator.','simple-local-avatars') . '</span>';
    				}
    			?>
    			</td>
    		</tr>
    	</table>
    	<script type="text/javascript">var form = document.getElementById('your-profile');form.encoding = 'multipart/form-data';form.setAttribute('enctype', 'multipart/form-data');</script>
    	<?php
    	}
    
    	public function edit_user_profile_update( $user_id ) {
    		if ( ! isset( $_POST['_simple_local_avatar_nonce'] ) || ! wp_verify_nonce( $_POST['_simple_local_avatar_nonce'], 'simple_local_avatar_nonce' ) )			//security
    			return;
    
    		if ( ! empty( $_FILES['simple-local-avatar']['name'] ) ) {
    			$mimes = array(
    				'jpg|jpeg|jpe' => 'image/jpeg',
    				'gif' => 'image/gif',
    				'png' => 'image/png',
    				'bmp' => 'image/bmp',
    				'tif|tiff' => 'image/tiff'
    			);
    
    			// front end (theme my profile etc) support
    			if ( ! function_exists( 'wp_handle_upload' ) )
    				require_once( ABSPATH . 'wp-admin/includes/file.php' );
    
    			$this->avatar_delete( $user_id );	// delete old images if successful
    
    			// need to be more secure since low privelege users can upload
    			if ( strstr( $_FILES['simple-local-avatar']['name'], '.php' ) )
    				wp_die('For security reasons, the extension ".php" cannot be in your file name.');
    
    			$this->user_id_being_edited = $user_id; // make user_id known to unique_filename_callback function
    			$avatar = wp_handle_upload( $_FILES['simple-local-avatar'], array( 'mimes' => $mimes, 'test_form' => false, 'unique_filename_callback' => array( $this, 'unique_filename_callback' ) ) );
    
    			if ( empty($avatar['file']) ) {		// handle failures
    				switch ( $avatar['error'] ) {
    					case 'File type does not meet security guidelines. Try another.' :
    						add_action( 'user_profile_update_errors', create_function('$a','$a->add("avatar_error",__("Please upload a valid image file for the avatar.","simple-local-avatars"));') );
    						break;
    					default :
    						add_action( 'user_profile_update_errors', create_function('$a','$a->add("avatar_error","<strong>".__("There was an error uploading the avatar:","simple-local-avatars")."</strong> ' . esc_attr( $avatar['error'] ) . '");') );
    				}
    
    				return;
    			}
    
    			update_user_meta( $user_id, 'simple_local_avatar', array( 'full' => $avatar['url'] ) );		// save user information (overwriting old)
    		} elseif ( ! empty( $_POST['simple-local-avatar-erase'] ) ) {
    			$this->avatar_delete( $user_id );
    		}
    	}
    
    	/**
    	 * remove the custom get_avatar hook for the default avatar list output on options-discussion.php
    	 */
    	public function avatar_defaults( $avatar_defaults ) {
    		remove_action( 'get_avatar', array( $this, 'get_avatar' ) );
    		return $avatar_defaults;
    	}
    
    	/**
    	 * delete avatars based on user_id
    	 */
    	public function avatar_delete( $user_id ) {
    		$old_avatars = get_user_meta( $user_id, 'simple_local_avatar', true );
    		$upload_path = wp_upload_dir();
    
    		if ( is_array($old_avatars) ) {
    			foreach ($old_avatars as $old_avatar ) {
    				$old_avatar_path = str_replace( $upload_path['baseurl'], $upload_path['basedir'], $old_avatar );
    				@unlink( $old_avatar_path );
    			}
    		}
    
    		delete_user_meta( $user_id, 'simple_local_avatar' );
    	}
    
    	public function unique_filename_callback( $dir, $name, $ext ) {
    		$user = get_user_by( 'id', (int) $this->user_id_being_edited );
    		$name = $base_name = sanitize_file_name( $user->display_name . '_avatar' );
    		$number = 1;
    
    		while ( file_exists( $dir . "/$name$ext" ) ) {
    			$name = $base_name . '_' . $number;
    			$number++;
    		}
    
    		return $name . $ext;
    	}
    }
    
    $simple_local_avatars = new Simple_Local_Avatars;
    
    /**
     * more efficient to call simple local avatar directly in theme and avoid gravatar setup
     *
     * @param int|string|object $id_or_email A user ID,  email address, or comment object
     * @param int $size Size of the avatar image
     * @param string $default URL to a default image to use if no avatar is available
     * @param string $alt Alternate text to use in image tag. Defaults to blank
     * @return string <img> tag for the user's avatar
     */
    function get_simple_local_avatar( $id_or_email, $size = '96', $default = '', $alt = false, $onlySrc = false ) {
    	global $simple_local_avatars;
    	$avatar = $simple_local_avatars->get_avatar( '', $id_or_email, $size, $default, $alt, $onlySrc );
    
    	if ( empty ( $avatar ) )
    		$avatar = get_avatar( $id_or_email, $size, $default, $alt );
    
    	return $avatar;
    }
    
    /**
     * on uninstallation, remove the custom field from the users and delete the local avatars
     */
    
    register_uninstall_hook( __FILE__, 'simple_local_avatars_uninstall' );
    
    function simple_local_avatars_uninstall() {
    	$simple_local_avatars = new Simple_Local_Avatars;
    	$users = get_users_of_blog();
    
    	foreach ( $users as $user )
    		$simple_local_avatars->avatar_delete( $user->user_id );
    
    	delete_option('simple_local_avatars_caps');
    }

    me avisas si te sirve, saludos!

    Iniciador del debate gringofer

    (@gringofer)

    Hola julio, gracias por responder nuevamente,

    Coloque el codigo que usted me dejo, pero la cosa sigue igual, sin aparecer el avatar….

    Saludos!

    lo que no entiendo aun es donde debieran aparecer esos avatars, en los comentarios?, o en alguna otra parte?, en los comentarios lo probé con una instalación nueva de wordpress y me muestra bien los avatars de simple local avatar: http://cl.ly/0v3T1k0G0e0g3e2M3B1e

    saludos!

    Iniciador del debate gringofer

    (@gringofer)

    Si, en los comentarios no hay problemas, aparecen bien.

    El problema esta en author-exposed, que es un plugin que brinda información del creador de la «entrada», dando un clic en su nombre. La cosa es que entre esa información, muestra el avatar, por defecto muestra el avatar de gravatar asociado con el mail del creador de la entrada, pero como mis usuarios usan local avatar, quiero que muestre ese.

    Aqui dejo una imagen de como se ve la info del autor de las entradas, y veras lo del avatar. Imagen

    Saludos!

    ahora se a lo que te refieres, no habia agregado el codigo del plugin al template, dejame ver que puede ser y subo el codigo nuevamente, saludos!

    jejejeje ya encontré el error, había puesto $email en vez de $mail en author-exposed, este codigo te debiera funcionar sin problemas:

    <?php
    /*
    Plugin Name: Author Exposed
    Plugin URI: http://colorlightstudio.com/2010/06/01/wordpress-plugin-author-exposed-v-1-1/
    Description: Simple and elegant way to get more information about author.
    Version: 1.1
    Author: Igor Penjivrag
    Author URI: http://colorlightstudio.com
    */
    
    /*  Copyright 2008  Igor Penjivrag  (email : igor@colorlightstudio.com)
    
        This program is free software; you can redistribute it and/or modify
        it under the terms of the GNU General Public License as published by
        the Free Software Foundation; either version 2 of the License, or
        (at your option) any later version.
    
        This program is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        GNU General Public License for more details.
    
        You should have received a copy of the GNU General Public License
        along with this program; if not, write to the Free Software
        Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    */
    
    function author_exposed() {
    	global $authordata;
    	$nick = get_the_author();
    
    // Gravatar Photo
    
    	$mail = get_the_author_email();
    	$gravatar = 'http://www.gravatar.com/avatar.php?gravatar_id=' .md5($mail);
    	if ( function_exists('get_simple_local_avatar') ) {
    		$gravatar = get_simple_local_avatar($mail, 96, '', false, true);
    	}
    
    // Get ID for hidden DIV
    
    	$div_id = 'a'.get_the_ID();
    
    // Hidden DIV output
    
    	$author_posts_link = get_author_posts_url($authordata->ID, $authordata->user_nicename );
    
    	$hidden_div = '<span id="'.$div_id.'" class="mydiv" style="display:none;"><img src="'.$gravatar.'" alt="gravatar" /><span class="ae_close"><a href="javascript:;" onmousedown="toggleDiv(\''.$div_id.'\');">close</a></span><span class="ae_top"><b>Author: '.get_the_author().'</b></span>
    		<span class="ae_body"><b>Name bla</b>: '.get_the_author_firstname().' '.get_the_author_lastname().'<br /><b>Email:</b> '.get_the_author_email().'<br /><b>Site:</b> <a href="'.get_the_author_url().'">'.get_the_author_url().'</a><br /></span><span class="ae_about"><b>About:</b> '.get_the_author_description().'</span><span class="ae_body"><a href="'.$author_posts_link.'">See Authors Posts</a> ('.get_the_author_posts().')</span></span>';
    
    // Show it
    
    	echo ('<a href="javascript:;" onmousedown="toggleDiv(\''.$div_id.'\');">'.$nick.'</a>'.$hidden_div);
    
    }
    
    // Hook
    
    	add_filter('the_author_posts_link', 'author_exposed');  
    
    // Add JavaScript and Styles to header
    
    	add_action('wp_head', 'add_head');
    	function add_head() {
    	echo '<script type="text/javascript" src="'.get_option(siteurl).'/wp-content/plugins/author-exposed/javascript/skripta.js"></script><link rel="stylesheet" href="'.get_option('siteurl').'/wp-content/plugins/author-exposed/css/ae_style.css" type="text/css" />';
    }
    
    ?>

    saludos!

    Iniciador del debate gringofer

    (@gringofer)

    Julio, coloque ese nuevo codigo, pero sigue sin funcionar!… es un verdadero lio resolver este problema jejeje

    pero ocupaste el código de simple-local-avatar.php que te di y este último codigo para author-exposed.php?

    Iniciador del debate gringofer

    (@gringofer)

    si asi es, ahora no se ve el avatar de gravatar… pero tampoco el de local!

    creo que este código te funcionará perfectamente:

    author-exposed.php

    <?php
    /*
    Plugin Name: Author Exposed
    Plugin URI: http://colorlightstudio.com/2010/06/01/wordpress-plugin-author-exposed-v-1-1/
    Description: Simple and elegant way to get more information about author.
    Version: 1.1
    Author: Igor Penjivrag
    Author URI: http://colorlightstudio.com
    */
    
    /*  Copyright 2008  Igor Penjivrag  (email : igor@colorlightstudio.com)
    
        This program is free software; you can redistribute it and/or modify
        it under the terms of the GNU General Public License as published by
        the Free Software Foundation; either version 2 of the License, or
        (at your option) any later version.
    
        This program is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        GNU General Public License for more details.
    
        You should have received a copy of the GNU General Public License
        along with this program; if not, write to the Free Software
        Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    */
    
    function author_exposed() {
    	global $authordata;
    	$nick = get_the_author();
    
    // Gravatar Photo
    
    	$mail = get_the_author_email();
    	$gravatar = 'http://www.gravatar.com/avatar.php?gravatar_id=' .md5($mail);
    	$img_gravatar = false;
    	if ( function_exists('get_simple_local_avatar') ) {
    		$img_gravatar = get_simple_local_avatar($mail, 96, '', false, true);
    		if (strpos($img_gravatar,'<img') === false ) {
    			$gravatar = $img_gravatar;
    			$img_gravatar = false;
    		}
    	}
    
    // Get ID for hidden DIV
    
    	$div_id = 'a'.get_the_ID();
    
    // Hidden DIV output
    
    	$author_posts_link = get_author_posts_url($authordata->ID, $authordata->user_nicename );
    
    	$hidden_div = '<span id="'.$div_id.'" class="mydiv" style="display:none;">'.($img_gravatar?$img_gravatar:'<img src="'.$gravatar.'" alt="gravatar" />').'<span class="ae_close"><a href="javascript:;" onmousedown="toggleDiv(\''.$div_id.'\');">close</a></span><span class="ae_top"><b>Author: '.get_the_author().'</b></span>
    		<span class="ae_body"><b>Name bla</b>: '.get_the_author_firstname().' '.get_the_author_lastname().'<br /><b>Email:</b> '.get_the_author_email().'<br /><b>Site:</b> <a href="'.get_the_author_url().'">'.get_the_author_url().'</a><br /></span><span class="ae_about"><b>About:</b> '.get_the_author_description().'</span><span class="ae_body"><a href="'.$author_posts_link.'">See Authors Posts</a> ('.get_the_author_posts().')</span></span>';
    
    // Show it
    
    	echo ('<a href="javascript:;" onmousedown="toggleDiv(\''.$div_id.'\');">'.$nick.'</a>'.$hidden_div);
    
    }
    
    // Hook
    
    	add_filter('the_author_posts_link', 'author_exposed');  
    
    // Add JavaScript and Styles to header
    
    	add_action('wp_head', 'add_head');
    	function add_head() {
    	echo '<script type="text/javascript" src="'.get_option(siteurl).'/wp-content/plugins/author-exposed/javascript/skripta.js"></script><link rel="stylesheet" href="'.get_option('siteurl').'/wp-content/plugins/author-exposed/css/ae_style.css" type="text/css" />';
    }
    
    ?>

    saludos!

Viendo 15 respuestas - de la 1 a la 15 (de un total de 16)
  • El debate ‘Modificar Plugin’ está cerrado a nuevas respuestas.