Changeset 1921 for trunk/bp-groups/bp-groups-templatetags.php
- Timestamp:
- 09/22/2009 08:45:43 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/bp-groups/bp-groups-templatetags.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-groups/bp-groups-templatetags.php
r1920 r1921 1833 1833 break; 1834 1834 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; 1838 1838 } 1839 1839 } … … 2033 2033 return apply_filters( 'bp_get_the_site_group_name', bp_get_group_name( $site_groups_template->group ) ); 2034 2034 } 2035 2035 2036 2036 2037 function bp_the_site_group_last_active() { … … 2064 2065 global $site_groups_template; 2065 2066 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 ) ); 2067 2068 } 2068 2069 … … 2095 2096 2096 2097 return apply_filters( 'bp_get_the_site_group_type', bp_get_group_type( $site_groups_template->group ) ); 2098 } 2099 2100 function 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 2134 function 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 ); 2097 2166 } 2098 2167
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)