Changeset 5657
- Timestamp:
- 03/24/2015 12:47:54 PM (11 years ago)
- File:
-
- 1 edited
-
trunk/src/includes/users/functions.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/users/functions.php
r5625 r5657 1696 1696 * This is hooked to 'bbp_template_redirect' and controls the conditions under 1697 1697 * which a user can edit another user (or themselves.) If these conditions are 1698 * met . We assume a user cannot perform this task, and look for ways they can1698 * met, we assume a user cannot perform this task, and look for ways they can 1699 1699 * earn the ability to access this template. 1700 1700 * 1701 1701 * @since bbPress (r3605) 1702 1702 * 1703 * @uses bbp_is_ topic_edit()1703 * @uses bbp_is_single_user_edit() 1704 1704 * @uses current_user_can() 1705 * @uses bbp_get_ topic_id()1705 * @uses bbp_get_displayed_user_id() 1706 1706 * @uses wp_safe_redirect() 1707 * @uses bbp_get_ topic_permalink()1707 * @uses bbp_get_user_profile_url() 1708 1708 */ 1709 1709 function bbp_check_user_edit() { 1710 1710 1711 // Bail if not editing a topic1711 // Bail if not editing a user 1712 1712 if ( ! bbp_is_single_user_edit() ) { 1713 1713 return; … … 1716 1716 // Default to false 1717 1717 $redirect = true; 1718 $user_id = bbp_get_displayed_user_id(); 1718 1719 1719 1720 // Allow user to edit their own profile … … 1722 1723 1723 1724 // Allow if current user can edit the displayed user 1724 } elseif ( current_user_can( 'edit_user', bbp_get_displayed_user_id()) ) {1725 } elseif ( current_user_can( 'edit_user', $user_id ) ) { 1725 1726 $redirect = false; 1726 1727 … … 1730 1731 } 1731 1732 1732 // Maybe redirect back to profile page 1733 if ( true === $redirect ) { 1734 wp_safe_redirect( bbp_get_user_profile_url( bbp_get_displayed_user_id() ) ); 1735 exit(); 1736 } 1733 // Allow conclusion to be overridden 1734 $redirect = (bool) apply_filters( 'bbp_check_user_edit', $redirect, $user_id ); 1735 1736 // Bail if not redirecting 1737 if ( false === $redirect ) { 1738 return; 1739 } 1740 1741 // Filter redirect URL 1742 $profile_url = bbp_get_user_profile_url( $user_id ); 1743 $redirect_to = apply_filters( 'bbp_check_user_edit_redirect_to', $profile_url, $user_id ); 1744 1745 // Redirect 1746 wp_safe_redirect( $redirect_to ); 1747 exit(); 1737 1748 } 1738 1749
Note: See TracChangeset
for help on using the changeset viewer.