diff --git bp-groups/bp-groups-screens.php bp-groups/bp-groups-screens.php
index b6475f8..6c1101c 100644
|
|
class BP_Groups_Theme_Compat { |
1022 | 1022 | public function directory_dummy_post() { |
1023 | 1023 | |
1024 | 1024 | // Title based on ability to create groups |
1025 | | if ( is_user_logged_in() && bp_user_can_create_groups() ) { |
1026 | | $title = __( 'Groups', 'buddypress' ) . ' <a class="button bp-title-button" href="' . trailingslashit( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/create' ) . '">' . __( 'Create a Group', 'buddypress' ) . '</a>'; |
1027 | | } else { |
1028 | | $title = __( 'Groups', 'buddypress' ); |
1029 | | } |
| 1025 | $title = apply_filters( 'bp_groups_directory_title', __( 'Groups', 'buddypress' ) ); |
1030 | 1026 | |
1031 | 1027 | bp_theme_compat_reset_post( array( |
1032 | 1028 | 'ID' => 0, |
… |
… |
class BP_Groups_Theme_Compat { |
1114 | 1110 | /** Single ****************************************************************/ |
1115 | 1111 | |
1116 | 1112 | /** |
1117 | | * Add custom template hierarchy to theme compat for group pages. |
| 1113 | * Add custom template hierarchy to theme compat for group pages. |
1118 | 1114 | * |
1119 | 1115 | * This is to mirror how WordPress has {@link https://codex.wordpress.org/Template_Hierarchy template hierarchy}. |
1120 | 1116 | * |
diff --git bp-groups/bp-groups-template.php bp-groups/bp-groups-template.php
index 675409e..f1fbfec 100644
|
|
function bp_group_join_button( $group = false ) { |
1854 | 1854 | } |
1855 | 1855 | |
1856 | 1856 | /** |
| 1857 | * Output the Create a Group button. |
| 1858 | * |
| 1859 | * @since BuddyPress (2.0.0) |
| 1860 | */ |
| 1861 | function bp_group_create_button() { |
| 1862 | echo bp_get_group_create_button(); |
| 1863 | } |
| 1864 | /** |
| 1865 | * Get the Create a Group button. |
| 1866 | * |
| 1867 | * @since BuddyPress (2.0.0) |
| 1868 | * |
| 1869 | * @return string |
| 1870 | */ |
| 1871 | function bp_get_group_create_button() { |
| 1872 | if ( ! is_user_logged_in() ) { |
| 1873 | return false; |
| 1874 | } |
| 1875 | |
| 1876 | if ( ! bp_user_can_create_groups() ) { |
| 1877 | return false; |
| 1878 | } |
| 1879 | |
| 1880 | $button_args = array( |
| 1881 | 'id' => 'create_group', |
| 1882 | 'component' => 'groups', |
| 1883 | 'link_text' => __( 'Create a Group', 'buddypress' ), |
| 1884 | 'link_title' => __( 'Create a Group', 'buddypress' ), |
| 1885 | 'link_class' => 'button group-create bp-title-button', |
| 1886 | 'link_href' => trailingslashit( bp_get_root_domain() ) . trailingslashit( bp_get_groups_root_slug() ) . trailingslashit( 'create' ), |
| 1887 | 'wrapper' => false, |
| 1888 | |
| 1889 | ); |
| 1890 | return bp_get_button( $button_args ); |
| 1891 | } |
| 1892 | |
| 1893 | |
| 1894 | /** |
1857 | 1895 | * Prints a message if the group is not visible to the current user (it is a |
1858 | 1896 | * hidden or private group, and the user does not have access). |
1859 | 1897 | * |
diff --git bp-templates/bp-legacy/buddypress-functions.php bp-templates/bp-legacy/buddypress-functions.php
index 0cb3153..2e8069c 100644
|
|
class BP_Legacy extends BP_Theme_Compat { |
111 | 111 | add_action( 'bp_group_header_actions', 'bp_group_join_button', 5 ); |
112 | 112 | add_action( 'bp_group_header_actions', 'bp_group_new_topic_button', 20 ); |
113 | 113 | add_action( 'bp_directory_groups_actions', 'bp_group_join_button' ); |
| 114 | add_filter( 'bp_groups_directory_title', 'bp_legacy_theme_group_create_button' ); |
114 | 115 | } |
115 | 116 | |
116 | 117 | // Blog button |
… |
… |
new BP_Legacy(); |
420 | 421 | endif; |
421 | 422 | |
422 | 423 | /** |
| 424 | * Add the Create a Group button to the Groups directory title. |
| 425 | * |
| 426 | * @since BuddyPress (2.0.0) |
| 427 | * |
| 428 | * @param string $title Groups directory title. |
| 429 | * @return string |
| 430 | */ |
| 431 | function bp_legacy_theme_group_create_button( $title ) { |
| 432 | return $title . ' ' . bp_get_group_create_button(); |
| 433 | } |
| 434 | |
| 435 | /** |
423 | 436 | * This function looks scarier than it actually is. :) |
424 | 437 | * Each object loop (activity/members/groups/blogs/forums) contains default |
425 | 438 | * parameters to show specific information based on the page we are currently |