Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
12/08/2017 12:22:09 AM (7 years ago)
Author:
djpaul
Message:

Retire Legacy Forums.

"Legacy Forums" is what we now call the bundled version of bbPress 1 that has shipped with BuddyPress for over nine years. The Legacy Forums codebase/features are many years stagnant, and it has been almost completely hidden from the UI for the past five years.

Legacy Forums were replaced by bbPress 2, which is its own plugin, and we've been promoting its integration with BuddyPress for a long time. Most significantly, bbPress 1 only runs on WordPress versions older than 4.7, because of a BackPress conflict (which is nested inside bbPress 1) with WordPress 4.7's WP_Taxonomy class.

If your site is still using Legacy Forums, you will need to migrate to bbPress 2 to run BuddyPress 3.0. See https://bpdevel.wordpress.com/2017/12/07/legacy-forums-support-will-be/ for more information.

Fixes #5351
See #7502

File:
1 edited

Legend:

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

    r11761 r11763  
    20252025
    20262026/**
    2027  * Output the URL of the Forum page of the current group in the loop.
    2028  *
    2029  * @since 1.0.0
    2030  */
    2031 function bp_group_forum_permalink() {
    2032     echo bp_get_group_forum_permalink();
    2033 }
    2034     /**
    2035      * Generate the URL of the Forum page of a group.
    2036      *
    2037      * @since 1.0.0
    2038      *
    2039      * @param object|bool $group Optional. Group object.
    2040      *                           Default: current group in loop.
    2041      * @return string
    2042      */
    2043     function bp_get_group_forum_permalink( $group = false ) {
    2044         global $groups_template;
    2045 
    2046         if ( empty( $group ) ) {
    2047             $group =& $groups_template->group;
    2048         }
    2049 
    2050         /**
    2051          * Filters the URL of the Forum page of a group.
    2052          *
    2053          * @since 1.0.0
    2054          * @since 2.5.0 Added the `$group` parameter.
    2055          *
    2056          * @param string $value URL permalink for the Forum Page.
    2057          * @param object $group Group object.
    2058          */
    2059         return apply_filters( 'bp_get_group_forum_permalink', trailingslashit( bp_get_group_permalink( $group ) . 'forum' ), $group );
    2060     }
    2061 
    2062 /**
    2063  * Output the topic count for a group forum.
    2064  *
    2065  * @since 1.2.0
    2066  *
    2067  * @param array|string $args See {@link bp_get_group_forum_topic_count()}.
    2068  */
    2069 function bp_group_forum_topic_count( $args = '' ) {
    2070     echo bp_get_group_forum_topic_count( $args );
    2071 }
    2072     /**
    2073      * Generate the topic count string for a group forum.
    2074      *
    2075      * @since 1.2.0
    2076      *
    2077      * @param array|string $args {
    2078      *     Array of arguments.
    2079      *     @type bool $showtext Optional. If true, result will be formatted as "x topics".
    2080      *                          If false, just a number will be returned.
    2081      *                          Default: false.
    2082      * }
    2083      * @return string|int
    2084      */
    2085     function bp_get_group_forum_topic_count( $args = '' ) {
    2086         global $groups_template;
    2087 
    2088         $defaults = array(
    2089             'showtext' => false
    2090         );
    2091 
    2092         $r = wp_parse_args( $args, $defaults );
    2093         extract( $r, EXTR_SKIP );
    2094 
    2095         if ( !$forum_id = groups_get_groupmeta( $groups_template->group->id, 'forum_id' ) ) {
    2096             return false;
    2097         }
    2098 
    2099         if ( !bp_is_active( 'forums' ) ) {
    2100             return false;
    2101         }
    2102 
    2103         if ( !$groups_template->group->forum_counts ) {
    2104             $groups_template->group->forum_counts = bp_forums_get_forum_topicpost_count( (int) $forum_id );
    2105         }
    2106 
    2107         if ( (bool) $showtext ) {
    2108             if ( 1 == (int) $groups_template->group->forum_counts[0]->topics ) {
    2109                 $total_topics = sprintf( __( '%d topic', 'buddypress' ), (int) $groups_template->group->forum_counts[0]->topics );
    2110             } else {
    2111                 $total_topics = sprintf( __( '%d topics', 'buddypress' ), (int) $groups_template->group->forum_counts[0]->topics );
    2112             }
    2113         } else {
    2114             $total_topics = (int) $groups_template->group->forum_counts[0]->topics;
    2115         }
    2116 
    2117         /**
    2118          * Filters the topic count string for a group forum.
    2119          *
    2120          * @since 1.2.0
    2121          *
    2122          * @param string $total_topics Total topic count string.
    2123          * @param bool   $showtext     Whether or not to return as formatted string.
    2124          */
    2125         return apply_filters( 'bp_get_group_forum_topic_count', $total_topics, (bool)$showtext );
    2126     }
    2127 
    2128 /**
    2129  * Output the post count for a group forum.
    2130  *
    2131  * @since 1.2.0
    2132  *
    2133  * @param array|string $args See {@link bp_get_group_forum_post_count()}.
    2134  */
    2135 function bp_group_forum_post_count( $args = '' ) {
    2136     echo bp_get_group_forum_post_count( $args );
    2137 }
    2138     /**
    2139      * Generate the post count string for a group forum.
    2140      *
    2141      * @since 1.2.0
    2142      *
    2143      * @param array|string $args {
    2144      *     Array of arguments.
    2145      *     @type bool $showtext Optional. If true, result will be formatted as "x posts".
    2146      *                          If false, just a number will be returned.
    2147      *                          Default: false.
    2148      * }
    2149      * @return string|int
    2150      */
    2151     function bp_get_group_forum_post_count( $args = '' ) {
    2152         global $groups_template;
    2153 
    2154         $defaults = array(
    2155             'showtext' => false
    2156         );
    2157 
    2158         $r = wp_parse_args( $args, $defaults );
    2159         extract( $r, EXTR_SKIP );
    2160 
    2161         if ( !$forum_id = groups_get_groupmeta( $groups_template->group->id, 'forum_id' ) ) {
    2162             return false;
    2163         }
    2164 
    2165         if ( !bp_is_active( 'forums' ) ) {
    2166             return false;
    2167         }
    2168 
    2169         if ( !$groups_template->group->forum_counts ) {
    2170             $groups_template->group->forum_counts = bp_forums_get_forum_topicpost_count( (int) $forum_id );
    2171         }
    2172 
    2173         if ( (bool) $showtext ) {
    2174             if ( 1 == (int) $groups_template->group->forum_counts[0]->posts ) {
    2175                 $total_posts = sprintf( __( '%d post', 'buddypress' ), (int) $groups_template->group->forum_counts[0]->posts );
    2176             } else {
    2177                 $total_posts = sprintf( __( '%d posts', 'buddypress' ), (int) $groups_template->group->forum_counts[0]->posts );
    2178             }
    2179         } else {
    2180             $total_posts = (int) $groups_template->group->forum_counts[0]->posts;
    2181         }
    2182 
    2183         /**
    2184          * Filters the post count string for a group forum.
    2185          *
    2186          * @since 1.2.0
    2187          *
    2188          * @param string $total_posts Total post count string.
    2189          * @param bool   $showtext    Whether or not to return as formatted string.
    2190          */
    2191         return apply_filters( 'bp_get_group_forum_post_count', $total_posts, (bool)$showtext );
    2192     }
    2193 
    2194 /**
    21952027 * Determine whether forums are enabled for a group.
    21962028 *
     
    33813213    return true;
    33823214}
    3383 
    3384 /**
    3385  * Output a 'New Topic' button for a group.
    3386  *
    3387  * @since 1.2.7
    3388  *
    3389  * @param BP_Groups_Group|bool $group The BP Groups_Group object if passed,
    3390  *                                    boolean false if not passed.
    3391  */
    3392 function bp_group_new_topic_button( $group = false ) {
    3393     echo bp_get_group_new_topic_button( $group );
    3394 }
    3395 
    3396     /**
    3397      * Returns a 'New Topic' button for a group.
    3398      *
    3399      * @since 1.2.7
    3400      *
    3401      * @param BP_Groups_Group|bool $group The BP Groups_Group object if
    3402      *                                    passed, boolean false if not passed.
    3403      * @return false|string HTML code for the button.
    3404      */
    3405     function bp_get_group_new_topic_button( $group = false ) {
    3406         global $groups_template;
    3407 
    3408         if ( empty( $group ) ) {
    3409             $group =& $groups_template->group;
    3410         }
    3411 
    3412         if ( !is_user_logged_in() || bp_group_is_user_banned() || !bp_is_group_forum() || bp_is_group_forum_topic() ) {
    3413             return false;
    3414         }
    3415 
    3416         $button = array(
    3417             'id'                => 'new_topic',
    3418             'component'         => 'groups',
    3419             'must_be_logged_in' => true,
    3420             'block_self'        => true,
    3421             'wrapper_class'     => 'group-button',
    3422             'link_href'         => '#post-new',
    3423             'link_class'        => 'group-button show-hide-new',
    3424             'link_id'           => 'new-topic-button',
    3425             'link_text'         => __( 'New Topic', 'buddypress' ),
    3426         );
    3427 
    3428         /**
    3429          * Filters the HTML button for creating a new topic in a group.
    3430          *
    3431          * @since 1.5.0
    3432          * @since 2.5.0 Added the `$group` parameter.
    3433          *
    3434          * @param string $button HTML button for a new topic.
    3435          * @param object $group  Group object.
    3436          */
    3437         return bp_get_button( apply_filters( 'bp_get_group_new_topic_button', $button, $group ) );
    3438     }
    34393215
    34403216/**
Note: See TracChangeset for help on using the changeset viewer.