Title: jdpond's Replies | WordPress.org

---

# jdpond

  [  ](https://wordpress.org/support/users/jdpond/)

 *   [Profile](https://wordpress.org/support/users/jdpond/)
 *   [Topics Started](https://wordpress.org/support/users/jdpond/topics/)
 *   [Replies Created](https://wordpress.org/support/users/jdpond/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/jdpond/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/jdpond/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/jdpond/engagements/)
 *   [Favorites](https://wordpress.org/support/users/jdpond/favorites/)

 Search replies:

## Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Custom User Profile Photo] Photo won't show up](https://wordpress.org/support/topic/photo-wont-show-up/)
 *  [jdpond](https://wordpress.org/support/users/jdpond/)
 * (@jdpond)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/photo-wont-show-up/#post-5915383)
 * Oops, should have said the above code goes into the child “Theme Functions” (
   functions.php). To modify the theme and override get_avatar.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Custom User Profile Photo] Photo won't show up](https://wordpress.org/support/topic/photo-wont-show-up/)
 *  [jdpond](https://wordpress.org/support/users/jdpond/)
 * (@jdpond)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/photo-wont-show-up/#post-5915382)
 * To enable local system avatars in a template that uses avatars, you need to replace
   whenever the avatar is requested. This works for Customizr, but the concept is
   similar for others that use an avatar. The alternative is to change every template
   where you want to display an avatar and add it in using the “echo” command.
 * This describes the process to override the ‘get_avatar’ function used in many
   themes, including customizr.
 * To do this, you need to create a child template (so your changes don’t get overridden
   every time you update your template) and implement the runkit extension in php.
   I know this is complicated, but I couldn’t find anything less.
 * Also NOTE the recommended statement by the authors of this plugin will only give
   you YOUR icon:
 * $imgURL = get_cupp_meta($user_id, $size); // wrong
 * You need to use the following:
 * $imgURL = get_the_author_meta(‘cupp_upload_meta’, $id, $size); // correct
 * Step-by-step guide (For Customizr on Ubuntu/Apache)
    1. Install ‘Childify Me’ plugin to enable modifications to the template that will
       not be lost and create a child template
    2. Install ‘Custom User Profile Photo’ to enable custom photo uploads and associate
       with user profiles
    3. Install [http://github.com/zenovich/runkit](http://github.com/zenovich/runkit)
       for php (note: had to use master, the current release had build errors)
 *  1. `wget https://github.com/zenovich/runkit/archive/master.zip`
    2. `unzip master.zip`
    3. `mv master runkit-1.0.4`
    4. `tar -zcvf runkit-1.0.4.tgz runkit-1.0.4`
    5. `pecl install runkit-1.0.4.tgz`
    6. Create a `/etc/php5/apache2/ mods-available/runkit.ini` with extension=runkit.
       ini
    7. Create a 20-runkit.ini -> ../../mods-available/runkit.ini simlink (ln –s)
    8. Restart the apache server
 *  1. Add the following using the Appearance->editor->Theme Functions to override 
       the Customizr display avatar code:
 * `
    <?php // Your amazing code here (post parent load) if ( function_exists( '
   get_avatar' ) ) : runkit_function_remove ( 'get_avatar' ); endif; /** * These
   functions can be replaced via plugins. If plugins do not redefine these * functions,
   then these will be used instead. * * @package WordPress */ if ( !function_exists('
   get_avatar' ) ) : /** * Retrieve the avatar for a user who provided a user ID
   or email address. * * @since 2.5.0 * * @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 Alternative text to use in image tag. Defaults
   to blank * @return false|string <img> tag for the user’s avatar. */ function 
   get_avatar( $id_or_email, $size = ’96’, $default = ”, $alt = false ) { if ( !
   get_option(‘show_avatars’) ) return false; if ( false === $alt) $safe_alt = ”;
   else $safe_alt = esc_attr( $alt ); if ( !is_numeric($size) ) $size = ’96’; $email
   = ”; if ( is_numeric($id_or_email) ) { $id = (int) $id_or_email; $user = get_userdata(
   $id); if ( $user ) $email = $user->user_email; } elseif ( is_object($id_or_email)){//
   No avatar for pingbacks or trackbacks /** * Filter the list of allowed comment
   types for retrieving avatars. * * [@since](https://wordpress.org/support/users/since/)
   3.0.0 * * [@param](https://wordpress.org/support/users/param/) array $types An
   array of content types. Default only contains ‘comment’. */ $allowed_comment_types
   = apply_filters( ‘get_avatar_comment_types’, array( ‘comment’ ) ); if ( ! empty(
   $id_or_email->comment_type ) && ! in_array( $id_or_email->comment_type, (array)
   $allowed_comment_types ) ) return false; if ( ! empty( $id_or_email->user_id )){
   $id = (int) $id_or_email->user_id; $user = get_userdata($id); if ( $user ) $email
   = $user->user_email; } if ( ! $email && ! empty( $id_or_email->comment_author_email))
   $email = $id_or_email->comment_author_email; } else { $email = $id_or_email; }
   $imgURL = get_the_author_meta(‘cupp_upload_meta’, $id, $size); // Print the image
   on the page return(‘<img src=”‘. $imgURL .'” alt=””>’); } endif;

Viewing 2 replies - 1 through 2 (of 2 total)