Selasa, 05 November 2013

Cara Membuat Banned Pages Tanpa Plugins Di MyBB

Cara Membuat Banned Pages Tanpa Plugins Di MyBB

Cara Membuat Banned Pages Tanpa Plugins Di MyBB - Memang pihak MyBB tidak memberikan halaman banned untuk para pengguna mybb. Banned pages merupakan halaman yang berisikan list user yang telah dibanned oleh Moderator atau Administrator karena user tersebut telah melanggar aturan, halaman ini berguna untuk mengetahui siapa yang membanned user tersebut dan kapan hukuman banned tersebut berakhir.

#1 Membuat Custom Pages

Buat file php yang baru ditempat direktori MyBB anda berada seperti ini dengan nama file banned.php :
<?php

define('IN_MYBB', 1); // Are we in MyBB? Yep!
require "./global.php"; // We need this to get the templates and database functions.
add_breadcrumb("Daftar Blacklist", "banned.php"); // This is the navbit part. People like to know where they are ;)
$banned_page_head = "
<tr>
<td width='11%' align='center' class='tcat' colspan='1'><strong>Name</strong></td>
<td width='9%' align='center' class='tcat' colspan='1'><strong>Date Set</strong></td>
<td width='9%' align='center' class='tcat' colspan='1'><strong>Date Lifted</strong></td>
<td align='center' class='tcat' colspan='1'><strong>Reason</strong></td>
<td width='11%' align='center' class='tcat' colspan='1'><strong>Banned By</strong></td>
</tr>
"; // This is the Name, Set, Lifted, Reason and Banned By header. I put it here to clean up the ban list if no-one is banned.
$nobans = "
<tr>
<td colspan='5' align='center' valign='middle' class='trow1'>There are no banned members</td>
</tr>"; // I didn't see the point in making a brand new template just for three lines of html ;)
// eval doesn't seem to like double ( "" ) quotes, so I had to use single ( '' ) here.
$query = $db->query("SELECT * FROM ".TABLE_PREFIX."banned ORDER BY dateline DESC LIMIT 30"); // Query 1 selects everything from the banned table, and orders it nicely.
    if($db->num_rows($query) != 0) // A quick check to make sure there are some planks worth showing...
    {
        while($banned_info = $db->fetch_array($query)) // If there's more than one ban entered, make sure it's processed!
        {
            $banned_userid = $banned_info['uid'];
            $banned_reason = $banned_info['reason'];
            $banned_admin = $banned_info['admin'];
            $banned_startdate = date("jS F y", $banned_info['dateline']);
                if ($banned_info['lifted'] == 0)
                    $banned_lifted = "Never";
                else
                    $banned_lifted = date("jS F y", $banned_info['lifted']);
            $uQuery = $db->query("SELECT username FROM ".TABLE_PREFIX."users WHERE uid='" . $banned_userid . "'");
            $banned_uName = $db->fetch_array($uQuery);
            $banned_name = $banned_uName['username'];
            $query3 = $db->query("SELECT username FROM ".TABLE_PREFIX."users WHERE uid='" . $banned_admin . "'");
            $banned_info3 = $db->fetch_array($query3);
            $banned_adminname = $banned_info3['username'];
            eval("\$banned_page_header .= \"".$banned_page_head."\";"); // If someone is banned, we want to know what all the values mean ;)
            eval("\$banned_page_banbit .= \"".$templates->get("banned_page_banbit")."\";"); // Stick the above in a template and get it ready for assimilation!
        }          
    }
    else // If there aren't any planks, display a message...
    {
        eval("\$banned_page_nobans .= \"".$nobans."\";");
    }
   
    eval("\$banned_page = \"".$templates->get("banned_page")."\";");
   
output_page($banned_page); // And finally, send the page to the viewer!
?>

 #2 Membuat Template

Buat templatenya di global template ataupun di template yang anda gunakan saat ini di forum sobat
Template Name : banned_page
<html>
<head>
<title>Daftar Akun yang Telah Dibanned - {$mybb->settings[bbname]}</title>
{$headerinclude}
</head>
<body>
{$header}
<table border="0" cellspacing="{$theme[borderwidth]}" cellpadding="{$theme[tablespace]}" class="tborder" width="100%">
<tr>
<td class="thead" colspan="5"><strong>Pemberitahuan</strong></td>
</tr>
<tr>
<td>Halaman ini merupakan list dari beberapa user yang terkena banned karena telah melanggar aturan ketentuan yang telah dibuat forum RowsCyber, banned list ini akan terus diupdate jika terdapat user yang dibanned tanpa pemberitahuan sebelumnya.
</td></tr>
</table>
<br/>
<table border="0" cellspacing="{$theme[borderwidth]}" cellpadding="{$theme[tablespace]}" class="tborder" width="100%">
<tr>
<td class="thead" colspan="5"><strong>Daftar Akun</strong></td>
</tr>
{$banned_page_head}
{$banned_page_nobans}
{$banned_page_banbit}
<tr>
<td colspan="5" align="center" class="tfoot">Jika akun anda terdapat pada daftar ini , Harap segera melapor pada forum <a href="http://fb.com/Rully.DarkArd">pelaporan.</a></td>
</tr>
</table>
{$footer}
</body>
</html> 
Template Name : banned_page_banbit
<tr>
<td width="11%" align="center" valign="middle" class="trow1"><a href="member.php?action=profile&amp;uid={$banned_userid}">{$banned_name}</a></td>
<td width="9%" align="center" valign="middle" class="trow2">{$banned_startdate}</td>
<td width="9%" align="center" valign="middle" class="trow1">{$banned_lifted}</td>
<td align="center" valign="middle" class="trow2">{$banned_reason}</td>
<td width="11%" align="center" valign="middle" class="trow1">{$banned_adminname}</td>
</tr> 
Sekian tutorial mengenai MyBB yang bisa saya berikan. Terima kasih sudah membaca artikel ini, semoga bermanfaat dan berguna untuk forum sobat

3 comments

Biar ga bisa di akses GUEST gimana gan

mas gimana cara merubah bhs ke bhs indonesia di mybb

Terima kasih telah mengunjungi blog sederhana Koran Artikel
Saya harap sobat mau mematuhi peraturan berkomentar di blog ini :

1. Dilarang SPAM
2. Dilarang berkomentar yang mengandung unsur Porno, Sara, Judi
3. Dilarang OOT (Out Of Topic)
4. Dilarang Live Link
5. Berkomentarlah yang Sopan dan Relevan

Regards,
EmoticonEmoticon