MyBB Community Forums

Full Version: warnpostinfo
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi

I have a simple plugin to show information about the warnings in the post

<?php
if(!defined("IN_MYBB"))
{
    die("You Cannot Access This File Directly. Please Make Sure IN_MYBB Is Defined.");
} 

$plugins->add_hook('postbit', 'WarnInfo_postbit'); 

function WarnPostInfo_info()
{

	return array(
		"name"		=> "WarnPostInfo",
		"description"		=> "Plugin pokazuje czy autor postu otrzymał ostrzeżenie",
		"website"		=> "http://cheq.cyanogenmod.pl",
		"author"		=> "CheQ",
		"authorsite"		=> "http://cheq.cyanogenmod.pl",
		"version"		=> "v0.3",
		"guid" 			=> "",
		"compatibility"	=> "*"
		);
}	
function WarnPostInfo_install()
{
	global $db;
	$myfirstplugin_group = array(
        'gid'    => 'NULL',
        'name'  => 'WarnPostInfo',
        'title'      => 'WarnPostInfo Ustawienia',
        'description'    => 'WarnPostInfo ustawienia',
        'disporder'    => "1",
        'isdefault'  => "0",
    ); 
	$db->insert_query('settinggroups', $myfirstplugin_group);
	$gid = $db->insert_id(); 
	$myfirstplugin_setting = array(
        'sid'            => 'NULL',
        'name'        => 'WarnPostInfo_onoff',
        'title'            => 'Wlacz/Wylacz Plugin',
        'description'    => 'Czy chcesz wlaczyc plugin?',
        'optionscode'    => 'yesno',
        'value'        => '1',
        'disporder'        => 1,
        'gid'            => intval($gid),
    ); 
	$db->insert_query('settings', $myfirstplugin_setting);
	rebuild_settings();
}
function WarnPostInfo_is_installed()
{
	global $mybb;
	if($mybb->settings['WarnPostInfo_onoff'] == '1' || $mybb->settings['WarnPostInfo_onoff'] == '0')
	{
		return true;
	}
	return false;
}
function WarnPostInfo_uninstall()
{
	global $db;
	$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name IN ('WarnPostInfo_onoff')");
	$db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE name='WarnPostInfo'");
	rebuild_settings();
}
function Warninfo_postbit(&$post)
{
	global $mybb;
	if($mybb->settings['WarnPostInfo_onoff'] == 1)
	{
		global $db;
		$query=$db->query('SELECT * FROM '.TABLE_PREFIX.'warnings WHERE pid ='.$post['pid']);
		while($result=$db->fetch_array($query))
		{
		   $post['message'].='<div class = "warn_info"> Autor postu otrzymał za niego ostrzeżenie w ilosci : '.$result['points'].' powod : '.$result['title'].'</div>';
		}
	}
		
} 
?>

translation

 $post['message'].='<div class = "warn_info"> Autor postu otrzymał za niego ostrzeżenie w ilosci : '.$result['points'].' powod : '.$result['title'].'</div>';

By subject received a warning for him in the amount of: $1 Reason: $2

My questions
1. How to add a nickname moderator who gives a warning?
2. while adding a warning when you enter it manually Reason is displayed but when I choose from a list of ready-made (warning system) ronson not show

Please help

Soet for my english
ref

pleas help
ref

ref
ref ref
btw nice support
Wrong base, maybe that's one of the main reasons of no support. Anyways:
1) You can get moderator name by LEFT JOINing mybb_users with issuedby equal to uid in your query, then getting username from mybb_users.
2) Not sure but dropdown reasons should work as custom ones. Maybe there are special characters in reasons which you need to escape/convert in your code.

Pozdrawiam.