Skip to content

Commit

Permalink
initial upload
Browse files Browse the repository at this point in the history
  • Loading branch information
SvePu committed Jan 13, 2022
1 parent 089741b commit 7db9d6b
Show file tree
Hide file tree
Showing 4 changed files with 198 additions and 0 deletions.
19 changes: 19 additions & 0 deletions UPLOAD/inc/languages/deutsch_du/moderatefirstpost.lang.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php
/**
* MyBB 1.8 Plugin - MyBB Moderate First Post
* MyBB 1.8 Sprachpaket Deutsch Informell
*
*/

// ACP
$l['moderatefirstpost'] = "Moderate First Post";
$l['moderatefirstpost_desc'] = "Dieses Plugin erzwingt die Moderation des ersten Beitrags von Mitgliedern.";

// ACP Settings
$l['setting_group_moderatefirstpost'] = "Moderate First Post Einstellungen";
$l['setting_group_moderatefirstpost_desc'] = "Einstellungen des Moderate First Post Plugins";
$l['setting_moderatefirstpost_enable'] = "Moderate First Post Aktivieren?";
$l['setting_moderatefirstpost_enable_desc'] = "Wähle JA, um die Funktionen des Moderate First Post Plugins zu aktivieren!";

// Forum
$l['moderatefirstpost_moderation_user_posts'] = "<br/>Diese Vorgehensweise haben wir aus Spamschutzgründen voreingestellt.<br/>Sobald der erste Beitrag von dir im Forum sichtbar ist, wird diese Kontrolloption automatisch deaktiviert.";
19 changes: 19 additions & 0 deletions UPLOAD/inc/languages/deutsch_sie/moderatefirstpost.lang.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php
/**
* MyBB 1.8 Plugin - MyBB Moderate First Post
* MyBB 1.8 Sprachpaket Deutsch Formell
*
*/

// ACP
$l['moderatefirstpost'] = "Moderate First Post";
$l['moderatefirstpost_desc'] = "Dieses Plugin erzwingt die Moderation des ersten Beitrags von Mitgliedern.";

// ACP Settings
$l['setting_group_moderatefirstpost'] = "Moderate First Post Einstellungen";
$l['setting_group_moderatefirstpost_desc'] = "Einstellungen des Moderate First Post Plugins";
$l['setting_moderatefirstpost_enable'] = "Moderate First Post Plugin Aktivieren?";
$l['setting_moderatefirstpost_enable_desc'] = "Wähle Sie JA, um die Funktionen des Moderate First Post Plugins zu aktivieren!";

// Forum
$l['moderatefirstpost_moderation_user_posts'] = "<br/>Diese Vorgehensweise haben wir aus Spamschutzgründen voreingestellt.<br/>Sobald der erste Beitrag von dir im Forum sichtbar ist, wird diese Kontrolloption automatisch deaktiviert.";
19 changes: 19 additions & 0 deletions UPLOAD/inc/languages/english/moderatefirstpost.lang.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php
/**
* MyBB 1.8 Plugin - MyBB Moderate First Post
* MyBB 1.8 Langpack English
*
*/

// ACP
$l['moderatefirstpost'] = "Moderate First Post";
$l['moderatefirstpost_desc'] = "This plugin forces the moderation of the first post from members. ";

// ACP Settings
$l['setting_group_moderatefirstpost'] = "Moderate First Post Settings";
$l['setting_group_moderatefirstpost_desc'] = "Settings of Moderate First Post plugin";
$l['setting_moderatefirstpost_enable'] = "Activate Moderate First Post plugin?";
$l['setting_moderatefirstpost_enable_desc'] = "Select YES to activate the functions of the Moderate First Post plugin!";

