Changeset 5156 for trunk/includes/forums/template.php
- Timestamp:
- 11/20/2013 07:50:55 PM (12 years ago)
- File:
-
- 1 edited
-
trunk/includes/forums/template.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/forums/template.php
r5130 r5156 790 790 } 791 791 792 /** Forum Subscriptions *******************************************************/ 793 794 /** 795 * Output the forum subscription link 796 * 797 * @since bbPress (rxxxx) 798 * 799 * @uses bbp_get_forum_subscription_link() 800 */ 801 function bbp_forum_subscription_link( $args = array() ) { 802 echo bbp_get_forum_subscription_link( $args ); 803 } 804 805 /** 806 * Get the forum subscription link 807 * 808 * A custom wrapper for bbp_get_user_subscribe_link() 809 * 810 * @since bbPress (rxxxx) 811 * 812 * @uses bbp_parse_args() 813 * @uses bbp_get_user_subscribe_link() 814 * @uses apply_filters() Calls 'bbp_get_forum_subscribe_link' 815 */ 816 function bbp_get_forum_subscription_link( $args = array() ) { 817 818 // No link 819 $retval = false; 820 821 // Parse the arguments 822 $r = bbp_parse_args( $args, array( 823 'forum_id' => 0, 824 'user_id' => 0, 825 'before' => '', 826 'after' => '', 827 'subscribe' => __( 'Subscribe', 'bbpress' ), 828 'unsubscribe' => __( 'Unsubscribe', 'bbpress' ) 829 ), 'get_forum_subscribe_link' ); 830 831 // Get the link 832 $retval = bbp_get_user_subscribe_link( $r ); 833 834 return apply_filters( 'bbp_get_forum_subscribe_link', $retval, $r ); 835 } 836 792 837 /** Forum Last Topic **********************************************************/ 793 838 … … 2166 2211 return apply_filters( 'bbp_get_form_forum_visibility', esc_attr( $forum_visibility ) ); 2167 2212 } 2213 2214 /** 2215 * Output checked value of forum subscription 2216 * 2217 * @since bbPress (rxxxx) 2218 * 2219 * @uses bbp_get_form_forum_subscribed() To get the subscribed checkbox value 2220 */ 2221 function bbp_form_forum_subscribed() { 2222 echo bbp_get_form_forum_subscribed(); 2223 } 2224 /** 2225 * Return checked value of forum subscription 2226 * 2227 * @since bbPress (rxxxx) 2228 * 2229 * @uses bbp_is_forum_edit() To check if it's the forum edit page 2230 * @uses bbp_get_global_post_field() To get current post author 2231 * @uses bbp_get_current_user_id() To get the current user id 2232 * @uses bbp_is_user_subscribed() To check if the user is subscribed to 2233 * the forum 2234 * @uses apply_filters() Calls 'bbp_get_form_forum_subscribed' with the 2235 * option 2236 * @return string Checked value of forum subscription 2237 */ 2238 function bbp_get_form_forum_subscribed() { 2239 2240 // Get _POST data 2241 if ( bbp_is_post_request() && isset( $_POST['bbp_forum_subscription'] ) ) { 2242 $forum_subscribed = (bool) $_POST['bbp_forum_subscription']; 2243 2244 // Get edit data 2245 } elseif ( bbp_is_forum_edit() || bbp_is_reply_edit() ) { 2246 2247 // Get current posts author 2248 $post_author = bbp_get_global_post_field( 'post_author', 'raw' ); 2249 2250 // Post author is not the current user 2251 if ( bbp_get_current_user_id() !== $post_author ) { 2252 $forum_subscribed = bbp_is_user_subscribed( $post_author ); 2253 2254 // Post author is the current user 2255 } else { 2256 $forum_subscribed = bbp_is_user_subscribed( bbp_get_current_user_id() ); 2257 } 2258 2259 // Get current status 2260 } elseif ( bbp_is_single_forum() ) { 2261 $forum_subscribed = bbp_is_user_subscribed( bbp_get_current_user_id() ); 2262 2263 // No data 2264 } else { 2265 $forum_subscribed = false; 2266 } 2267 2268 // Get checked output 2269 $checked = checked( $forum_subscribed, true, false ); 2270 2271 return apply_filters( 'bbp_get_form_forum_subscribed', $checked, $forum_subscribed ); 2272 } 2168 2273 2169 2274 /** Form Dropdowns ************************************************************/
Note: See TracChangeset
for help on using the changeset viewer.