Changeset 1012313
- Timestamp:
- 10/22/2014 07:09:50 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
wordpress-social-login/trunk/includes/services/wsl.user.avatar.php
r1012306 r1012313 30 30 //Check if avatars are enabled 31 31 if( ! get_option( 'wsl_settings_users_avatars' ) ) 32 { 33 return $html; 34 } 35 36 //Only Overwrite gravatars 37 if( ! stristr( strtolower( $html ), 'gravatar.com' ) ) 32 38 { 33 39 return $html; … … 114 120 } 115 121 122 //Only Overwrite gravatars 123 if( ! stristr( strtolower( $html ), 'gravatar.com' ) ) 124 { 125 return $html; 126 } 127 116 128 $user_id = null; 117 129 … … 125 137 if( ! empty( $args ['item_id'] ) AND is_numeric( $args ['item_id'] ) ) 126 138 { 127 //Overwrite gravatars 128 if( stristr( strtolower( $html ), '.gravatar.com' ) ) 139 $user_id = $args['item_id']; 140 141 $wsl_avatar = wsl_get_user_custom_avatar( $user_id ); 142 143 //Retrieve Avatar 144 if( $wsl_avatar ) 129 145 { 130 $user_id = $args['item_id']; 146 $img_class = ('class="' .(!empty($args ['class']) ?($args ['class'] . ' ') : '') . 'avatar-wordpress-social-login" '); 147 $img_width = (!empty($args ['width']) ? 'width="' . $args ['width'] . '" ' : 'width="' . bp_core_avatar_full_width() . '" ' ); 148 $img_height = (!empty($args ['height']) ? 'height="' . $args ['height'] . '" ' : 'height="' . bp_core_avatar_full_height() . '" ' ); 149 $img_alt = (!empty( $args['alt'] ) ? 'alt="' . esc_attr( $args['alt'] ) . '" ' : '' ); 131 150 132 $wsl_avatar = wsl_get_user_custom_avatar( $user_id ); 151 //Replace 152 $wsl_html = preg_replace('#<img[^>]+>#i', '<img src="' . $wsl_avatar . '" ' . $img_alt . $img_class . $img_height . $img_width . '/>', $html ); 133 153 134 //Retrieve Avatar 135 if( $wsl_avatar ) 136 { 137 $img_class = ('class="' .(!empty($args ['class']) ?($args ['class'] . ' ') : '') . 'avatar-wordpress-social-login" '); 138 $img_width = (!empty($args ['width']) ? 'width="' . $args ['width'] . '" ' : 'width="' . bp_core_avatar_full_width() . '" ' ); 139 $img_height = (!empty($args ['height']) ? 'height="' . $args ['height'] . '" ' : 'height="' . bp_core_avatar_full_height() . '" ' ); 140 $img_alt = (!empty( $args['alt'] ) ? 'alt="' . esc_attr( $args['alt'] ) . '" ' : '' ); 141 142 //Replace 143 $wsl_html = preg_replace('#<img[^>]+>#i', '<img src="' . $wsl_avatar . '" ' . $img_alt . $img_class . $img_height . $img_width . '/>', $html ); 144 145 // HOOKABLE: 146 return apply_filters( 'wsl_hook_alter_get_bp_user_custom_avatar', $wsl_html, $user_id, $wsl_avatar, $html, $args ); 147 } 154 // HOOKABLE: 155 return apply_filters( 'wsl_hook_alter_get_bp_user_custom_avatar', $wsl_html, $user_id, $wsl_avatar, $html, $args ); 148 156 } 149 157 } 150 158 } 151 } 159 } 152 160 153 161 return $html;
Note: See TracChangeset
for help on using the changeset viewer.