Quantcast
Channel: MyBB Community Forums - Tutorials
Viewing all 685 articles
Browse latest View live

Theme installation

$
0
0
Here is my tutorial for theme installation of MyBB 1.8







First click at Extend at navigation:

[Image: image.png]

Than click at button Themes:

[Image: image.png]

Than choose theme you want.

You can click at both: button download or at theme name (red and purple circles at image):

[Image: image.png]

Now click at Download at right side.

You have at most of themes prewiew. See it in full size by clicking at image at section Prewiews:

[Image: image.png]

Now check "I agree with licence" and than Download:

[Image: image.png]

Save file:

[Image: image.png]

Open that:

[Image: image.png]

And extract to background or some map:

[Image: image.png]

Now open filezilla or another file manager (that way it will be faster done) and move map with images to map images of your forum:

[Image: image.png]

Like this:

[Image: image.png]

Now go at your admin cp -> Templates & Style -> Import a theme and click "Open" at "Import from" (see image):

[Image: image.png]
Upload .xml file:

[Image: image.png]

When it's choosen, choose "Ignore version compitablity" and click button "Import theme":

[Image: image.png]

Now it should be uploaded and you will get this:

[Image: image.png]

After that will be some options what you don't need to touch. Just exit from that and check your new theme!


Tutorial created by Ivan Kerepčić for MyBB

For any questions or suggestions freely reply

[Mostly every MyBB] Custom E-Mail template.

$
0
0
WARNING! This is replacing both plain and HTML messages with eval'd code.
Make sure to backup modified file for further update backup.



Hello

so. as first step download attachment file "class_mailhandler.php" and put it inside inc folder (i've used 1.8.3 one for edits).

.php   class_mailhandler.php (Size: 8.32 KB / Downloads: 12)

Then:
In global templates, make "html_mail" template and stylize it as you want to do. I'll provide here my code:

Code:
<body style="background: #F0F0F0;color: #333;text-align: left;line-height: 1.4;font-family: Segoe UI, Tahoma, Verdana, Arial, Sans-Serif;font-size: 13px;padding: 0;margin: 0;">

<div style="width: 100%;z-index: 9000;background-color: black;color: white;height: 60px;">
        <div style="">
            <ul style="float: left;list-style: none;margin: 0;padding: 0;">
                <li style="float: left;position: relative;height: 50px;margin-top: -5px !important;">
                    <a href="http://forum.vnetwork.pl/portal.php" style="text-shadow: 0px 1px 1px rgba(0,0,0,0.5);display: block;color: #FFF;font-weight: normal;font-size: 0.93em;height: 100%;text-decoration: none;">
                        <img src="http://vnetwork.pl//logo_white.png" style="width: 150px;height: 60px;margin-top: -4px;" original-title="">
                    </a>
                </li>
            </ul>
        </div>
    </div>
    <div style="text-align: left;line-height: 1.4;min-width: 990px;box-shadow: 0 5px 9px rgba(0,0,0,0.1);color: #333;font-family: Tahoma, Verdana, Arial, Sans-Serif;font-size: 13px;width: 90%;margin: auto auto;">
        <div style="background: #fff;width: auto !important;padding: 20px;border-left: 1px solid #E0E0E0;border-right: 1px solid #E0E0E0;">
          {$message}
        </div>
    </div>

    <div style="clear: both;background: black;">
        <div style="padding: 6px;font-size: 12px;margin: auto auto;color: white;">
vNetwork.PL - Powered by MyBB
        </div>
    </div>
</body>

And the result will be:
[Image: QN4dpzG.jpg]

[Deprecated since MyBB 1.8.4] noCaptcha with MyBB

$
0
0
WARNING! And over again. This tutorial require core edits inside class_captcha.php file.

Well. noticed info above?
So let's start.

1. Make template edit.
Find member_register_regimage_recaptcha (let me help you. Is located at Member Templates).
Find:
Code:
<script type="text/javascript" src="{$server}/challenge?k={$public_key}"></script>

And replace it with:
Code:
<script src='https://www.google.com/recaptcha/api.js'></script>
<div class="g-recaptcha" data-sitekey="{$public_key}"></div>

2. Make core file edit.
I think best solution would be telling which line of code were replaced. so:
At line 283 (as of latest commited file) find:
PHP Code:
283. $challenge $mybb->input['recaptcha_challenge_field'];
284. $response $mybb->input['recaptcha_response_field'];
[[
285 --> 327]]
328. $answer explode("\n"$response[1]);
329. if(trim($answer[0]) != 'true')
330. {
331. // We got it wrong! Oh no...
332. $this->set_error($lang->invalid_captcha_verify);
333. }
334. }
335. }
336. 

And replace everything with:
PHP Code:
$response $mybb->input['g-recaptcha-response'];

if(!
$response || strlen($response) == 0) {
    
$this->set_error($lang->invalid_captcha);
} else {
    
$google_url "https://www.google.com/recaptcha/api/siteverify";
    
$url $google_url."?secret=".$mybb->settings['captchaprivatekey']."&response=".$response."&remoteip=".$session->ipaddress;
 
               
    $nocaptchareply 
= @file_get_contents($url);

    
$res json_decode($nocaptchareplytrue);
    if(!
$res['success']) {
        
$this->set_error($lang->invalid_captcha_verify);
    }


3. Language edits (OBSOLETE):
go to your member.lang.php and find:
PHP Code:
$l['verification_note'] = "Please enter the text contained within the image into the text box below it. This process is used to prevent automated processes.";
[....]
$l['error_regimageinvalid'] = "The image verification code that you entered was incorrect. Please enter the code exactly how it appears in the image.";
$l['error_regimagerequired'] = "Please fill out the image verification code to continue the login process. Please enter the code exactly how it appears in the image."

And edit them as you'd like to be appared. For example:

PHP Code:
$l['verification_note'] = "Please checkbox a square. This process is used to prevent automated processes.";
[....]
$l['error_regimageinvalid'] = "Please click the checkbox.";
$l['error_regimagerequired'] = "Something went wrong. Please retry again."

And that's all Smile
More info about noCaptcha can be found [here] and [here]

Edit: This tutorial will be deprecated (as of MyBB Developers included noCaptcha in next release).

MyBB Installation Tutorial

$
0
0
Full MyBB installation Tutorial for newbies.
The following tutorial is based on  MyBB 1.6.15.
So first of all you'll need the MyBB Files, download them here - DOWNLOAD
Once you have those you'll need a hosting, I'll be using 000WebHost since this is a tutorial - 000WebHost

STEPS


Step 1

Sign up at 000WebHost and then click to add a new website and do as I have done below.

[Image: aea775350c0e779289e7e883e1ee0e32.png]

Then click to create the account.
Keep refreshing till the account is made, it only takes a few seconds.

Step 2

So now you have the MyBB files and now you have hosting so lets jump forward and locate MySQL
Once you have found that quickly make the database.

[Image: 168aa213ebe1bf291141cac4fdd1f3c4.png]

Step 3

Locate File Manager and enter it, then locate public_html and enter there.
Once in click to upload files.

[Image: b5b68e0eb9cbb4dc054f6de09b01cf2e.png]

Upload the .zip file you have downloaded with MyBB and then extract it.


UPLOAD
[Image: 314c8dfabf2165597494e22070b78bd2.png]

Go back to the public_html and find the Upload folder.
[Image: 9337126e34091c8548d0376b2876d581.png]

Select all the files in the Upload folder then click "Move".
You now want to remove the highlighted part shown below and click the Tick.
[Image: 8f104f6cade08f7cceff9258404e87ae.png]

Step 4

Now the installation begins!
Go to your domain and it'll show the following.

[Image: 6ffa3d22ca8360e12a9e23ae4d400b14.png]

Go to domain/install

Step 5

You will now see this appear, if it shows up your doing well!

[Image: 5860dd52b85d59f61d9999aa361f2ae1.png]


Follow the onscreen instructions till you hit Database Configuration

[Image: b9d98d5095895601984ce3c5213e8b02.png]


Remember the Database you made? Now it goes into action!
So go gather those details if you didn't already have copied them down.
Fill it in nice and simple.

Step 6

Once you do the rest of the Database follow on with the set-up till you hit Board Configuration

[Image: 28d1291820aa75fdff214f50d1d2ac20.png]


Change the "Forum Name", "Website Name" and "Contact Email".

Step 7

Now create your Admin account and your basically done.

[Image: 22dce18c958631e3a6b8a4ddd984d597.png]

Step 8

Finish the Set-Up and your done!

[Image: aec26962a68644aedee5ecec044307d1.png]


Once it's done visit your forum and it should look like this: PREVIEW

How to install a theme (By Redcap)

$
0
0
Hello, today I'm going to show you how to install a theme in the simplest form I can. 

First find a theme suitable for MyBB 1.8, for this tutorial I will be using 'Revolution Gaming' by @iAndrew.

1) Download the theme, open the file & extract to a place you know; I'm going to extract it to 'Desktop'

