Changeset 6401
- Timestamp:
- 04/20/2017 04:36:57 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/topics/functions.php
r6400 r6401 811 811 } 812 812 813 // Check forum_id 814 if ( empty( $forum_id ) ) { 815 $forum_id = bbp_get_topic_forum_id( $topic_id ); 816 } 813 // Forum/Topic meta (early, for use in downstream functions) 814 bbp_update_topic_forum_id( $topic_id, $forum_id ); 815 bbp_update_topic_topic_id( $topic_id, $topic_id ); 817 816 818 817 // Get the topic types … … 820 819 821 820 // Sticky check after 'bbp_new_topic' action so forum ID meta is set 822 if ( ! empty( $_POST['bbp_stick_topic'] ) && in_array( $_POST['bbp_stick_topic'], array_keys( $topic_types ) ) ) {821 if ( ! empty( $_POST['bbp_stick_topic'] ) && in_array( $_POST['bbp_stick_topic'], array_keys( $topic_types ), true ) ) { 823 822 824 823 // What's the caps? … … 866 865 if ( bbp_is_subscriptions_active() && ! empty( $author_id ) ) { 867 866 $subscribed = bbp_is_user_subscribed( $author_id, $topic_id ); 868 $subscheck = ( ! empty( $_POST['bbp_topic_subscription'] ) && ( 'bbp_subscribe' === $_POST['bbp_topic_subscription'] ) ) ? true : false; 867 $subscheck = ( ! empty( $_POST['bbp_topic_subscription'] ) && ( 'bbp_subscribe' === $_POST['bbp_topic_subscription'] ) ) 868 ? true 869 : false; 869 870 870 871 // Subscribed and unsubscribing … … 877 878 } 878 879 } 879 880 // Forum topic meta881 bbp_update_topic_forum_id( $topic_id, $forum_id );882 bbp_update_topic_topic_id( $topic_id, $topic_id );883 880 884 881 // Update associated topic values if this is a new topic … … 2081 2078 */ 2082 2079 function bbp_get_stickies( $forum_id = 0 ) { 2083 $stickies = empty( $forum_id ) ? bbp_get_super_stickies() : get_post_meta( $forum_id, '_bbp_sticky_topics', true ); 2084 $stickies = ( empty( $stickies ) || ! is_array( $stickies ) ) ? array() : $stickies; 2085 2086 return apply_filters( 'bbp_get_stickies', $stickies, $forum_id ); 2080 2081 // Get stickies (maybe super if empty) 2082 $stickies = empty( $forum_id ) 2083 ? bbp_get_super_stickies() 2084 : get_post_meta( $forum_id, '_bbp_sticky_topics', true ); 2085 2086 // Cast as array 2087 $stickies = ( empty( $stickies ) || ! is_array( $stickies ) ) 2088 ? array() 2089 : $stickies; 2090 2091 // Filter and return 2092 return (array) apply_filters( 'bbp_get_stickies', $stickies, $forum_id ); 2087 2093 } 2088 2094 … … 2097 2103 */ 2098 2104 function bbp_get_super_stickies() { 2105 2106 // Get super stickies 2099 2107 $stickies = get_option( '_bbp_super_sticky_topics', array() ); 2100 $stickies = ( empty( $stickies ) || ! is_array( $stickies ) ) ? array() : $stickies; 2101 2102 return apply_filters( 'bbp_get_super_stickies', $stickies ); 2108 2109 // Cast as array 2110 $stickies = ( empty( $stickies ) || ! is_array( $stickies ) ) 2111 ? array() 2112 : $stickies; 2113 2114 // Filter and return 2115 return (array) apply_filters( 'bbp_get_super_stickies', $stickies ); 2103 2116 } 2104 2117
Note: See TracChangeset
for help on using the changeset viewer.