Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
09/22/2009 08:45:43 PM (17 years ago)
Author:
apeatling
Message:

Added "most active group forums" to forum directory.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-groups/bp-groups-templatetags.php

    r1920 r1921  
    18331833                                        break; 
    18341834
    1835                                 case 'most-forum-posts':
    1836                                         $this->groups = groups_get_by_most_forum_posts( $this->pag_num, $this->pag_page );
    1837                                         break;         
     1835                                case 'most-forum-topics':
     1836                                        $this->groups = groups_get_by_most_forum_topics( $this->pag_num, $this->pag_page );
     1837                                        break;
    18381838                        }
    18391839                }
    … …  
    20332033                return apply_filters( 'bp_get_the_site_group_name', bp_get_group_name( $site_groups_template->group ) );
    20342034        }
     2035       
    20352036
    20362037function bp_the_site_group_last_active() {
    … …  
    20642065                global $site_groups_template;
    20652066
    2066                 return apply_filters( 'bp_get_the_site_group_description_excerpt', bp_create_excerpt( bp_get_group_description( $site_groups_template->group, false ), 35 ) ); 
     2067                return apply_filters( 'bp_get_the_site_group_description_excerpt', bp_create_excerpt( bp_get_group_description( $site_groups_template->group, false ), 25 ) ); 
    20672068        }
    20682069
    … …  
    20952096
    20962097                return apply_filters( 'bp_get_the_site_group_type', bp_get_group_type( $site_groups_template->group ) );
     2098        }
     2099
     2100function bp_the_site_group_forum_topic_count( $args = '' ) {
     2101        echo bp_get_the_site_group_forum_topic_count( $args );
     2102}
     2103        function bp_get_the_site_group_forum_topic_count( $args = '' ) {
     2104                global $site_groups_template;
     2105
     2106                $defaults = array(
     2107                        'showtext' => false
     2108                );
     2109
     2110                $r = wp_parse_args( $args, $defaults );
     2111                extract( $r, EXTR_SKIP );
     2112
     2113                if ( !$forum_id = groups_get_groupmeta( $site_groups_template->group->id, 'forum_id' ) )
     2114                        return false;
     2115
     2116                if ( !function_exists( 'bp_forums_get_forum_topicpost_count' ) )
     2117                        return false;
     2118                       
     2119                if ( !$site_groups_template->group->forum_counts )
     2120                        $site_groups_template->group->forum_counts = bp_forums_get_forum_topicpost_count( (int)$forum_id );
     2121
     2122                if ( (bool) $showtext ) {
     2123                        if ( 1 == (int) $site_groups_template->group->forum_counts[0]->topics )
     2124                                $total_topics = sprintf( __( '%d topic'), (int) $site_groups_template->group->forum_counts[0]->topics );
     2125                        else
     2126                                $total_topics = sprintf( __( '%d topics'), (int) $site_groups_template->group->forum_counts[0]->topics );       
     2127                } else {
     2128                        $total_topics = (int) $site_groups_template->group->forum_counts[0]->topics;
     2129                }
     2130               
     2131                return apply_filters( 'bp_get_the_site_group_forum_topic_count', $total_topics, (bool)$showtext );
     2132        }
     2133
     2134function bp_the_site_group_forum_post_count( $args = '' ) {
     2135        echo bp_get_the_site_group_forum_post_count( $args );
     2136}
     2137        function bp_get_the_site_group_forum_post_count( $args = '' ) {
     2138                global $site_groups_template;
     2139               
     2140                $defaults = array(
     2141                        'showtext' => false
     2142                );
     2143
     2144                $r = wp_parse_args( $args, $defaults );
     2145                extract( $r, EXTR_SKIP );
     2146               
     2147                if ( !$forum_id = groups_get_groupmeta( $site_groups_template->group->id, 'forum_id' ) )
     2148                        return false;
     2149
     2150                if ( !function_exists( 'bp_forums_get_forum_topicpost_count' ) )
     2151                        return false;
     2152                       
     2153                if ( !$site_groups_template->group->forum_counts )
     2154                        $site_groups_template->group->forum_counts = bp_forums_get_forum_topicpost_count( (int)$forum_id );
     2155
     2156                if ( (bool) $showtext ) {
     2157                        if ( 1 == (int) $site_groups_template->group->forum_counts[0]->posts )
     2158                                $total_posts = sprintf( __( '%d post'), (int) $site_groups_template->group->forum_counts[0]->posts );
     2159                        else
     2160                                $total_posts = sprintf( __( '%d posts'), (int) $site_groups_template->group->forum_counts[0]->posts ); 
     2161                } else {
     2162                        $total_posts = (int) $site_groups_template->group->forum_counts[0]->posts;
     2163                }
     2164               
     2165                return apply_filters( 'bp_get_the_site_group_forum_post_count', $total_posts, (bool)$showtext );
    20972166        }
    20982167
Note: See TracChangeset for help on using the changeset viewer.