Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/21/2014 06:24:16 PM (12 years ago)
Author:
imath
Message:

Remove all links in titles of directory and single item pages

Since BuddyPress 1.7, to display the "Create" buttons (Blogs & Groups component) and links to the single item landing pages at a similar place to BP-Default, BP Theme Compat was adding links into the title of the WordPress post object. For 2.2, team has decided to remove all these links and find a better placement for them before the end of the dev-cycle.

See #6008

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-groups/bp-groups-screens.php

    r9027 r9157  
    11001100         */
    11011101        public function directory_dummy_post() {
    1102 
    1103                 $title = apply_filters( 'bp_groups_directory_header', bp_get_directory_title( 'groups' ) );
     1102                bp_theme_compat_reset_post( array(
     1103                        'ID'             => 0,
     1104                        'post_title'     => bp_get_directory_title( 'groups' ),
     1105                        'post_author'    => 0,
     1106                        'post_date'      => 0,
     1107                        'post_content'   => '',
     1108                        'post_type'      => 'page',
     1109                        'post_status'    => 'publish',
     1110                        'is_page'        => true,
     1111                        'comment_status' => 'closed'
     1112                ) );
     1113        }
     1114
     1115        /**
     1116         * Filter the_content with the groups index template part.
     1117         *
     1118         * @since BuddyPress (1.7.0)
     1119         */
     1120        public function directory_content() {
     1121                return bp_buffer_template_part( 'groups/index', null, false );
     1122        }
     1123
     1124        /** Create ************************************************************/
     1125
     1126        /**
     1127         * Add custom template hierarchy to theme compat for the group create page.
     1128         *
     1129         * This is to mirror how WordPress has
     1130         * {@link https://codex.wordpress.org/Template_Hierarchy template hierarchy}.
     1131         *
     1132         * @since BuddyPress (1.8.0)
     1133         *
     1134         * @param string $templates The templates from bp_get_theme_compat_templates().
     1135         * @return array $templates Array of custom templates to look for.
     1136         */
     1137        public function create_template_hierarchy( $templates ) {
     1138                // Setup our templates based on priority
     1139                $new_templates = apply_filters( 'bp_template_hierarchy_groups_create', array(
     1140                        'groups/index-create.php'
     1141                ) );
     1142
     1143                // Merge new templates with existing stack
     1144                // @see bp_get_theme_compat_templates()
     1145                $templates = array_merge( $new_templates, $templates );
     1146
     1147                return $templates;
     1148        }
     1149
     1150        /**
     1151         * Update the global $post with create screen data.
     1152         *
     1153         * @since BuddyPress (1.7.0)
     1154         */
     1155        public function create_dummy_post() {
     1156
     1157                $title = _x( 'Groups', 'Group creation page', 'buddypress' );
    11041158
    11051159                bp_theme_compat_reset_post( array(
     
    11171171
    11181172        /**
    1119          * Filter the_content with the groups index template part.
     1173         * Filter the_content with the create screen template part.
    11201174         *
    11211175         * @since BuddyPress (1.7.0)
    11221176         */
    1123         public function directory_content() {
    1124                 return bp_buffer_template_part( 'groups/index', null, false );
    1125         }
    1126 
    1127         /** Create ************************************************************/
     1177        public function create_content() {
     1178                return bp_buffer_template_part( 'groups/create', null, false );
     1179        }
     1180
     1181        /** Single ************************************************************/
    11281182
    11291183        /**
    1130          * Add custom template hierarchy to theme compat for the group create page.
     1184         * Add custom template hierarchy to theme compat for group pages.
    11311185         *
    11321186         * This is to mirror how WordPress has
     
    11381192         * @return array $templates Array of custom templates to look for.
    11391193         */
    1140         public function create_template_hierarchy( $templates ) {
     1194        public function single_template_hierarchy( $templates ) {
     1195                // Setup some variables we're going to reference in our custom templates
     1196                $group = groups_get_current_group();
     1197
    11411198                // Setup our templates based on priority
    1142                 $new_templates = apply_filters( 'bp_template_hierarchy_groups_create', array(
    1143                         'groups/index-create.php'
     1199                $new_templates = apply_filters( 'bp_template_hierarchy_groups_single_item', array(
     1200                        'groups/single/index-id-'     . sanitize_file_name( bp_get_current_group_id() )   . '.php',
     1201                        'groups/single/index-slug-'   . sanitize_file_name( bp_get_current_group_slug() ) . '.php',
     1202                        'groups/single/index-action-' . sanitize_file_name( bp_current_action() )         . '.php',
     1203                        'groups/single/index-status-' . sanitize_file_name( $group->status )              . '.php',
     1204                        'groups/single/index.php'
    11441205                ) );
    11451206
    11461207                // Merge new templates with existing stack
    11471208                // @see bp_get_theme_compat_templates()
    1148                 $templates = array_merge( $new_templates, $templates );
     1209                $templates = array_merge( (array) $new_templates, $templates );
    11491210
    11501211                return $templates;
     
    11521213
    11531214        /**
    1154          * Update the global $post with create screen data.
     1215         * Update the global $post with single group data.
    11551216         *
    11561217         * @since BuddyPress (1.7.0)
    11571218         */
    1158         public function create_dummy_post() {
    1159 
    1160                 $title = _x( 'Groups', 'Group creation page', 'buddypress' );
    1161 
     1219        public function single_dummy_post() {
    11621220                bp_theme_compat_reset_post( array(
    11631221                        'ID'             => 0,
    1164                         'post_title'     => $title,
     1222                        'post_title'     => bp_get_current_group_name(),
    11651223                        'post_author'    => 0,
    11661224                        'post_date'      => 0,
     
    11741232
    11751233        /**
    1176          * Filter the_content with the create screen template part.
    1177          *
    1178          * @since BuddyPress (1.7.0)
    1179          */
    1180         public function create_content() {
    1181                 return bp_buffer_template_part( 'groups/create', null, false );
    1182         }
    1183 
    1184         /** Single ************************************************************/
    1185 
    1186         /**
    1187          * Add custom template hierarchy to theme compat for group pages.
    1188          *
    1189          * This is to mirror how WordPress has
    1190          * {@link https://codex.wordpress.org/Template_Hierarchy template hierarchy}.
    1191          *
    1192          * @since BuddyPress (1.8.0)
    1193          *
    1194          * @param string $templates The templates from bp_get_theme_compat_templates().
    1195          * @return array $templates Array of custom templates to look for.
    1196          */
    1197         public function single_template_hierarchy( $templates ) {
    1198                 // Setup some variables we're going to reference in our custom templates
    1199                 $group = groups_get_current_group();
    1200 
    1201                 // Setup our templates based on priority
    1202                 $new_templates = apply_filters( 'bp_template_hierarchy_groups_single_item', array(
    1203                         'groups/single/index-id-'     . sanitize_file_name( bp_get_current_group_id() )   . '.php',
    1204                         'groups/single/index-slug-'   . sanitize_file_name( bp_get_current_group_slug() ) . '.php',
    1205                         'groups/single/index-action-' . sanitize_file_name( bp_current_action() )         . '.php',
    1206                         'groups/single/index-status-' . sanitize_file_name( $group->status )              . '.php',
    1207                         'groups/single/index.php'
    1208                 ) );
    1209 
    1210                 // Merge new templates with existing stack
    1211                 // @see bp_get_theme_compat_templates()
    1212                 $templates = array_merge( (array) $new_templates, $templates );
    1213 
    1214                 return $templates;
    1215         }
    1216 
    1217         /**
    1218          * Update the global $post with single group data.
    1219          *
    1220          * @since BuddyPress (1.7.0)
    1221          */
    1222         public function single_dummy_post() {
    1223                 bp_theme_compat_reset_post( array(
    1224                         'ID'             => 0,
    1225                         'post_title'     => '<a href="' . bp_get_group_permalink( groups_get_current_group() ) . '">' . bp_get_current_group_name() . '</a>',
    1226                         'post_author'    => 0,
    1227                         'post_date'      => 0,
    1228                         'post_content'   => '',
    1229                         'post_type'      => 'page',
    1230                         'post_status'    => 'publish',
    1231                         'is_page'        => true,
    1232                         'comment_status' => 'closed'
    1233                 ) );
    1234         }
    1235 
    1236         /**
    12371234         * Filter the_content with the single group template part.
    12381235         *
Note: See TracChangeset for help on using the changeset viewer.