MyBB Community Forums

Full Version: [Free] Stop Self Rating
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5
It should be fine IMO.
(2010-12-24, 02:20 PM)Yaldaram Wrote: [ -> ]It should be fine IMO.

I hope it is. Wink

Thank you.
we can make it with simple edits. by installing zingaburga's php in templates and making edits for rating code in mybb core files
(2010-12-24, 06:32 PM)TheGodFather Wrote: [ -> ]we can make it with simple edits. by installing zingaburga's php in templates and making edits for rating code in mybb core files

What you mean exactly ? This is already working ....
Works fine with 1.6 if you change the compatibility. Here's a simple edit that adds a setting to control usergroups allowed to do so.
<?php

/* Plugin: Stop Self Rating
 * By Jesse Labrocca Copyright 2009
 * Version 1.0
 * License:  GNU/GPL v1
 */ 

if( !defined('IN_MYBB') )
{
	die('Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.');
}


$plugins->add_hook('ratethread_process','stop_self_rating');


function stop_self_rating_info()
{
	
	return array(
		'name'			=> 'Stop Self Rating',
		'description'	=> 'Prevents a user from rating their own threads. Usergroup control added by Steven ([email protected]).',
		'website'		=> 'http://www.mybbcentral.com',
		'author'		=> 'Jesse LaBrocca',
		'authorsite'	=> 'http://www.mybbcentral.com',
		'version'		=> '1.0',
		'compatibility' => '16*',
	);
}


function stop_self_rating_activate()
{
    global $db;
    
    $setting_group = array(
        'gid' => null,
        'name' => 'stopselfrating',
        'title' => 'Stop Self Rating Settings',
        'description' => 'Settings for Stop Self Rating.',
        'disporder' => 0,
        'isdefault' => 'no'
    );
    $db->insert_query('settinggroups',$setting_group);
    $gid = intval($db->insert_id());
    
    $setting = array(
        'sid' => null,
        'name' => 'stopselfrating_groups',
        'title' => 'Allow Usergroups',
        'description' => 'Users within these usergroups are allowed to self-rate threads. Separate multiple usergroups with a comma; leave blank to disallow all. Default id for administrators is 4.',
        'optionscode' => 'text',
        'value' => '4',
        'disporder' => 1,
        'gid' => $gid
    );
    $db->insert_query('settings',$setting);
    rebuild_settings();
}

function stop_self_rating_deactivate()
{
    global $db;
    
    $db->query("DELETE FROM `".TABLE_PREFIX."settings` WHERE `name`='stopselfrating_groups'");
    $db->query("DELETE FROM `".TABLE_PREFIX."settinggroups` WHERE `name`='stopselfrating'");
    rebuildsettings();
}

function stop_self_rating()
{
    global $mybb, $thread;
    
    $groups = explode(',',$mybb->settings['stopselfrating_groups']);
    
	if( $thread['uid'] == $mybb->user['uid'] )
	{
		if( !in_array($mybb->user['usergroup'],$groups) )
		{
            error('You cannot rate your own threads.');
		}
	}
}

?>
(2010-12-24, 10:38 PM)IamHappy Wrote: [ -> ]
(2010-12-24, 06:32 PM)TheGodFather Wrote: [ -> ]we can make it with simple edits. by installing zingaburga's php in templates and making edits for rating code in mybb core files

What you mean exactly ? This is already working ....

He is giving you another way to stop self rating Smile
^^ yep. anyway, as others said that labrocca's plugin is still working by compatability change, my suggestion may not be needed. Smile
Should be a default feature of MyBB in my humble opinion. Thanks for sharing this.
This plugin is incompatible with MyBB 1601 Huh
Thanks for the plugin.
Pages: 1 2 3 4 5