[Image: 7Khg3Pg.png]

2) Once that is done, right click the images file which should be called 'revolution in this case.


[Image: oYstDp3.png]



And click 'Add to Archive', which should bring up:


[Image: CkoKuVR.png]



You should then see a 'zip' FOLDER: 


[Image: N2cAl4w.png]


3) Now it's time to move on to the cPanel part, so open you File Manager -> public_html -> your forum -> images and click 'upload'


[Image: gdgK6HZ.png]



Choose the file you 'zipped':


[Image: Ikzpee4.png]



and you should see:


[Image: l1uPwmI.png]



Click on it and click 'Extract' which should bring up:






[Image: Yi1DzY0.png]



4) After this your are done with cPanel, now open Admin CP of your forum: Template & Styles -> Import A Theme:


[Image: wJBk0W0.png]



Select 'Choose File' and choose the 'XML Document':


[Image: eAiMmRT.png]

Name your theme then choose Import Theme and there you are finished and you have it installed!


[Image: PX2GRlE.png]



I hope you like my tutorial, be sure to rate it!

Add icon For part mybb without plugin

$
0
0
Hello guys,

in this tutorial i will be show you how to add icon For Part mybb without plugin

Go > admincp > Templates & Style > Templates > Forum Bit Templates > forumbit_depth2_forum

Find this code

Code:
<td class="{$bgcolor}" align="center" valign="top" width="1"><span class="forum_status forum_{$lightbulb['folder']} ajax_mark_read" title="{$lightbulb['altonoff']}" id="mark_read_{$forum['fid']}"></span></td>

change to this

Code:
<td class="{$bgcolor}" align="center" valign="top" width="1"><img src="images/ficons/{$forum['fid']}.png" /></td>

And save it

then Go to your FTP & FileZilla > images > create new file > name of file ficon > and save

go to your forum you see the icon part all of them like this

[Image: 549b4f4ef4171.png]

Ok right click  on the icon > click Copy image url > paste anywhere > and you see number of part for example :

http://domain.com/images/ficons/2.png

it mean this part number ( 2 )

Ok then you have add icon

Go FTP & FileZilla > images > ficon > transfer your icon and rename to ( 2.png )

why number ( 2 ) ?

because you have number 2 in the part mybb

For another part like to this

enjoy

[HOWTO]SSL Gravatar Avatar

$
0
0
Hey Guys,

I know this is really simple but i thought i would post it just incase, if you have done it any other way please let me know.

If you want to make the Gravatar Avatars SSL you need to edit usercp.php in the forum ROOT directory.

Then,

On line 2161: "avatar" => "http://www.gravatar.com/avatar/{$email}{$s}.jpg"

Change this too: "avatar" => "https://www.gravatar.com/avatar/{$email}{$s}.jpg"

Also in admin/modules/user/users.php :

On line 647: "avatar" => "http://www.gravatar.com/avatar/{$email}{$s}"

Change this too: "avatar" => "https://www.gravatar.com/avatar/{$email}{$s}"


P.S: I think this may have to be done before people set there avatar as it may be stored in the DB, i will investigate this further.


This will then make the avatars get requested using https keeping that green padlock on your ssl secure sites Big Grin

Regards
AsynC

[VPS/Dedi] Set up a ramdisk file cache

$
0
0
Skills needed: Ability to work with the terminal.
Requirements: At least a bit of ram over and linux.

Information:
I recently moved my cache away from memcached as some/most times memcached would be the slowest thing to be ran, specially for bigger forums taking sometimes 200 ms to do its things.

I tested quite many cachehandlers (Including my own) and found that apc was ok, db was oh dear no, and files was quite good if sat up with a ramdisk.

So how to set it up "properly":
Step 1: Make the folder
Start by making a folder in the cache folder called "cache" so it's /MYBB_ROOT/cache/cache.

Why: Basically when you restart the files in the folder will be gone and cuz the themes are stored there it isn't really ideal.

Code:
mkdir /var/www/cache/cache


Step 2: Chmod
Simply chmod the folder thus php can write to it.

Step 3: Make the ramdisk
Open /etc/fstab with your favorite editor (I prefer nano) and append to its own line,

Code:
tmpfs /path/to/cache/cache tmpfs size=200m,mode=0775,uid=www-data,gid=www-data 0 0

Do note:
Change the "/path/to/cache/cache" to your path

200m to the amount of ram is should max be able to use, it will not use ram that isn't being used by the files thus even if you insert it as 200m if your files are just 13 MB it will not use the full 200 MB only 13 MB

www-data is PHP-FPM & nginx; apache might use different so use a bit of googling skills to find out what yours uses.

Step 4: Mount the ramdisk
As easy as running the following command,

Code:
mount -a

Step 5: Fixing the cachehandler
Open up /inc/cachehandlers/disk.php and replace every

Code:
MYBB_ROOT."/cache

With

Code:
MYBB_ROOT."/cache/cache


Step 6: Activating it

Open up /inc/config.php and find

Code:
$config['cache_store']

Set it to

Code:
$config['cache_store'] = 'files';

