2010-12-24, 02:20 PM
2010-12-24, 05:24 PM
2010-12-24, 06:32 PM
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, 10:38 PM
(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 ....
2010-12-24, 10:58 PM
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, 11:01 PM
(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
2010-12-25, 12:26 AM
^^ yep. anyway, as others said that labrocca's plugin is still working by compatability change, my suggestion may not be needed.
2010-12-26, 05:50 PM
Should be a default feature of MyBB in my humble opinion. Thanks for sharing this.
2011-01-01, 09:26 PM
This plugin is incompatible with MyBB 1601
2011-02-24, 10:44 PM
Thanks for the plugin.