• Resolved codejp3

    (@codejp3)


    Testing out moderation tools features and ran across an issue clearing reported topics/replies:

    
    Notice: Undefined variable: post_id in /path/to/wp-content/plugins/bbp-style-pack/modtools/report.php on line 254

    Fixed it by changing:

    if ( isset( $_GET['post_id'] )) $this->clear_reports( $post_id );

    To:

    if ( isset( $_GET['post_id'] ) ) $this->clear_reports( (int) $_GET['post_id'] );
Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter codejp3

    (@codejp3)

    replying to mark as resolved…

    Plugin Author Robin W

    (@robin-w)

    thanks, that will be in the next release ??

    Thread Starter codejp3

    (@codejp3)

    One more follow moderation tools issue.

    If I select a report topic/reply reason, but change it back to the default “Report reason” before ajax gets a chance to process it, or do a page refresh with one option selected and change it back to “Report reason”, then it gets reported with the report type of “Report reason”.

    To prevent those from getting logged as reported topics/replies, I just added another condition check within the report.php file, handle_report_post() function:

    	public function handle_report_post() {
    
    		check_ajax_referer( 'report-post-nonce', 'nonce' );
    
    		$post_id = (int)$_POST['post_id'];
    		$type = sanitize_text_field( $_POST['type'] );
                    if ( $type !== 'Report reason' ) {
                            $this->report_post( $post_id, $type );
    
                            _e( 'Your report will be reviewed by our moderation team.', 'bbp-style-pack' );
                    }
    
    		die();
    
    	}
    Thread Starter codejp3

    (@codejp3)

    Two more follow-up issues. One’s an easy fix, the other may be time-consuming to resolve.

    1.) The “Report” link “a.bbp-report-link” css selector is missing the initial “display: none;” style attribute so that the select drop-down is hidden until a user clicks “Report”. Easy fix.

    2.) The AJAX for reporting posts takes FOREVER.

    On a site with php.ini script timeout set to 30 seconds, it consistently takes 30 seconds to “process” the report until the “Your report will be reviewed by our moderation team.” message shows.

    On a site with 120 second script timeout set in php.ini, it consistently takes 120 seconds to “process” the report until the “Your report will be reviewed by our moderation team.” message shows.

    That seems to be an infinite loop happening with the AJAX processing that the script timeout kills.

    The processing actually happens pretty quickly (I can see the _bbp_modtools_post_report & _bbp_modtools_post_report_count meta values show up in the DB instantly), but the AJAX call/response itself doesn’t die() immediately after it’s done processing. Once it hits the script timeout value, THEN it finally dies and the page refreshes with the “Your report will be reviewed by our moderation team.”

    This excessive processing time is what led me to find the issue with “Report reason” showing up as the reason a post was reported. The processing takes so long, that I selected different values in the reason select drop-down, and multiple reasons were reported/processed BEFORE the initial AJAX call ever finished.

    It’s stuck in a loop somewhere along the way. Script timeout kills it, but 30 seconds, 120 seconds, or whatever script timeout is set to for wait time makes it unusable for front-end users. Especially when changing the select drop-down option within that wait time produces multiple reported post reasons.

    This may take a while to debug. If you want some assistance, let me know and I’ll do what I can, but you’re far more familiar with how modtools processes reports than I am.

    Plugin Author Robin W

    (@robin-w)

    I’ve finally got around to these – I’m just about to release version 5.2.1.

    This has the public function handle_report_post() fix, and the The “Report” link “a.bbp-report-link” css selector is fixed also.

    On the ‘The AJAX for reporting posts takes FOREVER.’ – I have just tested this, and it takes around 1 second on my test site to do and report back, so I cannot replicate this. Can you do some further checking on your site to see if it is either a combination of settings in my plugin, or a combination of plugins/theme/child theme functions that is causing on your site ?

    Thread Starter codejp3

    (@codejp3)

    Can you do some further checking on your site to see if it is either a combination of settings in my plugin, or a combination of plugins/theme/child theme functions that is causing on your site ?

    Yeah. I’ll see if I can narrow it down some more.

    DeepBlue

    (@deepblue5)

    Thanks !

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Moderation tools issue’ is closed to new replies.