Changeset 3516 for branches/plugin/bbp-includes/bbp-core-compatibility.php
- Timestamp:
- 09/16/2011 11:41:13 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-includes/bbp-core-compatibility.php
r3507 r3516 1521 1521 // Bail if $posts_query is not the main loop 1522 1522 if ( $posts_query != $wp_the_query ) 1523 return $posts_query;1524 1525 // Bail if filters are suppressed on this query , or in admin1523 return; 1524 1525 // Bail if filters are suppressed on this query 1526 1526 if ( true == $posts_query->get( 'suppress_filters' ) ) 1527 return $posts_query;1527 return; 1528 1528 1529 1529 // Bail if in admin 1530 1530 if ( is_admin() ) 1531 return $posts_query;1531 return; 1532 1532 1533 1533 // Get query variables … … 1543 1543 1544 1544 // Email was passed 1545 if ( is_email( $bbp_user ) ) 1545 if ( is_email( $bbp_user ) ) { 1546 1546 $bbp_user = get_user_by( 'email', $bbp_user ); 1547 1547 1548 // Try nicename 1548 else1549 } else { 1549 1550 $bbp_user = get_user_by( 'slug', $bbp_user ); 1551 } 1550 1552 1551 1553 // If we were successful, set to ID 1552 if ( is_object( $bbp_user ) ) 1554 if ( is_object( $bbp_user ) ) { 1553 1555 $bbp_user = $bbp_user->ID; 1556 } 1554 1557 } 1555 1558 … … 1557 1560 $user = new WP_User( $bbp_user ); 1558 1561 1559 // Stopif no user1562 // Bail if no user 1560 1563 if ( !isset( $user ) || empty( $user ) || empty( $user->ID ) ) { 1561 1564 $posts_query->set_404(); … … 1569 1572 1570 1573 // Only allow super admins on multisite to edit every user. 1571 if ( ( is_multisite() && !current_user_can( 'manage_network_users' ) && $user_id != $current_user->ID && !apply_filters( 'enable_edit_any_user_configuration', true ) ) || !current_user_can( 'edit_user', $user->ID ) ) 1574 if ( ( is_multisite() && !current_user_can( 'manage_network_users' ) && $user_id != $current_user->ID && !apply_filters( 'enable_edit_any_user_configuration', true ) ) || !current_user_can( 'edit_user', $user->ID ) ) { 1572 1575 wp_die( __( 'You do not have the permission to edit this user.', 'bbpress' ) ); 1576 } 1573 1577 1574 1578 // We are editing a profile … … 1576 1580 1577 1581 // Load the core WordPress contact methods 1578 if ( !function_exists( '_wp_get_user_contactmethods' ) ) 1582 if ( !function_exists( '_wp_get_user_contactmethods' ) ) { 1579 1583 include_once( ABSPATH . 'wp-includes/registration.php' ); 1584 } 1580 1585 1581 1586 // Load the edit_user functions 1582 if ( !function_exists( 'edit_user' ) ) 1587 if ( !function_exists( 'edit_user' ) ) { 1583 1588 require_once( ABSPATH . 'wp-admin/includes/user.php' ); 1589 } 1584 1590 1585 1591 // We are viewing a profile … … 1598 1604 1599 1605 // Set author_name as current user's nicename to get correct posts 1600 if ( !bbp_is_query_name( 'bbp_widget' ) ) 1606 if ( !bbp_is_query_name( 'bbp_widget' ) ) { 1601 1607 $posts_query->set( 'author_name', $user->user_nicename ); 1608 } 1602 1609 1603 1610 // Set the displayed user global to this user … … 1610 1617 $view_args = bbp_get_view_query_args( $bbp_view ); 1611 1618 1612 // Stop if view args is false - means the view isn't registered1619 // Bail if view args is false (view isn't registered) 1613 1620 if ( false === $view_args ) { 1614 1621 $posts_query->set_404(); … … 1626 1633 1627 1634 // We are editing a topic 1628 if ( $posts_query->get( 'post_type' ) == bbp_get_topic_post_type() ) 1635 if ( $posts_query->get( 'post_type' ) == bbp_get_topic_post_type() ) { 1629 1636 $posts_query->bbp_is_topic_edit = true; 1630 1637 1631 1638 // We are editing a reply 1632 elseif ( $posts_query->get( 'post_type' ) == bbp_get_reply_post_type() )1639 } elseif ( $posts_query->get( 'post_type' ) == bbp_get_reply_post_type() ) { 1633 1640 $posts_query->bbp_is_reply_edit = true; 1634 1641 1635 1642 // We are editing a topic tag 1636 elseif ( bbp_is_topic_tag() )1643 } elseif ( bbp_is_topic_tag() ) { 1637 1644 $posts_query->bbp_is_topic_tag_edit = true; 1645 } 1638 1646 1639 1647 // We save post revisions on our own … … 1650 1658 1651 1659 // Add bbp_get_private_status_id() if user is capable 1652 if ( current_user_can( 'read_private_forums' ) ) 1660 if ( current_user_can( 'read_private_forums' ) ) { 1653 1661 $status[] = bbp_get_private_status_id(); 1662 } 1654 1663 1655 1664 // Add bbp_get_hidden_status_id() if user is capable 1656 if ( current_user_can( 'read_hidden_forums' ) ) 1665 if ( current_user_can( 'read_hidden_forums' ) ) { 1657 1666 $status[] = bbp_get_hidden_status_id(); 1667 } 1658 1668 1659 1669 // Implode and add the statuses … … 1666 1676 $posts_query->set( 'posts_per_page', get_option( '_bbp_topics_per_page', 15 ) ); 1667 1677 } 1668 1669 return $posts_query;1670 1678 } 1671 1679
Note: See TracChangeset
for help on using the changeset viewer.