Current time: 05-24-2012, 09:22 AM Hello There, Guest! (LoginRegister)


Post Reply 
 
Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[TuT]: Auto Post Warn
09-12-2011, 10:21 AM
Post: #1
[TuT]: Auto Post Warn
Works With 1.6.x
Original Author: thebod

First of all you have to find this in warnings.php (line 248):
PHP Code:
$db->insert_query("warnings"$new_warning); 

Add below:
PHP Code:
$plugins->run_hooks("warnings_do_warn_insert"); 

Then create a file named 'warnpost.php' in inc/plugins with the following content:

PHP Code:
<?php

/*
    Warn Post Extension
    
    Version 0.1
    
    Autor: thebod
    Homepage: http://www.b-ike.de/
    
    Erstellt bei Userverwarnungen einen Thread.
    
    Alpha-Testversion, bitte anpassen!
    
    Lizenz: Ihr dürft alles machen, lasst nur meinen Namen bitte drin ;)
*/

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

/*********** CHANGE HERE ***********/

$into_fid 2;  // Foren ID

/***********************************/

$plugins->add_hook("warnings_do_warn_insert""warnpost_doAction");

function 
warnpost_info()
{
    return array(
        
"name"            => "Warn Post",
        
"description"    => "Erstellt einen Thread beim Verwarnungen von Userns",
        
"website"        => "http://www.schwarzernorden.de/",
        
"author"        => "thebod",
        
"authorsite"    => "http://www.b-ike.de/",
        
"version"        => "0.1",
        
"guid"             => "",
        
"compatibility" => "*"
    
);
}

function 
warnpost_doAction()
{
    global 
$mybb$new_warning$into_fid;
    
    require_once 
MYBB_ROOT."inc/datahandlers/post.php";
    
$posthandler = new PostDataHandler("insert");
    
$posthandler->action "thread";
    
    
$user get_user($new_warning['uid']);
    
    
$pmNotice false;
    if(
$mybb->input['send_pm'] == && $group_permissions['canusepms']  != && $user['receivepms'] != && $mybb->settings['enablepms'] != 0)
        
$pmNotice true;
    
    
$new_thread = array(
        
"fid" => $into_fid,
        
"subject" => "Warning User " $user['username'],
        
"prefix" => '',
        
"icon" => 0,
        
"uid" => $mybb->user['uid'],
        
"username" => $mybb->user['username'],
        
"message" =>"Warning User " $user['username']."\n".
                    
"Notiz:[QUOTE]" $new_warning['notes'] . "[/QUOTE]\n".
                    
"Punkte: " $new_warning['points'] . "\n".
                    (
$pmNotice "Der User wurde per PM benachrichtigt.\n" ''),
        
"ipaddress" => get_ip(),
        
"posthash" => $mybb->input['posthash']
    );
    
    
$posthandler->set_data($new_thread);
    
    
$posthandler->validate_thread();
    
    
$posthandler->insert_thread();


You only have to change "$into_fid". That's the Forums ID.
It's a German Tutorial. Therefore, it is "Punkte" for "Points" and "Notiz" for "Notice".
You can change it for yourself.
Then you have to activate it in ACP. That is! Wink
Visit this user's website Find all posts by this user
Quote this message in a reply
09-12-2011, 10:37 AM
Post: #2
RE: [TuT]: Auto Post Warn
so when a user is warned, it automatically posts a new thread about it ... fine Smile
Find all posts by this user
Quote this message in a reply
09-12-2011, 11:30 AM
Post: #3
RE: [TuT]: Auto Post Warn
This user has been denied support. This user has been denied support.
if possible some one make a plugin for it plz. Smile

but thnx a lot man too good job Cool
Visit this user's website Find all posts by this user
Quote this message in a reply
09-12-2011, 11:43 AM
Post: #4
RE: [TuT]: Auto Post Warn
^ well, this topic actually provides the plug-in code ; however it needs a core file edit !!
Find all posts by this user
Quote this message in a reply
09-12-2011, 12:01 PM
Post: #5
RE: [TuT]: Auto Post Warn
Right. Smile
warnpost.php is the code for a plugin. If you create the file you have a plugin. Wink
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)

Contact Us | MyBB | Return to Top | Return to Content | Lite (Archive) Mode | RSS Syndication