Step 7: Verifying that it works
  • Debug view
    • Go into the debug view of the index, showthreads etc (?debug)
    • If it keeps writing to the database (prefix_datacache) it's not correctly writing to the files
  • See if it has saved the cache to files
    • Simply just check the cache folder.

And you're done.

For a bit more advanced people who like to save space and stuff:
Step 1: Install what you need

Install igbinary

You can jump over this and replace the igbinary_ in the file.

Step 2: Enable it

Ehm pretty straight forward in their installation guide

Step 3: Install the cachehandler

You could either write it to a new file or use disk.php, I prefer making it short so disk.php it is.

Replace the disk.php file with:
PHP Code:
<?php
/**
 * MyBB 1.8
 * Copyright 2014 MyBB Group, All Rights Reserved
 *
 * Website: http://www.mybb.com
 * License: http://www.mybb.com/about/license
 *
 */

/**
 * Disk Cache Handler
 */
class diskCacheHandler
{
    
/**
     * Connect and initialize this handler.
     *
     * @return boolean True if successful, false on failure
     */
    
function connect($silent=false)
    {
        if(!@
is_writable(MYBB_ROOT."cache/cache"))
        {
            return 
false;
        }

        return 
true;
    }

    
/**
     * Retrieve an item from the cache.
     *
     * @param string The name of the cache
     * @param boolean True if we should do a hard refresh
     * @return mixed Cache data if successful, false if failure
     */

    
function fetch($name$hard_refresh=false)
    {
        if(!@
file_exists(MYBB_ROOT."/cache/cache/{$name}.php"))
        {
            return 
false;
        }

        return @
igbinary_unserialize(@file_get_contents(MYBB_ROOT."/cache/cache/{$name}.php"));
    }

    
/**
     * Write an item to the cache.
     *
     * @param string The name of the cache
     * @param mixed The data to write to the cache item
     * @return boolean True on success, false on failure
     */
    
function put($name$contents)
    {
        global 
$mybb;
        if(!
is_writable(MYBB_ROOT."cache/cache"))
        {
            
$mybb->trigger_generic_error("cache_no_write");
            return 
false;
        }

        
$cache_file fopen(MYBB_ROOT."/cache/cache/{$name}.php""w") or $mybb->trigger_generic_error("cache_no_write");
        
flock($cache_fileLOCK_EX);
        
fwrite($cache_fileigbinary_serialize($contents));
        
flock($cache_fileLOCK_UN);
        
fclose($cache_file);

        return 
true;
    }

    
/**
     * Delete a cache
     *
     * @param string The name of the cache
     * @return boolean True on success, false on failure
     */
    
function delete($name)
    {
        return @
unlink(MYBB_ROOT."/cache/cache/{$name}.php");
    }

    
/**
     * Disconnect from the cache
     */
    
function disconnect()
    {
        return 
true;
    }

    
/**
     * Select the size of the disk cache
     *
     * @param string The name of the cache
     * @return integer the size of the disk cache
     */
    
function size_of($name='')
    {
        if(
$name != '')
        {
            return @
filesize(MYBB_ROOT."/cache/cache/{$name}.php");
        }
        else
        {
            
$total 0;
            
$dir opendir(MYBB_ROOT."/cache/cache");
            while((
$file readdir($dir)) !== false)
            {
                if(
$file == "." || $file == ".." || $file == ".svn" || !is_file(MYBB_ROOT."/cache/cache/{$file}"))
                {
                    continue;
                }

                
$total += filesize(MYBB_ROOT."/cache/cache/{$file}");
            }
            return 
$total;
        }
    }


Step 4: Secure the folder

Anyone can read the files if you use this thus for nginx

Code:
location /cache/cache {
   deny all;
}

How to change mouse cursor in [MyBB]

$
0
0
Hello guys,

in this tutorial i will be show you how to change mouse cursor in MyBB

like this :





simple and nice

Go > admincp > Templates & Style > Your Theme > global.css >

Find body And Add this code in body

Code:
cursor: url(http://24work-new.googlecode.com/svn/trunk/24work-blogspot/mouse-cursor/live-demo/cur116.cur),progress;

Then Find ( a:hover, a:active )

Like This :

http://imgur.com/GsC4qq1

add this Code :

Code:
cursor: url(http://24work-new.googlecode.com/svn/trunk/24work-blogspot/mouse-cursor/live-demo/cur117.cur),default;

And save it

then go to you forum and look it

enjoy

---------------------------------------

For more style mouse cursor Follow this link :

http://24work.blogspot.com/2012/01/how-to-change-mouse-cursor-in-blogger.html

[Performance] Upgrading Tables To Innodb

$
0
0
This script will convert all your tables to the much better Innodb storage engine than MyISAM.  This is very helpful for larger forums with many users online.  If you do not have MySQL version 5.6 or higher you have three choices to make: 
1) Upgrade to MySQL 5.6 or higher ( you may need to contact your host for this. )
2) Keep Full Text Index searches and let the mybb_posts and mybb_threads tables stay as MyISAM
3) Drop the index on message for the mybb_posts table and the index subject on the mybb_threads table.

PHP Code:
<?php

define
("IN_MYBB"1);
define("NO_ONLINE"1);
define("NO_PLUGINS"1);
require_once 
"global.php";
if(!
$mybb->usergroup['cancp'])
{
error_no_permission();
}
$tablelist $db->list_tables($config['database']['database'], TABLE_PREFIX);
foreach(
$tablelist as $table)
{
$db->write_query("ALTER TABLE "  $table " ENGINE=Innodb");
echo 
"Converted table $table to Innodb.<br />";
}
echo 
"Table conversion complete.<br />";
?>

Once the file is executed, you should delete it off your server.

How to make a Trial Staff Group

$
0
0
Please do not comment anything negative on this, I just thought this would be a good idea for a usergroup, and these are the settings I thought would be good.

Do you want to hire some more moderators but need to earn the persons trust first?

Well here is a good usergroup to make to test moderators trust.

First, create a group called Trial Mod or Trial Staff or etc.

Then under the first tab you should set these settings:
[Image: db069605aff6447a8877913e6eb9872e.png]

Then go under Users and Permissions and go to Private Messaging and Make sure they are all selected (Optional)



Under Misc...
[Image: 5338d7ef4e68ccf5b1b563d1718e6085.png]


