Changeset 4505
- Timestamp:
- 11/24/2012 07:27:51 PM (13 years ago)
- File:
-
- 1 edited
-
trunk/includes/forums/template-tags.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/forums/template-tags.php
r4504 r4505 155 155 156 156 // Easy empty checking 157 if ( !empty( $forum_id ) && is_numeric( $forum_id ) ) 157 if ( !empty( $forum_id ) && is_numeric( $forum_id ) ) { 158 158 $bbp_forum_id = $forum_id; 159 159 160 160 // Currently inside a forum loop 161 elseif ( !empty( $bbp->forum_query->in_the_loop ) && isset( $bbp->forum_query->post->ID ) )161 } elseif ( !empty( $bbp->forum_query->in_the_loop ) && isset( $bbp->forum_query->post->ID ) ) { 162 162 $bbp_forum_id = $bbp->forum_query->post->ID; 163 163 164 164 // Currently viewing a forum 165 elseif ( bbp_is_single_forum() && !empty( $bbp->current_forum_id ) )165 } elseif ( bbp_is_single_forum() && !empty( $bbp->current_forum_id ) ) { 166 166 $bbp_forum_id = $bbp->current_forum_id; 167 167 168 168 // Currently viewing a forum 169 elseif ( bbp_is_single_forum() && isset( $wp_query->post->ID ) )169 } elseif ( bbp_is_single_forum() && isset( $wp_query->post->ID ) ) { 170 170 $bbp_forum_id = $wp_query->post->ID; 171 171 172 172 // Currently viewing a topic 173 elseif ( bbp_is_single_topic() )173 } elseif ( bbp_is_single_topic() ) { 174 174 $bbp_forum_id = bbp_get_topic_forum_id(); 175 175 176 176 // Fallback 177 else177 } else { 178 178 $bbp_forum_id = 0; 179 } 179 180 180 181 return (int) apply_filters( 'bbp_get_forum_id', (int) $bbp_forum_id, $forum_id ); … … 450 451 */ 451 452 function bbp_get_forum_last_active_time( $forum_id = 0 ) { 452 $forum_id = bbp_get_forum_id( $forum_id ); 453 453 454 // Verify forum and get last active meta 455 $forum_id = bbp_get_forum_id( $forum_id ); 454 456 $last_active = get_post_meta( $forum_id, '_bbp_last_active_time', true ); 457 455 458 if ( empty( $last_active ) ) { 456 459 $reply_id = bbp_get_forum_last_reply_id( $forum_id ); … … 465 468 } 466 469 467 $ last_active = !empty( $last_active ) ? bbp_get_time_since( bbp_convert_date( $last_active ) ) : '';468 469 return apply_filters( 'bbp_get_forum_last_active', $ last_active, $forum_id );470 $active_time = !empty( $last_active ) ? bbp_get_time_since( bbp_convert_date( $last_active ) ) : ''; 471 472 return apply_filters( 'bbp_get_forum_last_active', $active_time, $forum_id ); 470 473 } 471 474 … … 1940 1943 1941 1944 // Get _POST data 1942 if ( 'post' == strtolower( $_SERVER['REQUEST_METHOD'] ) && isset( $_POST['bbp_forum_title'] ) ) 1945 if ( 'post' == strtolower( $_SERVER['REQUEST_METHOD'] ) && isset( $_POST['bbp_forum_title'] ) ) { 1943 1946 $forum_title = $_POST['bbp_forum_title']; 1944 1947 1945 1948 // Get edit data 1946 elseif ( bbp_is_forum_edit() )1949 } elseif ( bbp_is_forum_edit() ) { 1947 1950 $forum_title = bbp_get_global_post_field( 'post_title', 'raw' ); 1948 1951 1949 1952 // No data 1950 else1953 } else { 1951 1954 $forum_title = ''; 1955 } 1952 1956 1953 1957 return apply_filters( 'bbp_get_form_forum_title', esc_attr( $forum_title ) ); … … 1976 1980 1977 1981 // Get _POST data 1978 if ( 'post' == strtolower( $_SERVER['REQUEST_METHOD'] ) && isset( $_POST['bbp_forum_content'] ) ) 1982 if ( 'post' == strtolower( $_SERVER['REQUEST_METHOD'] ) && isset( $_POST['bbp_forum_content'] ) ) { 1979 1983 $forum_content = $_POST['bbp_forum_content']; 1980 1984 1981 1985 // Get edit data 1982 elseif ( bbp_is_forum_edit() )1986 } elseif ( bbp_is_forum_edit() ) { 1983 1987 $forum_content = bbp_get_global_post_field( 'post_content', 'raw' ); 1984 1988 1985 1989 // No data 1986 else1990 } else { 1987 1991 $forum_content = ''; 1992 } 1988 1993 1989 1994 return apply_filters( 'bbp_get_form_forum_content', esc_textarea( $forum_content ) ); … … 2013 2018 2014 2019 // Get _POST data 2015 if ( 'post' == strtolower( $_SERVER['REQUEST_METHOD'] ) && isset( $_POST['bbp_forum_id'] ) ) 2020 if ( 'post' == strtolower( $_SERVER['REQUEST_METHOD'] ) && isset( $_POST['bbp_forum_id'] ) ) { 2016 2021 $forum_parent = $_POST['bbp_forum_id']; 2017 2022 2018 2023 // Get edit data 2019 elseif ( bbp_is_forum_edit() )2024 } elseif ( bbp_is_forum_edit() ) { 2020 2025 $forum_parent = bbp_get_forum_parent_id(); 2021 2026 2022 2027 // No data 2023 else2028 } else { 2024 2029 $forum_parent = 0; 2030 } 2025 2031 2026 2032 return apply_filters( 'bbp_get_form_forum_parent', esc_attr( $forum_parent ) ); … … 2050 2056 2051 2057 // Get _POST data 2052 if ( 'post' == strtolower( $_SERVER['REQUEST_METHOD'] ) && isset( $_POST['bbp_forum_type'] ) ) 2058 if ( 'post' == strtolower( $_SERVER['REQUEST_METHOD'] ) && isset( $_POST['bbp_forum_type'] ) ) { 2053 2059 $forum_type = $_POST['bbp_forum_type']; 2054 2060 2055 2061 // Get edit data 2056 elseif ( bbp_is_forum_edit() )2062 } elseif ( bbp_is_forum_edit() ) { 2057 2063 $forum_type = bbp_get_forum_type(); 2058 2064 2059 2065 // No data 2060 else2066 } else { 2061 2067 $forum_type = 'forum'; 2068 } 2062 2069 2063 2070 return apply_filters( 'bbp_get_form_forum_type', esc_attr( $forum_type ) ); … … 2087 2094 2088 2095 // Get _POST data 2089 if ( 'post' == strtolower( $_SERVER['REQUEST_METHOD'] ) && isset( $_POST['bbp_forum_visibility'] ) ) 2096 if ( 'post' == strtolower( $_SERVER['REQUEST_METHOD'] ) && isset( $_POST['bbp_forum_visibility'] ) ) { 2090 2097 $forum_visibility = $_POST['bbp_forum_visibility']; 2091 2098 2092 2099 // Get edit data 2093 elseif ( bbp_is_forum_edit() )2100 } elseif ( bbp_is_forum_edit() ) { 2094 2101 $forum_visibility = bbp_get_forum_visibility(); 2095 2102 2096 2103 // No data 2097 else2104 } else { 2098 2105 $forum_visibility = bbpress()->public_status_id; 2106 } 2099 2107 2100 2108 return apply_filters( 'bbp_get_form_forum_visibility', esc_attr( $forum_visibility ) );
Note: See TracChangeset
for help on using the changeset viewer.