Skip to:
Content

bbPress.org


Ignore:
Timestamp:
11/14/2011 03:50:25 AM (12 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-core-hooks.php

    r3589 r3607  
    3737add_action( 'generate_rewrite_rules', 'bbp_generate_rewrite_rules', 10 );
    3838add_action( 'wp_enqueue_scripts',     'bbp_enqueue_scripts',        10 );
     39add_action( 'template_redirect',      'bbp_template_redirect',      10 );
    3940add_filter( 'template_include',       'bbp_template_include',       10 );
    4041
     
    228229add_action( 'bbp_activation',   'flush_rewrite_rules' );
    229230add_action( 'bbp_deactivation', 'flush_rewrite_rules' );
     231
     232// Redirect user if needed
     233add_action( 'bbp_template_redirect', 'bbp_check_user_edit',      10 );
     234add_action( 'bbp_template_redirect', 'bbp_check_forum_edit',     10 );
     235add_action( 'bbp_template_redirect', 'bbp_check_topic_edit',     10 );
     236add_action( 'bbp_template_redirect', 'bbp_check_reply_edit',     10 );
     237add_action( 'bbp_template_redirect', 'bbp_check_topic_tag_edit', 10 );
    230238
    231239/**
     
    741749}
    742750
     751/** Theme Permissions *********************************************************/
     752
     753/**
     754 * The main action used for redirecting bbPress theme actions that are not
     755 * permitted by the current_user
     756 *
     757 * @since bbPress (r3605)
     758 *
     759 * @uses do_action()
     760 */
     761function bbp_template_redirect() {
     762    do_action( 'bbp_template_redirect' );
     763}
     764
    743765?>
Note: See TracChangeset for help on using the changeset viewer.