Skip to:
Content

bbPress.org


Ignore:
Timestamp:
11/14/2011 03:33:48 AM (12 years ago)
Author:
johnjamesjacoby
Message:

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

  • 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
  • See #1684
  • For 2.0 branch
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.0/bbp-includes/bbp-reply-functions.php

    r3544 r3605  
    14441444}
    14451445
     1446/** Permissions ***************************************************************/
     1447
     1448/**
     1449 * Redirect if unathorized user is attempting to edit a reply
     1450 *
     1451 * @since bbPress (r3605)
     1452 *
     1453 * @uses bbp_is_reply_edit()
     1454 * @uses current_user_can()
     1455 * @uses bbp_get_topic_id()
     1456 * @uses wp_safe_redirect()
     1457 * @uses bbp_get_topic_permalink()
     1458 */
     1459function bbp_check_reply_edit() {
     1460
     1461    // Bail if not editing a topic
     1462    if ( !bbp_is_reply_edit() )
     1463        return;
     1464
     1465    // User cannot edit topic, so redirect back to reply
     1466    if ( !current_user_can( 'edit_reply', bbp_get_reply_id() ) ) {
     1467        wp_safe_redirect( bbp_get_reply_url() );
     1468        exit();
     1469    }
     1470}
     1471
    14461472?>
Note: See TracChangeset for help on using the changeset viewer.