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-reply-functions.php

    r3589 r3607  
    14591459}
    14601460
     1461/** Permissions ***************************************************************/
     1462
     1463/**
     1464 * Redirect if unathorized user is attempting to edit a reply
     1465 *
     1466 * @since bbPress (r3605)
     1467 *
     1468 * @uses bbp_is_reply_edit()
     1469 * @uses current_user_can()
     1470 * @uses bbp_get_topic_id()
     1471 * @uses wp_safe_redirect()
     1472 * @uses bbp_get_topic_permalink()
     1473 */
     1474function bbp_check_reply_edit() {
     1475
     1476    // Bail if not editing a topic
     1477    if ( !bbp_is_reply_edit() )
     1478        return;
     1479
     1480    // User cannot edit topic, so redirect back to reply
     1481    if ( !current_user_can( 'edit_reply', bbp_get_reply_id() ) ) {
     1482        wp_safe_redirect( bbp_get_reply_url() );
     1483        exit();
     1484    }
     1485}
     1486
    14611487?>
Note: See TracChangeset for help on using the changeset viewer.