Changeset 3646
- Timestamp:
- 12/08/2011 05:52:18 PM (14 years ago)
- Location:
- branches/plugin/bbp-includes
- Files:
-
- 3 edited
-
bbp-core-compatibility.php (modified) (5 diffs)
-
bbp-core-hooks.php (modified) (1 diff)
-
bbp-forum-functions.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-includes/bbp-core-compatibility.php
r3645 r3646 1565 1565 1566 1566 /** 1567 * Add checks for view page, user page, user edit, topic edit and reply edit 1568 * pages. 1567 * Add checks for bbPress conditions to parse_query action 1569 1568 * 1570 1569 * If it's a user page, WP_Query::bbp_is_single_user is set to true. … … 1575 1574 * displayed user's nicename are added. 1576 1575 * 1577 * If it's a topic edit, WP_Query::bbp_is_topic_edit is set to true and 1578 * similarly, if it's a reply edit, WP_Query::bbp_is_reply_edit is set to true. 1576 * If it's a forum edit, WP_Query::bbp_is_forum_edit is set to true 1577 * If it's a topic edit, WP_Query::bbp_is_topic_edit is set to true 1578 * If it's a reply edit, WP_Query::bbp_is_reply_edit is set to true. 1579 1579 * 1580 1580 * If it's a view page, WP_Query::bbp_is_view is set to true … … 1592 1592 * @uses current_user_can() To check if the current user can edit the user 1593 1593 * @uses apply_filters() Calls 'enable_edit_any_user_configuration' with true 1594 * @uses wp_die() To die1595 1594 * @uses bbp_is_query_name() Check if query name is 'bbp_widget' 1596 1595 * @uses bbp_get_view_query_args() To get the view query args … … 1598 1597 * @uses bbp_get_topic_post_type() To get the topic post type 1599 1598 * @uses bbp_get_reply_post_type() To get the reply post type 1600 * @uses is_multisite() To check if it's a multisite1601 1599 * @uses remove_action() To remove the auto save post revision action 1602 1600 */ 1603 function bbp_p re_get_posts( $posts_query ) {1601 function bbp_parse_query( $posts_query ) { 1604 1602 global $bbp; 1605 1603 1606 1604 // Bail if $posts_query is not the main loop 1607 1605 if ( ! $posts_query->is_main_query() ) 1606 return; 1607 1608 // Bail if filters are suppressed on this query 1609 if ( true == $posts_query->get( 'suppress_filters' ) ) 1608 1610 return; 1609 1611 … … 1746 1748 remove_action( 'pre_post_update', 'wp_save_post_revision' ); 1747 1749 1748 // Check forum status and exclude single forums the user cannot see1749 } elseif ( bbp_get_forum_post_type() == $posts_query->get( 'post_type' ) ) {1750 1751 // Define local variable1752 $status = array();1753 1754 // All users can see published forums1755 $status[] = bbp_get_public_status_id();1756 1757 // Add bbp_get_private_status_id() if user is capable1758 if ( current_user_can( 'read_private_forums' ) ) {1759 $status[] = bbp_get_private_status_id();1760 }1761 1762 // Add bbp_get_hidden_status_id() if user is capable1763 if ( current_user_can( 'read_hidden_forums' ) ) {1764 $status[] = bbp_get_hidden_status_id();1765 }1766 1767 // Implode and add the statuses1768 $posts_query->set( 'post_status', implode( ',', $status ) );1769 1770 1750 // Topic tag page 1771 1751 } elseif ( bbp_is_topic_tag() ) { -
branches/plugin/bbp-includes/bbp-core-hooks.php
r3627 r3646 125 125 add_action( 'template_redirect', 'bbp_manage_topic_tag_handler', 1 ); 126 126 127 // Before and After the Query 128 add_action( 'pre_get_posts', 'bbp_pre_get_posts', 2 ); 129 add_action( 'pre_get_posts', 'bbp_pre_get_posts_exclude_forums', 4 ); 127 // Parse the main query 128 add_action( 'parse_query', 'bbp_parse_query', 2 ); 129 130 // Always exclude private/hidden forums if needed 131 add_action( 'pre_get_posts', 'bbp_pre_get_posts_exclude_forums', 4 ); 130 132 131 133 // Restrict forum access -
branches/plugin/bbp-includes/bbp-forum-functions.php
r3627 r3646 939 939 switch ( $posts_query->get( 'post_type' ) ) { 940 940 941 // Forums 942 case bbp_get_forum_post_type() : 943 944 // Define local variable 945 $status = array(); 946 947 // All users can see published forums 948 $status[] = bbp_get_public_status_id(); 949 950 // Add bbp_get_private_status_id() if user is capable 951 if ( current_user_can( 'read_private_forums' ) ) { 952 $status[] = bbp_get_private_status_id(); 953 } 954 955 // Add bbp_get_hidden_status_id() if user is capable 956 if ( current_user_can( 'read_hidden_forums' ) ) { 957 $status[] = bbp_get_hidden_status_id(); 958 } 959 960 // Implode and add the statuses 961 $posts_query->set( 'post_status', implode( ',', $status ) ); 962 963 break; 964 941 965 // Topics 942 966 case bbp_get_topic_post_type() :
Note: See TracChangeset
for help on using the changeset viewer.