// Forum
$l['moderatefirstpost_moderation_user_posts'] = "<br/>We have preset this procedure for spam protection reasons.<br/>As soon as your first post is visible in the forum, this control option is automatically deactivated.";
141 changes: 141 additions & 0 deletions UPLOAD/inc/plugins/moderatefirstpost.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
<?php
/**
* MyBB 1.8 Plugin - MyBB Moderate First Post
* Copyright 2022 SvePu, All Rights Reserved
*
* Website: https://github.com/SvePu/MyBB-Moderate-First-Post
* License: https://github.com/SvePu/MyBB-Moderate-First-Post/blob/main/LICENSE
*
*/

if(!defined("IN_MYBB"))
{
die("Direct initialization of this file is not allowed.");
}

if(defined('IN_ADMINCP'))
{
$plugins->add_hook('admin_config_settings_begin', 'moderatefirstpost_acp_lang');
}
else
{
$plugins->add_hook('newreply_do_newreply_start', 'moderatefirstpost_run');
$plugins->add_hook('newthread_do_newthread_start', 'moderatefirstpost_run');
$plugins->add_hook('newreply_start', 'moderatefirstpost_run');
$plugins->add_hook('newthread_start', 'moderatefirstpost_run');
$plugins->add_hook('showthread_start', 'moderatefirstpost_run');
}


function moderatefirstpost_info()
{
global $db, $lang;
$lang->load('moderatefirstpost', true);

return array(
'name' => $db->escape_string($lang->moderatefirstpost),
'description' => $db->escape_string($lang->moderatefirstpost_desc),
"website" => "https://github.com/SvePu/MyBB-Moderate-First-Post",
"author" => "SvePu",
"authorsite" => "https://github.com/SvePu",
"version" => "1.0",
"codename" => "moderatefirstpost",
"compatibility" => "18*"
);
}

function moderatefirstpost_install()
{
global $db, $lang;
$lang->load('moderatefirstpost', true);

$query = $db->simple_select("settinggroups", "COUNT(*) AS disporder");
$disporder = $db->fetch_field($query, "disporder");

$setting_group = array(
'name' => 'moderatefirstpost',
"title" => $db->escape_string($lang->setting_group_moderatefirstpost),
"description" => $db->escape_string($lang->setting_group_moderatefirstpost_desc),
'disporder' => $disporder+1,
'isdefault' => 0
);

$gid = $db->insert_query("settinggroups", $setting_group);

$setting_array = array(
'moderatefirstpost_enable' => array(
'title' => $db->escape_string($lang->setting_moderatefirstpost_enable),
'description' => $db->escape_string($lang->setting_moderatefirstpost_enable_desc),
'optionscode' => 'yesno',
'value' => 1,
'disporder' => 1
)
);

foreach($setting_array as $name => $setting)
{
$setting['name'] = $name;
$setting['gid'] = $gid;
$db->insert_query('settings', $setting);
}

rebuild_settings();
}

function moderatefirstpost_is_installed()
{
global $mybb;
if(isset($mybb->settings['moderatefirstpost_enable']))
{
return true;
}
return false;
}

function moderatefirstpost_uninstall()
{
global $db, $mybb;

$query = $db->simple_select("settinggroups", "gid", "name='moderatefirstpost'");
$gid = $db->fetch_field($query, "gid");
if(!$gid)
{
return;
}
$db->delete_query("settinggroups", "name='moderatefirstpost'");
$db->delete_query("settings", "gid=$gid");
rebuild_settings();
}

function moderatefirstpost_activate()
{

}

function moderatefirstpost_deactivate()
{

}

function moderatefirstpost_acp_lang()
{
global $lang;
$lang->load('moderatefirstpost', true);
}

function moderatefirstpost_run()
{
global $mybb, $lang;
$lang->load('moderatefirstpost');

if(!$mybb->user['uid'] || $mybb->settings['moderatefirstpost_enable'] != 1)
{
return;
}

if($mybb->user['postnum'] < 1 && $mybb->usergroup['canmodcp'] != 1)
{
$mybb->user['moderateposts'] = 1;
$lang->moderation_user_posts = $lang->moderation_user_posts . $lang->moderatefirstpost_moderation_user_posts;
}
}

0 comments on commit 7db9d6b

Please sign in to comment.