diff --git src/bp-core/bp-core-avatars.php src/bp-core/bp-core-avatars.php
index 786c09f..e347992 100644
|
|
|
function bp_core_fetch_avatar( $args = '' ) { |
| 671 | 671 | * @param string $value Default avatar for non-gravatar requests. |
| 672 | 672 | * @param array $params Array of parameters for the avatar request. |
| 673 | 673 | */ |
| 674 | | $gravatar = apply_filters( 'bp_core_default_avatar_' . $params['object'], bp_core_avatar_default( 'local' ), $params ); |
| | 674 | $gravatar = apply_filters( 'bp_core_default_avatar_' . $params['object'], bp_core_avatar_default( 'local', $params ), $params ); |
| 675 | 675 | } |
| 676 | 676 | |
| 677 | 677 | if ( true === $params['html'] ) { |
| … |
… |
function bp_core_avatar_original_max_filesize() { |
| 1845 | 1845 | * Get the URL of the 'full' default avatar. |
| 1846 | 1846 | * |
| 1847 | 1847 | * @since 1.5.0 |
| | 1848 | * @since 2.6.0 Introduced `$params` and `$object_type` parameters. |
| 1848 | 1849 | * |
| 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'. |
| | 1850 | * @param string $type 'local' if the fallback should be the locally-hosted version |
| | 1851 | * of the mystery person, 'gravatar' if the fallback should be |
| | 1852 | * Gravatar's version. Default: 'gravatar'. |
| | 1853 | * @param array $params Parameters passed to bp_core_fetch_avatar(). |
| 1852 | 1854 | * @return string The URL of the default avatar. |
| 1853 | 1855 | */ |
| 1854 | | function bp_core_avatar_default( $type = 'gravatar' ) { |
| | 1856 | function bp_core_avatar_default( $type = 'gravatar', $params = array() ) { |
| 1855 | 1857 | // Local override. |
| 1856 | 1858 | if ( defined( 'BP_AVATAR_DEFAULT' ) ) { |
| 1857 | 1859 | $avatar = BP_AVATAR_DEFAULT; |
| … |
… |
function bp_core_avatar_default( $type = 'gravatar' ) { |
| 1869 | 1871 | * Filters the URL of the 'full' default avatar. |
| 1870 | 1872 | * |
| 1871 | 1873 | * @since 1.5.0 |
| | 1874 | * @since 2.6.0 Added `$type` and `$params`. |
| 1872 | 1875 | * |
| 1873 | 1876 | * @param string $avatar URL of the default avatar. |
| | 1877 | * @param array $params Params provided to bp_core_fetch_avatar(). |
| 1874 | 1878 | */ |
| 1875 | | return apply_filters( 'bp_core_avatar_default', $avatar ); |
| | 1879 | return apply_filters( 'bp_core_avatar_default', $avatar, $params ); |
| 1876 | 1880 | } |
| 1877 | 1881 | |
| 1878 | 1882 | /** |
| … |
… |
function bp_core_avatar_default( $type = 'gravatar' ) { |
| 1882 | 1886 | * defined. |
| 1883 | 1887 | * |
| 1884 | 1888 | * @since 1.5.0 |
| | 1889 | * @since 2.6.0 Introduced `$object_type` parameter. |
| 1885 | 1890 | * |
| 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'. |
| | 1891 | * @param string $type 'local' if the fallback should be the locally-hosted version |
| | 1892 | * of the mystery person, 'gravatar' if the fallback should be |
| | 1893 | * Gravatar's version. Default: 'gravatar'. |
| | 1894 | * @param array $params Parameters passed to bp_core_fetch_avatar(). |
| 1889 | 1895 | * @return string The URL of the default avatar thumb. |
| 1890 | 1896 | */ |
| 1891 | | function bp_core_avatar_default_thumb( $type = 'gravatar' ) { |
| | 1897 | function bp_core_avatar_default_thumb( $type = 'gravatar', $params = array() ) { |
| 1892 | 1898 | // Local override. |
| 1893 | 1899 | if ( defined( 'BP_AVATAR_DEFAULT_THUMB' ) ) { |
| 1894 | 1900 | $avatar = BP_AVATAR_DEFAULT_THUMB; |
| … |
… |
function bp_core_avatar_default_thumb( $type = 'gravatar' ) { |
| 1906 | 1912 | * Filters the URL of the 'thumb' default avatar. |
| 1907 | 1913 | * |
| 1908 | 1914 | * @since 1.5.0 |
| | 1915 | * @since 2.6.0 Added `$type` and `$params`. |
| 1909 | 1916 | * |
| 1910 | 1917 | * @param string $avatar URL of the default avatar. |
| | 1918 | * @param string $type 'local' or 'gravatar'. |
| | 1919 | * @param string $params Params provided to bp_core_fetch_avatar(). |
| 1911 | 1920 | */ |
| 1912 | | return apply_filters( 'bp_core_avatar_thumb', $avatar ); |
| | 1921 | return apply_filters( 'bp_core_avatar_thumb', $avatar, $params ); |
| 1913 | 1922 | } |
| 1914 | 1923 | |
| 1915 | 1924 | /** |
diff --git src/bp-core/images/mystery-group-50.png src/bp-core/images/mystery-group-50.png
new file mode 100644
index 0000000..17f6dcf
Binary files /dev/null and src/bp-core/images/mystery-group-50.png differ
diff --git src/bp-core/images/mystery-group.png src/bp-core/images/mystery-group.png
new file mode 100644
index 0000000..e6bcd7f
Binary files /dev/null and src/bp-core/images/mystery-group.png differ
diff --git src/bp-groups/bp-groups-filters.php src/bp-groups/bp-groups-filters.php
index d1bf7f9..0ef075f 100644
|
|
|
add_filter( 'bp_get_total_group_count_for_user', 'bp_core_number_format' ); |
| 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 | 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 ); |
| | 79 | |
| 76 | 80 | /** |
| 77 | 81 | * Filter output of Group Description through WordPress's KSES API. |
| 78 | 82 | * |
| … |
… |
function bp_groups_disable_at_mention_notification_for_non_public_groups( $send, |
| 319 | 323 | |
| 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 | } |
diff --git src/bp-groups/bp-groups-template.php src/bp-groups/bp-groups-template.php
index dd454eb..fbfac50 100644
|
|
|
function bp_group_avatar( $args = '' ) { |
| 599 | 599 | 'css_id' => $r['id'], |
| 600 | 600 | 'class' => $r['class'], |
| 601 | 601 | 'width' => $r['width'], |
| 602 | | 'height' => $r['height'] |
| | 602 | 'height' => $r['height'], |
| | 603 | 'no_grav' => true, |
| 603 | 604 | ) ); |
| 604 | 605 | |
| 605 | 606 | // If No avatar found, provide some backwards compatibility. |
| … |
… |
function bp_new_group_avatar( $args = '' ) { |
| 4705 | 4706 | 'class' => 'avatar', |
| 4706 | 4707 | 'id' => 'avatar-crop-preview', |
| 4707 | 4708 | 'alt' => __( 'Group photo', 'buddypress' ), |
| 4708 | | 'no_grav' => false |
| 4709 | 4709 | ), 'get_new_group_avatar' ); |
| 4710 | 4710 | |
| 4711 | 4711 | // Merge parsed arguments with object specific data. |
| … |
… |
function bp_get_group_has_avatar( $group_id = false ) { |
| 5148 | 5148 | $group_id = bp_get_current_group_id(); |
| 5149 | 5149 | } |
| 5150 | 5150 | |
| 5151 | | $group_avatar = bp_core_fetch_avatar( array( |
| | 5151 | $avatar_args = array( |
| 5152 | 5152 | 'item_id' => $group_id, |
| 5153 | 5153 | 'object' => 'group', |
| 5154 | 5154 | 'no_grav' => true, |
| 5155 | 5155 | 'html' => false, |
| 5156 | | ) ); |
| | 5156 | ); |
| | 5157 | |
| | 5158 | $group_avatar = bp_core_fetch_avatar( $avatar_args ); |
| 5157 | 5159 | |
| 5158 | | if ( bp_core_avatar_default( 'local' ) === $group_avatar ) { |
| | 5160 | if ( bp_core_avatar_default( 'local', $avatar_args ) === $group_avatar ) { |
| 5159 | 5161 | return false; |
| 5160 | 5162 | } |
| 5161 | 5163 | |