Skip to:
Content

bbPress.org


Ignore:
Timestamp:
11/14/2011 03:50:25 AM (13 years ago)
Author:
johnjamesjacoby
Message:

Introduce bbp_template_redirect() and use for checking various edit screens:

  • Introduce bbp_check_forum_edit() to check for forum edit
  • Introduce bbp_check_topic_edit() to check for topic edit
  • Introduce bbp_check_reply_edit() to check for reply edit
  • Introduce bbp_check_topic_tag_edit() to check for topic tag edit
  • Introduce bbp_check_user_edit() to check for user edit
  • Remove these checks from bbp_pre_get_posts() and only use it to setup query vars
  • Fixes #1684, r3605
  • For 2.1 (plugin) branch
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/plugin/bbp-includes/bbp-user-functions.php

    r3505 r3607  
    12491249}
    12501250
     1251/** Premissions ***************************************************************/
     1252
     1253/**
     1254 * Redirect if unathorized user is attempting to edit a topic
     1255 *
     1256 * @since bbPress (r3605)
     1257 *
     1258 * @uses bbp_is_topic_edit()
     1259 * @uses current_user_can()
     1260 * @uses bbp_get_topic_id()
     1261 * @uses wp_safe_redirect()
     1262 * @uses bbp_get_topic_permalink()
     1263 */
     1264function bbp_check_user_edit() {
     1265
     1266    // Bail if not editing a topic
     1267    if ( !bbp_is_single_user_edit() )
     1268        return;
     1269
     1270    // Only allow super admins on multisite to edit every user.
     1271    if ( !is_user_logged_in() || ( is_multisite() && !current_user_can( 'manage_network_users' ) && bbp_is_user_home() && !apply_filters( 'enable_edit_any_user_configuration', true ) ) || !current_user_can( 'edit_user', bbp_get_displayed_user_id() ) ) {
     1272        wp_safe_redirect( bbp_get_user_profile_url( bbp_get_displayed_user_id() ) );
     1273        exit();
     1274    }
     1275}
     1276
    12511277?>
Note: See TracChangeset for help on using the changeset viewer.