Changeset 10721
- Timestamp:
- 04/27/2016 03:59:26 PM (9 years ago)
- Location:
- trunk/src
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/bp-core-avatars.php
r10688 r10721 176 176 * case 'no_grav' should be set to true. To disable Gravatar 177 177 * fallbacks globally, see the 'bp_core_fetch_avatar_no_grav' filter. 178 * Default: false.178 * Default: true for groups, otherwise false. 179 179 * @type bool $html Whether to return an <img> HTML element, vs a raw URL 180 180 * to an avatar. If false, <img>-specific arguments (like 'css_id') … … 212 212 'alt' => '', 213 213 'email' => false, 214 'no_grav' => false,214 'no_grav' => null, 215 215 'html' => true, 216 216 'title' => '', … … 565 565 } 566 566 567 // By default, Gravatar is not pinged for groups. 568 if ( null === $params['no_grav'] ) { 569 $params['no_grav'] = 'group' === $params['object']; 570 } 571 567 572 /** 568 573 * Filters whether or not to skip Gravatar check. … … 672 677 * @param array $params Array of parameters for the avatar request. 673 678 */ 674 $gravatar = apply_filters( 'bp_core_default_avatar_' . $params['object'], bp_core_avatar_default( 'local' ), $params );679 $gravatar = apply_filters( 'bp_core_default_avatar_' . $params['object'], bp_core_avatar_default( 'local', $params ), $params ); 675 680 } 676 681 … … 1846 1851 * 1847 1852 * @since 1.5.0 1848 * 1849 * @param string $type 'local' if the fallback should be the locally-hosted version 1850 * of the mystery-person, 'gravatar' if the fallback should be 1851 * Gravatar's version. Default: 'gravatar'. 1853 * @since 2.6.0 Introduced `$params` and `$object_type` parameters. 1854 * 1855 * @param string $type 'local' if the fallback should be the locally-hosted version 1856 * of the mystery person, 'gravatar' if the fallback should be 1857 * Gravatar's version. Default: 'gravatar'. 1858 * @param array $params Parameters passed to bp_core_fetch_avatar(). 1852 1859 * @return string The URL of the default avatar. 1853 1860 */ 1854 function bp_core_avatar_default( $type = 'gravatar' ) {1861 function bp_core_avatar_default( $type = 'gravatar', $params = array() ) { 1855 1862 // Local override. 1856 1863 if ( defined( 'BP_AVATAR_DEFAULT' ) ) { … … 1870 1877 * 1871 1878 * @since 1.5.0 1879 * @since 2.6.0 Added `$params`. 1872 1880 * 1873 1881 * @param string $avatar URL of the default avatar. 1874 */ 1875 return apply_filters( 'bp_core_avatar_default', $avatar ); 1882 * @param array $params Params provided to bp_core_fetch_avatar(). 1883 */ 1884 return apply_filters( 'bp_core_avatar_default', $avatar, $params ); 1876 1885 } 1877 1886 … … 1883 1892 * 1884 1893 * @since 1.5.0 1885 * 1886 * @param string $type 'local' if the fallback should be the locally-hosted version 1887 * of the mystery-person, 'gravatar' if the fallback should be 1888 * Gravatar's version. Default: 'gravatar'. 1894 * @since 2.6.0 Introduced `$object_type` parameter. 1895 * 1896 * @param string $type 'local' if the fallback should be the locally-hosted version 1897 * of the mystery person, 'gravatar' if the fallback should be 1898 * Gravatar's version. Default: 'gravatar'. 1899 * @param array $params Parameters passed to bp_core_fetch_avatar(). 1889 1900 * @return string The URL of the default avatar thumb. 1890 1901 */ 1891 function bp_core_avatar_default_thumb( $type = 'gravatar' ) {1902 function bp_core_avatar_default_thumb( $type = 'gravatar', $params = array() ) { 1892 1903 // Local override. 1893 1904 if ( defined( 'BP_AVATAR_DEFAULT_THUMB' ) ) { … … 1907 1918 * 1908 1919 * @since 1.5.0 1920 * @since 2.6.0 Added `$params`. 1909 1921 * 1910 1922 * @param string $avatar URL of the default avatar. 1911 */ 1912 return apply_filters( 'bp_core_avatar_thumb', $avatar ); 1923 * @param string $params Params provided to bp_core_fetch_avatar(). 1924 */ 1925 return apply_filters( 'bp_core_avatar_thumb', $avatar, $params ); 1913 1926 } 1914 1927 -
trunk/src/bp-groups/bp-groups-filters.php
r10572 r10721 73 73 // Activity component integration. 74 74 add_filter( 'bp_activity_at_name_do_notifications', 'bp_groups_disable_at_mention_notification_for_non_public_groups', 10, 4 ); 75 76 // Default group avatar. 77 add_filter( 'bp_core_avatar_default', 'bp_groups_default_avatar', 10, 3 ); 78 add_filter( 'bp_core_avatar_default_thumb', 'bp_groups_default_avatar', 10, 3 ); 75 79 76 80 /** … … 320 324 return $send; 321 325 } 326 327 /** 328 * Use the mystery group avatar for groups. 329 * 330 * @since 2.6.0 331 * 332 * @param string $avatar Current avatar src. 333 * @param array $params Avatar params. 334 * @return string 335 */ 336 function bp_groups_default_avatar( $avatar, $params ) { 337 if ( isset( $params['object'] ) && 'group' === $params['object'] ) { 338 if ( isset( $params['type'] ) && 'thumb' === $params['type'] ) { 339 $file = 'mystery-group-50.png'; 340 } else { 341 $file = 'mystery-group.png'; 342 } 343 344 $avatar = buddypress()->plugin_url . "bp-core/images/$file"; 345 } 346 347 return $avatar; 348 } -
trunk/src/bp-groups/bp-groups-template.php
r10652 r10721 600 600 'class' => $r['class'], 601 601 'width' => $r['width'], 602 'height' => $r['height'] 602 'height' => $r['height'], 603 603 ) ); 604 604 … … 4706 4706 'id' => 'avatar-crop-preview', 4707 4707 'alt' => __( 'Group photo', 'buddypress' ), 4708 'no_grav' => false4709 4708 ), 'get_new_group_avatar' ); 4710 4709 … … 5149 5148 } 5150 5149 5151 $ group_avatar = bp_core_fetch_avatar(array(5150 $avatar_args = array( 5152 5151 'item_id' => $group_id, 5153 5152 'object' => 'group', 5154 5153 'no_grav' => true, 5155 5154 'html' => false, 5156 ) ); 5157 5158 if ( bp_core_avatar_default( 'local' ) === $group_avatar ) { 5155 'type' => 'thumb', 5156 ); 5157 5158 $group_avatar = bp_core_fetch_avatar( $avatar_args ); 5159 5160 if ( bp_core_avatar_default( 'local', $avatar_args ) === $group_avatar ) { 5159 5161 return false; 5160 5162 }
Note: See TracChangeset
for help on using the changeset viewer.