Skip to:
Content

bbPress.org

Changeset 5019


Ignore:
Timestamp:
07/10/2013 03:01:09 PM (13 years ago)
Author:
johnjamesjacoby
Message:

In bbp_new_topic_handler() and bbp_edit_topic_handler(), restrict sticky topic actions to users with 'moderate' capability. Fixes #2366.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/topics/functions.php

    r5009 r5019  
    359359                if ( !empty( $_POST['bbp_stick_topic'] ) && in_array( $_POST['bbp_stick_topic'], array( 'stick', 'super', 'unstick' ) ) ) {
    360360
    361                         // What's the haps?
    362                         switch ( $_POST['bbp_stick_topic'] ) {
    363 
    364                                 // Sticky in this forum
    365                                 case 'stick'   :
    366                                         bbp_stick_topic( $topic_id );
    367                                         break;
    368 
    369                                 // Super sticky in all forums
    370                                 case 'super'   :
    371                                         bbp_stick_topic( $topic_id, true );
    372                                         break;
    373 
    374                                 // We can avoid this as it is a new topic
    375                                 case 'unstick' :
    376                                 default        :
    377                                         break;
     361                        // What's the caps?
     362                        if ( current_user_can( 'moderate' ) ) {
     363
     364                                // What's the haps?
     365                                switch ( $_POST['bbp_stick_topic'] ) {
     366
     367                                        // Sticky in this forum
     368                                        case 'stick'   :
     369                                                bbp_stick_topic( $topic_id );
     370                                                break;
     371
     372                                        // Super sticky in all forums
     373                                        case 'super'   :
     374                                                bbp_stick_topic( $topic_id, true );
     375                                                break;
     376
     377                                        // We can avoid this as it is a new topic
     378                                        case 'unstick' :
     379                                        default        :
     380                                                break;
     381                                }
    378382                        }
    379383                }
    … …  
    711715                if ( !empty( $_POST['bbp_stick_topic'] ) && in_array( $_POST['bbp_stick_topic'], array( 'stick', 'super', 'unstick' ) ) ) {
    712716
    713                         // What's the dilly?
    714                         switch ( $_POST['bbp_stick_topic'] ) {
    715 
    716                                 // Sticky in forum
    717                                 case 'stick'   :
    718                                         bbp_stick_topic( $topic_id );
    719                                         break;
    720 
    721                                 // Sticky in all forums
    722                                 case 'super'   :
    723                                         bbp_stick_topic( $topic_id, true );
    724                                         break;
    725 
    726                                 // Normal
    727                                 case 'unstick' :
    728                                 default        :
    729                                         bbp_unstick_topic( $topic_id );
    730                                         break;
     717                        // What's the caps?
     718                        if ( current_user_can( 'moderate' ) ) {
     719
     720                                // What's the haps?
     721                                switch ( $_POST['bbp_stick_topic'] ) {
     722
     723                                        // Sticky in forum
     724                                        case 'stick'   :
     725                                                bbp_stick_topic( $topic_id );
     726                                                break;
     727
     728                                        // Sticky in all forums
     729                                        case 'super'   :
     730                                                bbp_stick_topic( $topic_id, true );
     731                                                break;
     732
     733                                        // Normal
     734                                        case 'unstick' :
     735                                        default        :
     736                                                bbp_unstick_topic( $topic_id );
     737                                                break;
     738                                }
    731739                        }
    732740                }
Note: See TracChangeset for help on using the changeset viewer.