MyBB Community Forums

Full Version: Stop un-activated members from reporting posts
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How do I stop un-activated members from reporting posts?

Amazingly, this is possible.
You can certainly do this with a hook. How would you define an inactive member though?

Lower post count than x? Post/day ratio lower than x?

If you are familiar with PHP and plug-in coding you can make use of the report_ hooks and check the user's information (such as post count).
(2014-01-10, 03:15 AM)SentoWeb Wrote: [ -> ]You can certainly do this with a hook. How would you define an inactive member though?

Lower post count than x? Post/day ratio lower than x?

If you are familiar with PHP and plug-in coding you can make use of the report_ hooks and check the user's information (such as post count).

They are simply a member of the "Awaiting Activation" group. It's a mybb default group and nothing special.
My bad, I read inactive instead of "un-activated". (I ran out of coffee this morning...) I might be able to write a little plug-in for you later today so that you don't have to do core modifications.
Ahh - no need for that, I'm surprised it's even possible- might be something to add into the next core
version
You can perhaps use Template conditionals plugin to prevent/hide the report button from displaying on the postbit.
(2014-01-10, 05:55 AM)itsmegogo Wrote: [ -> ]You can perhaps use Template conditionals plugin to prevent/hide the report button from displaying on the postbit.

Hiding a button doesn't prevent functionality.

Its simple.
Open report.php, goto line no. 21 and find:

if($mybb->usergroup['canview'] == 0 || !$mybb->user['uid'])

Change it to:

if($mybb->usergroup['canview'] == 0 || !$mybb->user['uid'] || $mybb->user['usergroup'] == 5)

Save the file. Done.
Effone, please correct me if wrong. the report button uses javascript for its function. Is it possible to replicate the function in any other way?
(2014-01-10, 06:16 AM)itsmegogo Wrote: [ -> ]Effone, please correct me if wrong. the report button uses javascript for its function. Is it possible to replicate the function in any other way?

http://community.mybb.com/report.php?pid=1056333

Try it.

Note: That uses js only for making a popup. Reporting is functional with full page view as well.
I am not a fan of edits because I could hardly keep track of them.

<?php
// Hooks
$plugins->add_hook('report_start', 'ReportFix_fix');

function ReportFix_info(){
    return array(
        "name"            => "Prevent inactive users from reporting",
        "description"    => "That.",
        "website"        => "http://sentoweb.com",
        "author"        => "Ervin Czeczi",
        "authorsite"    => "http://sentoweb.com",
        "guid" => "",
        "version" => "1.0",
        "compatibility" => "16*"
    );
}

function ReportFix_fix($data) {
	global $mybb;
	
	if ($mybb->usergroup['gid'] == 5) {
		exit('<script type="text/javascript">window.close();</script> You can\'t use this function until you activate your account.');
	}
}
?>

Save it as ReportFix.php in inc/plugins. This will close the javascript popup and by no means will they be able to report it. You can play with the exit call and display an error message instead.