MyBB Community Forums

Full Version: My plugin doesn't appear on plugins list
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have a very very simple plugin, but it does not appear on the plugin's list on admincp.

I'm sure the file is imported because it showed me a syntax error the first time I uploeaded it.

<?php
/****************************************************************************
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/

if (!defined('IN_MYBB')){
    die('This file cannot be accessed directly.');
}
$plugins->add_hook('report_start', 'minpost_report_callback');

function minpost_to_report(){
    return Array(
        "name" => "Min postcount to report",
        "description" => "Users without minimun postcount can't report",
        "website" => "https://amxmodx-es.com",
        "author" => "Neeeeeeeeeel.-",
        "authorsite" => "https://amxmodx-es.com",
        "version" => "v1.0",
        "compatibility" => "18*"
    );
}

function minpost_report_callback(){
    global $mybb;
    if ($mybb->user['postnum'] < $mybb->settings['minpost_to_report_postcount']*1){
        exit();
    }
}

function minpost_to_report_install(){
    global $db;
    $setting_group = array(
        'name'            => 'minpost_to_report',
        'title'            => 'Min postcount to report',
        'description'    => '',
        'disporder'        => '10',
        'isdefault'        => 'no'
    );
    $db->insert_query('settinggroups', $setting_group);
    $gid = $db->insert_id();

    $minpost_to_report_setting = array(
        'name'            => 'minpost_to_report_postcount',
        'title'            => 'Minimun postcount',
        'description'    => '',
        'optionscode'    => 'numeric',
        'value'            => '50',
        'disporder'        => '1',
        'gid'            => intval($gid)
    );
    $db->insert_query('settings', $minpost_to_report_setting);

    rebuild_settings();
}

function minpost_to_report_uninstall(){
    global $db;
    $db->write_query("DELETE FROM ".TABLE_PREFIX."settings WHERE name IN ('minpost_to_report_postcount')");

    $db->write_query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE name = 'minpost_to_report'");
    rebuild_settings();
}

?>
change function minpost_to_report() as function minpost_to_report_info()
Ouch, I forgot that. It worked, thanks!!!
Yes take in mind that anyway you can set integer values to not add *1

You can add some code changes on your plugin due that way is functional but i think you can optimize your code.

Anyway you have solved,so that's only MO you can change a lot of the code.