Then under Mod Cp, you can set the options you want, but these are my settings (I don't use birthdays on my forum):
[Image: eeb095a97f582142fd0b983c92adb7b5.png]




You can also use custom plugins if you want to set more permissions.


I hope you enjoyed this tutorial!

Forever and Ever (Time Spent Online)

$
0
0
(http://mybbhacks.zingaburga.com/showthread.php?tid=260)


You need this plugin ^

So people might wondering how Omni (HF owner) are available to have the

Time Spent Online: Forever and Ever

 feature on his profile. Well, I'm about to reveal the big secret. Angel

ACP>Templates>your theme(s) template>Member Templates edit the template "member_profile" and search for

Code:
<td class="trow2">{$timeonline}</td>


replace it with
Code:
<td class="trow2"><if $memprofile['uid'] == UIDHERE then>Forever and Ever<else>{$timeonline}</if></td>

UIDHERE = your uid.

Smile

Sound notification for DVZ Shoutbox 2.1.x

$
0
0
This slight addition allows you to add a sound notification for DVZ Shoutbox when a new message is posted, using its internal hooks system.



1. Open the attached file and upload the dvz_shoutbox.mp3 file to the images/ directory on your server

.zip   dvz_shoutbox.zip (Size: 1.27 KB / Downloads: 3)

2. Open the dvz_shoutbox template (Global Templates) and add the following code after {$javascript}
Code:
<script>
dvz_shoutbox.callbacks['update'].push(function(){
   if ($('#shoutbox .entry.new').length) {
       var audio = new Audio(rootpath + '/images/dvz_shoutbox.mp3');
       audio.volume = 0.2;
       audio.play();
   }
});
</script>

Round/Circle Avatar Pictures.

$
0
0
This tutorial will show you how to make your user's avatars round.

Screenshot:

[Image: 4947505225.png]


Step 1: Go to: Admin CP ---> Templates & Style ---> Click on the name of your theme. (By Default it should be Default or MyBB 1.8) ---> Add Stylesheet

File Name: Doesn't matter, just make sure you end it with .css

Attached to:
Globally

Then choose: Write my own content

Then write this code:


Code:
.post .post_author div.author_avatar img {
border-radius: 55%;
 transition:all 0.3s ease;
}

And now you are done.

If you want the avatars to become square when you hover your mouse cursor over them then add this code under the code you wrote above


Code:
.post .post_author div.author_avatar img:hover {
border-radius: 0%;
transition:all 0.3s ease;
}

If you don't like the smooth animation just remove transition:all 0.3s ease; in both of the codes.

Hoped this helped.  Smile

Title notification for DVZ Shoutbox 2.1.x

$
0
0
Based on Sound notification for DVZ Shoutbox 2.1.x, I've done a visual alert.

It uses jQuery Title Alert.


1. upload the jquery.titlealert.js file into jscripts/ directory on your server

.zip   jquery.titlealert.js.zip (Size: 1.94 KB / Downloads: 5)

2. Open the dvz_shoutbox template (Global Templates) and add the following code after {$javascript}
Code:
<script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/jquery.titlealert.js"></script>
<script>
dvz_shoutbox.callbacks['update'].push(function(){
  if ($('#shoutbox .entry.new').length) {
    $.titleAlert('Activity on ShoutCast', {requireBlur:true});
  }
});</script>

How to make a Sexy Login Page

$
0
0
So You Want a Cool Splash Page?


Alright, so this took me ages to figure out. And finally, I found a much less complex solution after all my complex hard work. So, here a few features for this version:

  • Forum installed on Root
  • You Don't Have to Make a PHP Page (Just a simple Template Edit)
  • Should work on every theme (Only tested on DarkBB 1.8 though)
  • Makes for a beautiful login effect! (See Demo)
There are a couple of things that I've noticed do not work using this method:

  • The setting to Force Users to Login before being to able to view the board needs to be disabled. (It didn't work on my board with it on, (probably because I was using a separate .php page to handle it), but I haven't tested it on a board using this version of the modification. If it works, please let me know!)
Alright, so first up, a preview of what we're going to make! You can view a demo of it here. Or you can look at this screenshot:

[Image: pQMf5fq.png]

That's right, we'll be making something sexy for your board! First things first, since this is just a template edit. Go to Admin CP -> Templates & Styles -> "Your_Theme" -> Member Templates -> Member Login

Now, once there replace everything in that box, with this: 


PHP Code:
<html>
<
head>
<
title>{$mybb->settings['bbname']} - {$lang->login}</title>
{
$headerinclude}
</
head>
<
body>
{
$headersplash}
{
$inline_errors}
{
$member_loggedin_notice}
 
 <center>
<
form action="member.php" method="post">
<
table border="0" cellspacing="35%" cellpadding="10" width="35%" class="form_splash" >
<
tr>
<
td class="thead" colspan="2"><strong>{$lang->login}</strong></td>
</
tr>
<
tr>
<
td class="trow1"><strong>{$lang->username}</strong></td>
<
td class="trow1"><input type="text" class="textbox" name="username" size="25" style="width: 200px;" value="{$username}/></td>
</
tr>
<
tr>
<
td class="trow2"><strong>{$lang->password}</strong><br /><span class="smalltext">{$lang->pw_note}</span></td>
<
td class="trow2"><input type="password" class="textbox" name="password" size="25" style="width: 200px;" value="{$password}/></td>
</
tr>
<
tr>
<
td class="trow1" colspan="2" align="center"><label title="{$lang->remember_me_desc}"> <center><a href="member.php?action=lostpw">{$lang->lostpw_note}</a><input type="submit" class="button" name="submit" value="{$lang->login}/>
<
input type="hidden" name="action" value="do_login" />
<
input type="hidden" name="url" value="{$redirect_url}/>&nbsp; | &nbsp;<input type="checkbox" class="checkbox" name="remember" checked="checked" value="yes" /> {$lang->remember_me}</label></center></td>
</
tr>
{
$captcha}
</
table>
<
br />
</
form>
 
 </center>
 
 <br />
 
 <br />
 
 <div class="lower">
        <
div class="wrapper">
            <
span id="current_time">{$lang->welcome_current_time}</span>
 
         <br />
            <
span id="copyright">
                <!-- 
MyBB is free software developed and maintained by a volunteer community.
                    
It would be much appreciated by the MyBB Group if you left the full copyright and "powered by" notice intact,
                    
to show your support for MyBB If you choose to remove or modify the copyright below,
                    
you may be refused support on the MyBB Community Forums.

                    
This is free softwaresupport us and we'll support you. -->
                {$lang->powered_by} <a href="http://www.mybb.com" target="_blank">MyBB{$mybbversion}</a>, &copy; 2002-{$copy_year} <a href="http://www.mybb.com" target="_blank">MyBB Group</a>.  
                <!-- End powered by -->
            </span><br><strong>Designed and Coded by: </strong>
<a href="http://community.mybb.com/user-86917.html" rel="nofollow">DevilKing</a> | Customized by Fireworks!<br />
        </div>
    </div>
  <!-- The following piece of code allows MyBB to run scheduled tasks. DO NOT REMOVE -->{$task_image}<!-- End task image code -->
{$auto_dst_detection}
</body>
</html> 

Next, you need to make one template. (I called mine "header_splash") (If you don't know how to do this the thread is here.) This way, you don't mess up the default board and end up with something weird! 

Once you've made the "header_splash" template. Copy & Paste the following code in it:

PHP Code:
<div id="container">
        <
div id="header">
            <
div id="logo">
                <
div class="wrapper">
                    <
a href="{$mybb->settings['bburl']}/index.php"><img src="{$theme['logo']}alt="{$mybb->settings['bbname']}title="{$mybb->settings['bbname']}/></a>
                </
div>
            </
div>
 
                 </div>
 
         </div>


<
br /> 

If you want added Cool Factor you can make the page fade in as well as hide the scroll bar! Put this code right above the above code: (I'll upload the two Jscripts as an attachment.)

PHP Code:
<style type="text/css">
body {
 
   overflow:auto;
}
</
style>
<
script type="text/javascript" src="jscripts/firework.js"></script>
<script type="text/javascript" src="jscripts/query-1.4.2.min.js"></script><style type="text/css"></style><style type="text/css"></style>
<script type="text/javascript">
            
            $(document).ready(function() {
                
                $('body').hide().fadeIn(3000);
                
            });
            
        </script> 

Awesome! Now we need to make sure we have our CSS in Order! In Templates & Styles -> "Your Theme" -> global.css, find: 

PHP Code:
form {
margin0;
padding0;

And replace with: 
PHP Code:
form {
 
 margin0;
padding0;
  width35%;
  margin-leftauto;
  margin-rightauto;


Next up, we have a few more Styling modifications. All of these are under the Templates -> Members Templates, so just find the file and replace it.

First, we have member_register, replace it with this:

PHP Code:
<html>
<
head>
<
title>{$mybb->settings['bbname']} - {$lang->registration}</title>
{
$headerinclude}
<
script src="{$mybb->asset_url}/jscripts/validate/jquery.validate.min.js"></script>
</head>
<body>
{$headersplash}
<form action="member.php" method="post" id="registration_form"><input type="text" style="visibility: hidden;" value="" name="regcheck1" /><input type="text" style="visibility: hidden;" value="true" name="regcheck2" />
{$regerrors}
<table border="0" cellspacing="35%" cellpadding="10" width="35%" class="form_splash">
<tr>
<td class="thead" colspan="2"><strong>{$lang->registration}</strong></td>
</tr>
<tr>
<td width="50%" class="trow1" valign="top">
<fieldset class="trow2">
<legend><strong>{$lang->account_details}</strong></legend>
<table cellspacing="0" cellpadding="{$theme['tablespace']}" width="100%">
<tr>
<td colspan="2"><span class="smalltext"><label for="username">{$lang->username}</label></span></td>
</tr>
<tr>
<td colspan="2"><input type="text" class="textbox" name="username" id="username" style="width: 100%" value="{$username}" /></td>
</tr>
{$passboxes}
<tr>
<td width="50%" valign="top"><span class="smalltext"><label for="email">{$lang->email}</label></span></td>
<td width="50%" valign="top"><span class="smalltext"><label for="email2">{$lang->confirm_email}</label></span></td>
</tr>
<tr>
<td width="50%" valign="top"><input type="text" class="textbox" name="email" id="email" style="width: 100%" maxlength="50" value="{$email}" /></td>
<td width="50%" valign="top"><input type="text" class="textbox" name="email2" id="email2" style="width: 100%" maxlength="50" value="{$email2}" /></td>
</tr>
<tr>
    <td colspan="2" style="display: none;" id="email_status">&nbsp;</td>
</tr>
{$hiddencaptcha}
</table>
</fieldset>
{$requiredfields}
{$customfields}
{$referrer}
{$regimage}
{$questionbox}
</td>
<td width="50%" class="trow1" valign="top">
<fieldset class="trow2">
<legend><strong>{$lang->account_prefs}</strong></legend>
<table cellspacing="0" cellpadding="{$theme['tablespace']}" width="100%">
<tr>
<td valign="top" width="1"><input type="checkbox" class="checkbox" name="allownotices" id="allownotices" value="1" {$allownoticescheck} /></td>
<td valign="top"><span class="smalltext"><label for="allownotices">{$lang->allow_notices}</label></span></td>
</tr>
<tr>
<td valign="top" width="1"><input type="checkbox" class="checkbox" name="hideemail" id="hideemail" value="1" {$hideemailcheck} /></td>
<td valign="top"><span class="smalltext"><label for="hideemail">{$lang->hide_email}</label></span></td>
</tr>
<tr>
<td valign="top" width="1"><input type="checkbox" class="checkbox" name="receivepms" id="receivepms" value="1" {$receivepmscheck} /></td>
<td valign="top"><span class="smalltext"><label for="receivepms">{$lang->receive_pms}</label></span></td>
</tr>
<tr>
<td valign="top" width="1"><input type="checkbox" class="checkbox" name="pmnotice" id="pmnotice" value="1"{$pmnoticecheck} /></td>
<td valign="top"><span class="smalltext"><label for="pmnotice">{$lang->pm_notice}</label></span></td>
</tr>
<tr>
<td valign="top" width="1"><input type="checkbox" class="checkbox" name="pmnotify" id="pmnotify" value="1" {$pmnotifycheck} /></td>
<td valign="top"><span class="smalltext"><label for="pmnotify">{$lang->email_notify_newpm}</label></span></td>
</tr>
<tr>
<td valign="top" width="1"><input type="checkbox" class="checkbox" name="invisible" id="invisible" value="1" {$invisiblecheck} /></td>
<td valign="top"><span class="smalltext"><label for="invisible">{$lang->invisible_mode}</label></span></td>
</tr>
<tr>
<td colspan="2"><span class="smalltext"><label for="subscriptionmethod">{$lang->subscription_method}</label></span></td>
</tr>
<tr>
<td colspan="2">
    <select name="subscriptionmethod" id="subscriptionmethod">
        <option value="0" {$no_auto_subscribe_selected}>{$lang->no_auto_subscribe}</option>
        <option value="1" {$no_subscribe_selected}>{$lang->no_subscribe}</option>
        <option value="2" {$instant_email_subscribe_selected}>{$lang->instant_email_subscribe}</option>
        <option value="3" {$instant_pm_subscribe_selected}>{$lang->instant_pm_subscribe}</option>
    </select>
</td>
</tr>
</table>
</fieldset>
<br />
<fieldset class="trow2">
<legend><strong><label for="timezone">{$lang->time_offset}</label></strong></legend>
<table cellspacing="0" cellpadding="{$theme['tablespace']}" width="100%">
<tr>
<td><span class="smalltext">{$lang->time_offset_desc}</span></td>
</tr>
<tr>
<td>{$tzselect}</td>
</tr>
<tr>
<td><span class="smalltext">{$lang->dst_correction}</span></td>
</tr>
<tr>
<td>
    <select name="dstcorrection">
        <option value="2" {$dst_auto_selected}>{$lang->dst_correction_auto}</option>
        <option value="1" {$dst_enabled_selected}>{$lang->dst_correction_enabled}</option>
        <option value="0" {$dst_disabled_selected}>{$lang->dst_correction_disabled}</option>
    </select>
</td>
</tr>
</table>
</fieldset>
{$boardlanguage}
</td>
</tr>
</table>
<br />
<div align="center">
<input type="hidden" name="regtime" value="{$time}" />
<input type="hidden" name="step" value="registration" />
<input type="hidden" name="action" value="do_register" />
<input type="submit" class="button" name="regsubmit" value="{$lang->submit_registration}" />
</div>
</form>
<script type="text/javascript">
<!--
$().ready(function() {
    // validate registration_form
    $("#registration_form").validate({
        rules: {
          username: {
            required: true,
            minlength: {$mybb->settings['minnamelength']},
            maxlength: {$mybb->settings['maxnamelength']},
            remote:{
                url: "xmlhttp.php?action=username_availability",
                type: "post",
                  dataType: "json",
                data:
                {
                    my_post_key: my_post_key
                },
            },
          },
          email: {
                required: true,
                email: true,
          },
          email2: {
                required: true,
                email: true,
                equalTo: "#email"
          },
        },
        messages: {
            username: {
                      minlength: "{$lang->js_validator_username_length}",
                      maxlength: "{$lang->js_validator_username_length}",
            },
              email: "{$lang->js_validator_invalid_email}",
            email2: "{$lang->js_validator_email_match}",
        }
    });

   {$validator_extra}
});
// -->
</script>
</body>
</html> 

Next up, is member_registration_agreement, Replace with:

PHP Code:
<html>
<
head>
<
title>{$mybb->settings['bbname']} - {$lang->agreement}</title>
{
$headerinclude}
</
head>
<
body>
{
$headersplash}
<
br />
 
 <center>
<
form action="member.php" method="post" width="35%" margin-left:"auto" margin-right:"auto">
<
table border="0" cellspacing="35%" cellpadding="10" width="35%" class="form_splash">
<
tr>
<
td class="thead"><strong>{$mybb->settings['bbname']} - {$lang->agreement}</strong></td>
</
tr>
{
$coppa_agreement}
<
tr>
<
td class="trow1">
<
p>{$lang->agreement_1}</p>
<
p>{$lang->agreement_2}</p>
<
p>{$lang->agreement_3}</p>
<
p>{$lang->agreement_4}</p>
<
p><strong>{$lang->agreement_5}</strong></p>
</
td>
</
tr>
</
table>

<
br />
<
div align="center">
<
input type="hidden" name="step" value="agreement" />
<
input type="hidden" name="action" value="register" />
<
input type="submit" class="button" name="agree" value="{$lang->i_agree}/>
</
div>
</
form>
 
   <center>
 
     <br />
</
body>
</
html

After that, we have member_resetpassword, replace with:

PHP Code:
<html>
<
head>
<
title>{$mybb->settings['bbname']} - {$lang->reset_password}</title>
{
$headerinclude}
</
head>
<
body>
{
$headersplash}
<
br />
 
 <center>
<
form action="member.php" method="post">
<
table border="0" cellspacing="35%" cellpadding="10" width="35%" class="form_splash">
<
tr>
<
td class="thead" colspan="2"><strong>{$lang->reset_password}</strong></td>
</
tr>
<
tr>
<
td class="trow1" width="30%"><strong>{$lang_username}</strong></td>
<
td class="trow1"><input type="text" class="textbox" name="username" value="{$user['username']}/></td>
</
tr>
<
tr>
<
td class="trow1" width="30%"><strong>{$lang->activation_code}</strong></td>
<
td class="trow1"><input type="text" class="textbox" name="code" value="{$code}/></td>
</
tr>
</
table>
<
br />
<
div align="center"><input type="hidden" name="action" value="resetpassword" /><input type="submit" class="button" name="regsubmit" value="{$lang->send_password}/></div>
 
 </center>
</
form>
</
body>
</
html

Next we have, member_lostpw, replace all with:

PHP Code:
<html>
<
head>
<
title>{$mybb->settings['bbname']} - {$lang->lost_pw}</title>
{
$headerinclude}
</
head>
<
body>
{
$headersplash}
 
 <center>
<
form action="member.php" method="post">
<
table border="0" cellspacing="35%" cellpadding="10" width="35%" class="form_splash">
<
tr>
<
td class="thead" colspan="2"><strong>{$lang->lost_pw_form}</strong></td>
</
tr>
<
tr>
<
td class="trow1" width="40%"><strong>{$lang->email_address}</strong></td>
<
td class="trow1" width="60%"><input type="text" class="textbox" name="email" /></td>
</
tr>
</
table>
<
br />
<
div align="center"><input type="submit" class="button" value="{$lang->request_user_pass}/></div>
<
input type="hidden" name="action" value="do_lostpw" />
</
form>
 
 </center>
</
body>
</
html

Next up we have member_resendactivation, paste & replace: 

PHP Code:
<html>
<
head>
<
title>{$mybb->settings['bbname']} - {$lang->resend_activation}</title>
{
$headerinclude}
</
head>
<
body>
{
$headersplash}
 
 <center>
<
form action="member.php" method="post">
<
table border="0" cellspacing="35%" cellpadding="10" width="35%" class="form_splash">
<
tr>
<
td class="thead" colspan="2"><strong>{$lang->resend_activation}</strong></td>
</
tr>
<
tr>
<
td class="trow1" width="40%"><strong>{$lang->email_address}</strong></td>
<
td class="trow1" width="60%"><input type="text" class="textbox" name="email" /></td>
</
tr>
</
table>
<
br />
<
div align="center"><input type="submit" class="button" value="{$lang->request_activation}/></div>
<
input type="hidden" name="action" value="do_resendactivation" />
</
form>
 
 </center>
</
body>
</
html

And, that should be it! You're done! Happy Themeing! (This is just a simple version. The one in the demo is hardcoded into a different php page, with custom templates as well as changed lines in the following files:

  • member.php
  • global.php

Below is the original Member_login Template, in case something doesn't go right. (Since I only tested it on my one theme.)


PHP Code:
<html>
<
head>
<
title>{$mybb->settings['bbname']} - {$lang->login}</title>
{
$headerinclude}
</
head>
<
body>

<
br />
{
$inline_errors}
{
$member_loggedin_notice}
<
form action="member.php" method="post">
<
table border="0" cellspacing="{$theme['borderwidth']}cellpadding="{$theme['tablespace']}class="tborder">
<
tr>
<
td class="thead" colspan="2"><strong>{$lang->login}</strong></td>
</
tr>
<
tr>
<
td class="trow1"><strong>{$lang->username}</strong></td>
<
td class="trow1"><input type="text" class="textbox" name="username" size="25" style="width: 200px;" value="{$username}/></td>
</
tr>
<
tr>
<
td class="trow2"><strong>{$lang->password}</strong><br /><span class="smalltext">{$lang->pw_note}</span></td>
<
td class="trow2"><input type="password" class="textbox" name="password" size="25" style="width: 200px;" value="{$password}/> (<a href="member.php?action=lostpw">{$lang->lostpw_note}</a>)</td>
</
tr>
<
tr>
<
td class="trow1" colspan="2" align="center"><label title="{$lang->remember_me_desc}"><input type="checkbox" class="checkbox" name="remember" checked="checked" value="yes" /> {$lang->remember_me}</label></td>
</
tr>
{
$captcha}
</
table>
<
br />
<
div align="center"><input type="submit" class="button" name="submit" value="{$lang->login}/></div>
<
input type="hidden" name="action" value="do_login" />
<
input type="hidden" name="url" value="{$redirect_url}/>
</
form>

</
body>
</
html

5 Tutorials in one thread!

$
0
0
----------------------
5 Simple tutorials that relate to MyBB.
----------------------


Show Groups

Firstly create a new file in your root folder named 'showgroups.php'
Edit the file and add the following code and save it.

Code:
<?php 

define('IN_MYBB', 1); require "./global.php";

add_breadcrumb("Custom Usergroups", "showgroups.php"); 

eval("\$html = \"".$templates->get("showgroups")."\";"); 

output_page($html);

?>

Now go to your Admin Control Panel > Themes > Templates > Global Templates > and add a new template titled 'showgroups'.
In that template add the following code and save it.

Code:
</style>
<html>
<head>
<title>Current Usergroups</title>
{$headerinclude}
</head>
<body>
{$header}
<table border="0" cellspacing="1" cellpadding="4" class="tborder">
<tr>
<td class="thead"><span class="smalltext"><strong>Current Custom Usergroups</strong></span></td>
</tr>
<tr>
<td class="trow1">

<div style="width: 48%; min-height:120px; border: 1px #0E8104 solid; margin: 4px; padding: 2px; border-radius: 5px; float:left;">
    <table width="100%" cellspacing="0" cellpadding="5" border="0">
    <tr class="trow1">
    <td width="75%" border="0">
    <span><b>Usergroup</b></span><br />
    <span class="smalltext"><b>Leaders: </b>
     <a href="profile.php"><span style="color: white;">Add username(s) here</span></a><br /><a href="usercp.php?action=usergroups&amp;joingroup=8&my_post_key={$mybb->post_code}">(Join Group)</a><br /><br />Description.</span>
    </td>
    <td width="25%" align="right" valign="middle">   
    <img src="http://resources.mybb.com/images/badges/oct_13/support.png" /><br />
    </td>
    </tr>
    </table>
    </div>
<div style="width: 48%; min-height:120px; border: 1px #0E8104 solid; margin: 4px; padding: 2px; border-radius: 5px; float:left;">
    <table width="100%" cellspacing="0" cellpadding="5" border="0">
    <tr class="trow1">
    <td width="75%" border="0">
    <span><b>Usergroup</b></span><br />
    <span class="smalltext"><b>Leaders: </b>
     <a href="profile.php"><span style="color: white;">Add username(s) here</span></a><br /><a href="usercp.php?action=usergroups&amp;joingroup=8&my_post_key={$mybb->post_code}">(Join Group)</a><br /><br />Description.</span>
    </td>
    <td width="25%" align="right" valign="middle">   
    <img src="http://resources.mybb.com/images/badges/oct_13/support.png" /><br />
    </td>
    </tr>
    </table>
    </div>
<br>
<div style="width: 48%; min-height:120px; border: 1px #0E8104 solid; margin: 4px; padding: 2px; border-radius: 5px; float:left;">
    <table width="100%" cellspacing="0" cellpadding="5" border="0">
    <tr class="trow1">
    <td width="75%" border="0">
    <span><b>Usergroup</b></span><br />
    <span class="smalltext"><b>Leaders: </b>
     <a href="profile.php"><span style="color: white;">Add username(s) here</span></a><br /><a href="usercp.php?action=usergroups&amp;joingroup=8&my_post_key={$mybb->post_code}">(Join Group)</a><br /><br />Description.</span>
    </td>
    <td width="25%" align="right" valign="middle">   
    <img src="http://resources.mybb.com/images/badges/oct_13/support.png" /><br />
    </td>
    </tr>
    </table>
    </div>
<div style="width: 48%; min-height:120px; border: 1px #0E8104 solid; margin: 4px; padding: 2px; border-radius: 5px; float:left;">
    <table width="100%" cellspacing="0" cellpadding="5" border="0">
    <tr class="trow1">
    <td width="75%" border="0">
    <span><b>Usergroup</b></span><br />
    <span class="smalltext"><b>Leaders: </b>
     <a href="profile.php"><span style="color: white;">Add username(s) here</span></a><br /><a href="usercp.php?action=usergroups&amp;joingroup=8&my_post_key={$mybb->post_code}">(Join Group)</a><br /><br />Description.</span>
    </td>
    <td width="25%" align="right" valign="middle">   
    <img src="http://resources.mybb.com/images/badges/oct_13/support.png" /><br />
    </td>
    </tr>
    </table>
    </div>
<br>
<div style="width: 48%; min-height:120px; border: 1px #0E8104 solid; margin: 4px; padding: 2px; border-radius: 5px; float:left;">
    <table width="100%" cellspacing="0" cellpadding="5" border="0">
    <tr class="trow1">
    <td width="75%" border="0">
    <span><b>Usergroup</b></span><br />
    <span class="smalltext"><b>Leaders: </b>
     <a href="profile.php"><span style="color: white;">Add username(s) here</span></a><br /><a href="usercp.php?action=usergroups&amp;joingroup=8&my_post_key={$mybb->post_code}">(Join Group)</a><br /><br />Description.</span>
    </td>
    <td width="25%" align="right" valign="middle">   
    <img src="http://resources.mybb.com/images/badges/oct_13/support.png" /><br />
    </td>
    </tr>
    </table>
    </div>
<div style="width: 48%; min-height:120px; border: 1px #0E8104 solid; margin: 4px; padding: 2px; border-radius: 5px; float:left;">
    <table width="100%" cellspacing="0" cellpadding="5" border="0">
    <tr class="trow1">
    <td width="75%" border="0">
    <span><b>Usergroup</b></span><br />
    <span class="smalltext"><b>Leaders: </b>
     <a href="profile.php"><span style="color: white;">Add username(s) here</span></a><br /><a href="usercp.php?action=usergroups&amp;joingroup=8&my_post_key={$mybb->post_code}">(Join Group)</a><br /><br />Description.</span>
    </td>
    <td width="25%" align="right" valign="middle">   
    <img src="http://resources.mybb.com/images/badges/oct_13/support.png" /><br />
    </td>
    </tr>
    </table>
    </div>
<br>
</td></tr></table>
{$footer}
</body>
</html>

Then you can edit the code to the appropriate images, users and so on for each of your groups.


Upgrading Files from 1.6 to 1.8

We'll use Labrocca's Tabbed Menu from MyBBCentral.com for this tutorial.
Locate the following file, I'll be showing this example as from a cpanel. public_html/inc/plugins/ficons.php
Note: ficons.php will be whatever file you need updated!

Edit the file and find compatibility and change it from 16* to 18*

On 1.6 (before)
[Image: 45d66c9ba235e256e1e04f6e3590611b.png]

On 1.8 (after)
[Image: 5fa7ca90893e3cff69129170149ec739.png]

Save the file and check in the ACP to make sure it's working.

Still not working?
In the case it doesn't edit all the files related to that plugin and add 18*.
Then it should work, I'll admit I had to do it with a few plugins.


Alert AdBlock users about adblock extension

This short method will tell members using AdBlock to deactivate the extension in their browser.
Go to the Admin Control Panel > Themes > Templates > Theme Name > Header > Select who views it.
And then put this code in and save it.

Code:
<div class="YOUR_CLASS">Alerts!&nbsp;</div> // - You can remove this
<script>
(function() {
    var message = "Your Message to AdBlock Users!";
    var tryMessage = function() {
            setTimeout(function() {
                if(!document.getElementsByClassName) return;
                var ads = document.getElementsByClassName('YOUR_CLASS'),
                    ad  = ads[ads.length - 1];
  if(!ad
                    || ad.innerHTML.length == 0
                    || ad.clientHeight === 0) {
                    alert(message);
                 //window.location.href = 'http://comunidade.bf4brasil.com.br/member.php?action=register'; "//"  Redirect users to where you want - You need to remove "//"
                } else {
                    ad.style.display = 'none';
                }

            }, 1800);
        }
        if(window.addEventListener) {
            window.addEventListener('load', tryMessage, false);
        } else {
            window.attachEvent('onload', tryMessage);
        }
})();
</script>


Limit Signature Image Size in kilobyte


Go to your Root > Inc > Plugins > create a file named 'limitsign.php' and save it.
Then edit that file and add the following code.

Code:
<?php 
// Disallow direct access to this file for security reasons
if(!defined("IN_MYBB"))
{
    die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}

// Plugin info
function limitsign_info ()
{
    return array(
        "name"            => "limitsign",
        "description"    => "limitsign",
        "website"        => "limitsign",
        "author"        => "limitsign",
        "authorsite"    => "limitsign",
        "version"        => "limitsign",
        "guid"             => "limitsign",
        "compatibility" => "16*"
    );
}

$plugins->add_hook('usercp_start', 'signsize');
function signsize()
{
    global $mybb, $error;

    preg_match_all("/\[img(.*?)\](.*?)\[\/img\]/i", $mybb->input['signature'], $matches, PREG_SET_ORDER);

    $kbsizetot = 0;
    
    foreach ($matches as $img)
    {
    $kbsize = strlen(@file_get_contents($img[2]));
    $kbsizetot += $kbsize;
    }
    
    if (($kbsizetot > 350000) && ($mybb->input['action'] == "do_editsig")) {

    $error = inline_error("The sum of the size of the images exceeds the allowed limit of 350kb.");

    }    
}
?>

Change the value (currently 350000) to whatever you want it to be.
Additionally enter the error message you want and then save it.


Usergroups legend without using plugins


To begin with go to this template: Admin Control Panel > Templates & Style > Templates > theme of choice > Index Page Templates > index_boardstats.
Find {$whosonline} and replace with the following but filled in with your groups.

Code:
<tr>
<td class="tcat"><span class="smalltext"><strong>Usergroup Legend</strong></span></td>
</tr>
<tr>
<td class="trow1"><span class="smalltext">ADD YOUR USERGROUPS HERE</span></td>
</tr>

If you are having issues with whos online, readd the code for it which is > {$whosonline}

OUGC Sub-forums in Columns

$
0
0
The following will convert this:
[Image: pLeYAaC.png]

Into this:
[Image: OEG5uVN.png]

Template Edits
  • forumbit_subforums
    Find:
    Code:
    {$lang->subforums}
    Add After:
    Code:
    <br class="clear" />
  • forumbit_depth3
    Replace:
    Code:
    <li class="subforum_columns_{$forum['disporder']}">{$statusicon}<a href="{$forum_url}" title="{$forum_viewers_text_plain}">{$forum['name']}</a></li>
    (Basically wrapping with an LI tag and removing the comma.)

Core Edits
./inc/functions_forumlist.php
  • Find:
    PHP Code:
        foreach($fcache[$pid] as $parent)
        { 
    Replace:
    PHP Code:
        static $subforums_count null;
        foreach(
    $fcache[$pid] as $parent)
        {
            
    $subforums_count null
  • Find:
    PHP Code:
                        eval("\$forum_list .= \"".$templates->get("forumbit_depth3"10)."\";"); 
    Replace:
    PHP Code:
                        eval("\$column_list .= \"".$templates->get("forumbit_depth3"10)."\";");

                        isset(
    $subforums_count) or $subforums_count subforums_count($fcache[$pid]);

                        
    $column_count = (int)$donecount+1;
                        
    $build_subcolumns false;

                        if(
    $column_count == || $column_count == $subforums_count && $subforums_count 3)
                        {
                            if(
    $column_count == 0)
                            {
                                
    $subforums_count -= 3;
                            }
                            else
                            {
                                
    $subforums_count -= $subforums_count;
                            }

                            
    $build_subcolumns true;
                        }

                        if(
    $build_subcolumns)
                        {
                            
    $forum_list .= "<ul style=\"list-style: none; margin: 0; float:left;\">{$column_list}</ul>";
                            
    $column_list '';
                        } 

Patches import XML file:
Code:
https://www.dropbox.com/s/vbbohn1cu09pgmt/OUGC%20Sub-forums%20in%20Columns%20-%20Patches.xml?dl=0

Require users to agree that this is the best section for their topic

$
0
0
This modification will require users to agree that the believe this forum is the best section for their topic.

1. Go to the newthread template and find:

Code:
<td class="trow2">{$prefixselect}<input type="text" class="textbox" name="subject" size="40" maxlength="85" value="{$subject}" tabindex="1" /></td>

2. Replace it with this:

Code:
<td class="trow2">{$prefixselect}<input type="text" class="textbox" name="subject" size="40" maxlength="85" value="{$subject}" tabindex="1" /><input type="checkbox" class="input_control"  value="subject" /><strong>I believe {$forum['name']} is the best section for this topic.</strong></td>

3. Insert this at the end right before </body>:

Code:
<script type="text/javascript">
$(document).ready(function () {
       $('.input_control').change(function () {
           $('input[name=' + this.value + ']')[0].disabled = !this.checked;
       }).change();
    });
</script>
<style type="text/css">
    input.textbox:disabled {
        background: #DDD;
       }
</style>

4. All done! Smile


.png   DSCj8qC.png (Size: 7.21 KB / Downloads: 53)

.png   xUN45rA.png (Size: 7.18 KB / Downloads: 61)

How to remove /cpanel/ and :2082

$
0
0
Most users have a problem with /cpanel/ and :2082 on their url and that could be a security risk to the site if some one looks for the login. But here is how to remove /cpanel/ and :2082!

Step 1: Sign into cloudflare.

Step 2: Go to your website, click the gear icon, and select page rules.

Step 3: Put yourdomain.com/cpanel/ in the big box at the top. Then turn on forwarding. Put any domain you want there that is not /cpanel/ or :2082 (duh)

Step 4: Do the same thing for :2082

Step 5: Add both page rules.

Now yourdomain.com/cpanel/ and :2082 no longer exist!
Viewing all 685 articles
Browse latest View live