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

Removing Javascript Conflicts & Simple jQuery Tweaks

$
0
0
Certain people prefer to have custom javascripts in their forum. Due to certain so called SYNTAX errors javascript conflicts occur.

How do i find a conflict?
In mybb, simple indications of a conflict are:
  • EDIT Button not working
  • MultiQuote not working
  • MyBB Editor does not appear. [editor.js]
  • Your other jQuery based scripts don't work

These can be solved by:

1. Using jQuery.noConflict();
If you are using jQuery in your forum, a conflict arising can be solved by adding:

Code:
<script type=text/javascript">jQuery.noConflict();</script>

just below where you put jQuery.

Example:
Code:
<script type="text/javascript" src="http://xxx/jquery-1.8.0.min.js"></script>
<script type="text/javascript">jQuery.noConflict();</script>

2. Using the latest jQuery:

Certain scripts are their that require a higher jQuery version than the one you use. This may also result in undesirable output, conflicts, etc.

You can get the latest version can be obtained from http://jquery.com

You can also use jQuery's MediaTemple CDN hosted jQuery.

Code:
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.1.1.min.js"></script>

3. Using the latest version of ProToType.js

MyBB's current Prototype version is 1.6.0.0. You should replace it with the latest one.

To do so, head over to your theme's templates, open UNGROUPED templates -> headerinclude

Find the url to prototype.js.

It should look like:

Code:
http://community.mybb.com/jscripts/prototype.js?ver=1600

Replace it with:

Code:
http://ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/prototype.js

4. Fixing Javascripts call based on jQuery:

If you are using too many many javascripts, then also it is possible that some of them don't work even after you do the above steps.

To fix this, find the jQuery call, looks like:

Code:
<script type="text/javascript">
$(document).ready(function($){
});
</script>

You can fix it by changing the '$' sign with 'jQuery'

The above code would become:

Code:
<script type="text/javascript">
jQuery(document).ready(function(){
});
</script>

=========================================

That's all Smile If you experience any other error or my post has got some wrong info/error in codes you can reply here any time Smile

=========================================

.Htaccess Protect the Admin Directory

$
0
0
I couldn't find any tutorial for this, and I thought it might help some who want extra protection for their forum.

Warning: You will have to give this password to all of your admins and they will, in a sense, have to login twice in order to get into the admin interface. This means they will have to remember a second password. If you are okay with this and want the extra protection, by all means, go ahead. If you don't want this, do not follow this tutorial.

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

This is a step by step process. Please follow the steps accordingly and carefully. This is mainly targeted towards users who are using non-cpanel control panels or who are not using shard hosting and have setup a apache2 and php server. Guide for cpanel below.

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

Step 1: Go to http://tools.dynamicdrive.com/password/

Step 2: Enter in the usernames in the first box (on the left). After each username, press enter (line-break).

Step 3: Enter each password in the same line on the box on the right. The username and password must match up.

Step 4: Enter the server's web root directory. You can find this in CPanel (see image below) or you will know this when setting up a server with apache (httpd) and php. For example, /home/mysite/mybb or /home/mysite/

[Image: cpanel-home-directory.jpg]

If you use CPanel, you can also do this easier and automatically (automagically Smile)
I will show this at the bottom.

Step 5: Take the generate code for .htaccess and add it to your /admin directory .htaccess.

Step 6: Copy the generated code for the .htpasswd file and paste it into a new file under the web root directory you specified earlier.

Step 7: Optional: In order to add more usernames and passwords, simply follow steps 2 and 3 and append (add to the end of the file) the new generated lines into your .htpasswd file.

If you need any help, please post below...

Extra Notes:
  • You may place the .htpasswd in the same directory .htaccess, but this is not recommended and secure.


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

If you use CPanel and want to have this done automatically, use the following guide by Paul H
http://community.mybb.com/thread-109975.html

Adding Collapse Buttons to Any Table

$
0
0
Today we will learn how to add MyBB's collapse buttons to any table. Interesting? Well, its easy too.
Lets see how it can be done.

The default table code structure of MyBB is something like this:

<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td class="thead"><strong>Title of the Table</strong></td>
</tr>
<tr>
<td class="trow1"> The first content row. </td>
</tr>
<tr>
<td class="trow2"> The second content row. </td>
</tr>
</table>


Now we will insert the collapse button code to show in title bar (.thead). Code for this is:
<div class="expcolimage"><img src="{$theme['imgdir']}/collapse.gif" id="unique_id_img" class="expander" alt="[-]" title="[-]" /></div>

Note that:
1. The red text part ID of the collapse button must be unique and not be repeated.
2. The ID must have the word "_img" at the end of it.

As we want to show the collapse button in out title bar, we will place the code Just after the title, within the thead class.

Code:
<td class="thead"><strong>Title of the Table</strong>
      <div class="expcolimage"><img src="{$theme['imgdir']}/collapse.gif" id="unique_id_img" class="expander" alt="[-]" title="[-]" /></div>
</td>

Now we will bind the area with tbody reffering the same red unique text and instead of '_img' we have to place '_e' now.

Code:
<tbody id="unique_id_e">
Content to collapse ...
</tbody>

So, we will combine the code this way, its colored, explanatory:

<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td class="thead"><strong>Title of the Table</strong>
<div class="expcolimage"><img src="{$theme['imgdir']}/collapse.gif" id="unique_id_img" class="expander" alt="[-]" title="[-]" /></div>
</td>
</tr>
<tbody id="unique_id_e">
<tr>
<td class="trow1"> The first content row. </td>
</tr>
<tr>
<td class="trow2"> The second content row. </td>
</tr>
</tbody>
</table>


>> Blue text is newly added code.
>> Red is the unique ID, don't repeat the ID if you are applying it in multiple tables, else : you will click to collapse in earth and the content will collapse in Jupiter Big Grin

[Image: 8gppzg0.png]

Thats it. Happy coding.

Basic CSS Variables in PHP

$
0
0
This offers a shorthand way to write CSS. For instance, instead of writing this:

Code:
.class
{
background: url('images/imagesubdir/image.png');
other css
}

.anotherclass
{
background: url('images/imagesubdir/image.png');
more css
}

You could write this:

Code:
.class
{
background: {BG};
other css
}

.anotherclass
{
background: {BG};
more css
}

It's incredibly easy to do and only requires a few lines of code.

Open up admin/modules/style/themes.php.

Find (around line 1900):
PHP Code:
        // Now we have the new stylesheet, save it
        
$updated_stylesheet = array(
            
"cachefile" => $db->escape_string($stylesheet['name']),
            
"stylesheet" => $db->escape_string(unfix_css_urls($mybb->input['stylesheet'])),
            
"lastmodified" => TIME_NOW
        
); 

Add before:
PHP Code:
        $replace = array(
            
"{BG}"    =>    "black",
            
"{TH}"    =>    "blue");

        
$mybb->input['stylesheet'] = strtr($mybb->input['stylesheet'], $replace); 

To add more variables, add new array entries. I just used my two test variables. These only work on the Advanced Editor and will be replaced when you save it.

If you want it to apply to new stylesheets:

Find (around line 2260):
PHP Code:
            // Add Stylesheet            
            
$insert_array = array(
                
'name' => $db->escape_string($mybb->input['name']),
                
'tid' => intval($mybb->input['tid']),
                
'attachedto' => implode('|'array_map(array($db"escape_string"), $attached)),
                
'stylesheet' => $db->escape_string($stylesheet),
                
'cachefile' => $db->escape_string(str_replace('/'''$mybb->input['name'])),
                
'lastmodified' => TIME_NOW
            
); 

Add before:
PHP Code:
            $replace = array(
                
"{BG}"    =>    "black",
                
"{TH}"    =>    "blue");

            
$stylesheet strtr($stylesheet$replace); 

I tried making this into a plugin but always broke my Theme Editor. Toungue I hope this helps you. Smile

Hide Reputation Button from Own Posts

$
0
0
We can see in thread view - all the posts have a button to give reputation to the user for the post. However; if you click the reputation button in your own post - it comes out as an error message stating:

Quote:You cannot add to your own reputation.

I felt this is somehow unwanted. So, here I'm to show you how we can hide reputation button from own posts.

We are going to hide the button using jQuery. So, at first include jQuery library to your board using the well-known method, if it is not already.

Next, open the template:
ACP > Templates & Styles > Templates > {$theme_name} Templates > Postbit Templates > postbit_rep_button

Find the code of the Button image (works fine with css buttons too) and bind it in an ID.

<span id="selfrep{$post['pid']}"><a href=" .... ....</a></span>

For example:

The default theme's code:

PHP Code:
<a href="javascript:MyBB.reputation({$post['uid']},{$post['pid']});"><img src="{$theme['imglangdir']}/postbit_reputation.gif" alt="{$lang->postbit_reputation_add}title="{$lang->postbit_reputation_add}/></a

Change it to:

PHP Code:
<span id="selfrep{$post['pid']}"><a href="javascript:MyBB.reputation({$post['uid']},{$post['pid']});"><img src="{$theme['imglangdir']}/postbit_reputation.gif" alt="{$lang->postbit_reputation_add}title="{$lang->postbit_reputation_add}/></a></span

Now the decision making and hiding part using jQuery. Add at the very end of the same template:

PHP Code:
<script type="text/javascript">
jQuery.noConflict(); 
jQuery(function() {
if({
$post['uid']} == {$mybb->user['uid']}) {
jQuery('#selfrep{$post['pid']}').hide();
 }
});
</script> 

Save the template and you are done!!! Big Grin

Snap:
[Image: 5jJs09B.png]

Happy coding.

How to Protect your AdminCP via IP Address

$
0
0
This will prevent any one from access the Admin Control Panel besides the IP's you list.

1. Open your FTP Application(ex.File Zilla,ect)
2. Go to the Admin Folder and Edit the .htaccess file
3. Copy & Paste this into there-
PHP Code:
Order Deny,Allow
Deny from all
# Username
Allow from your YOUR IP HERE,Other Admins Ip here,So on and so on
This will allow only you and your other admins access to the AdminCP and for other members it will appear as "Forbidden".

Hope this helped out! Wink

To find out your IP just go to http://whatsmyip.org/

View Count Stuck [Fix]

$
0
0
I have found out that OUGC Announcement Bars tends to stop views from updating. Just a little FYI for anyone that has that plugin, or is having the problem.

Disabling On Its Own Thread

$
0
0
Hopefully I do not "repost"
Here I will share knowledge for anyone who did not know how to knock out on its own thread (Manually)

I want to review the thread that describes the "rating"
This thread explains to remove the "rating" on his own thread but using the plugin
http://community.mybb.com/thread-61092.html
This thread explains to remove the "rating" on the thread
http://community.mybb.com/thread-41394.html

just, open the file showthread.php

find this code
PHP Code:
$plugins->run_hooks("ratethread_process"); 

add this code, on it
PHP Code:
if($mybb->user['uid'] != $thread['uid']) 


next
find this code
PHP Code:
$time TIME_NOW;
    
my_setcookie("mybbratethread[{$tid}]"$mybb->input['rating']);


add this code, below it
PHP Code:
}
else {
    
error("Cannot add rate to your own thread");



Source : http://komunitas.mybbindonesia.com/thread-1532.html

.jpg  rating.jpg (Size: 51.74 KB / Downloads: 6)

CSS Badges in Postbit

$
0
0
If you'd like to have CSS group badges in your postbit, it's really simple. First, open your Post Bit Templates > postbit_author_user template, and add this to the very top:

Code:
<div class="{$usergroup['title']}">{$usergroup['title']}</div>    
<br />

You can then style each group in your CSS, like this:

Code:
.Administrators {
display: inline-block;
height: 30px;
line-height: 30px;
padding: 0 15px;
color: red;
}

This only works for the postbit though, so keep that in mind.


Example:

.png  Untitled.png (Size: 19.93 KB / Downloads: 18)

Profile popups

$
0
0
1 - Download TinyBox2 : http://www.scriptiny.com/2011/03/javascr...l-windows/
2 - Copy tinybox2/tinybox.js in jscripts folder
3 - Copy tinybox2/images/close.png and tinybox2/images/preload.gif in images folder
4 - Edit headerinclude templates
add after all:
Code:
<script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/tinybox.js"></script>
5 - Create new template with name "member_profile_pop" and add
Code:
<table><tr><td id="tvatar" style="width: 135px;text-align:center"><span><img src="{$memprofile['avatar']}" alt="" max-width="135" max-height="135" /></span></td><td style="vertical-align: top; padding-left: 10px; width:340px"><div style="min-height:175px"><a href="member.php?action=profile&amp;uid={$uid}"><span style="font-size:15px"><strong>{$formattedname}</strong></span></a><br /><span style="font-size:11px">({$usertitle})</span>{$groupimage}<br />{$userstars}<br /><br /><span style="font-size:10px;font-weight:bold"><a href="member.php?action=profile&amp;uid={$uid}">Profile Page</a> <a href="private.php?action=send&amp;uid={$memprofile['uid']}" style="padding-left:5px">Send PM</a></span><hr><span style="font-size:10px">{$lang->postbit_status} {$online_status} &nbsp;{$lang->registration_date} {$memregdate} &nbsp;{$lang->total_posts} {$memprofile['postnum']} &nbsp;{$lang->reputation} {$memprofile['reputation']} &nbsp;{$lang->warning_level} <a href="{$warning_link}">{$memprofile['warningpoints']}</a><hr>{$lang->lastvisit} {$memlastvisitdate} {$memlastvisittime}</span></div></td></tr></table>

Ps. If Search engine friendly URL is enabled in your forum, change all
"member.php?action=profile&amp;uid={$uid}" to "user-{$uid}.html"

6- Create new stylesheet wit name "tiny.css" and add
Code:
.tbox {position:absolute; display:none; padding:14px 17px; z-index:900;text-align:left}
.tinner {padding:15px; -moz-border-radius:5px; border-radius:5px; background:#fff url(images/preload.gif) no-repeat 50% 50%; border-right:1px solid #333; border-bottom:1px solid #333}
.tmask {position:absolute; display:none; top:0px; left:0px; height:100%; width:100%; background:#000; z-index:800}
.tclose {position:absolute; top:0px; right:0px; width:30px; height:30px; cursor:pointer; background:url(images/close.png) no-repeat}
.tclose:hover {background-position:0 -30px}

#error {background:#ff6969; color:#fff; text-shadow:1px 1px #cf5454; border-right:1px solid #000; border-bottom:1px solid #000; padding:0}
#error .tcontent {padding:10px 14px 11px; border:1px solid #ffb8b8; -moz-border-radius:5px; border-radius:5px}
#success {background:#2ea125; color:#fff; text-shadow:1px 1px #1b6116; border-right:1px solid #000; border-bottom:1px solid #000; padding:10; -moz-border-radius:0; border-radius:0}
#bluemask {background:#4195aa}
#frameless {padding:0}
#frameless .tclose {left:6px}
#tvatar img {
    padding: 1px;
    border: 1px solid #D5D5D5;
    box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.1);
}

#tvatar img:hover {
border-color:#7D7D7D;
}

If you use black theme plz check this post http://community.mybb.com/thread-137866-...#pid995435

7 - Edit member.php
7.1 - Find:
Code:
member_profile_referrals";
replace:
Code:
member_profile_referrals,member_profile_pop";
7.2 - Find:
Code:
if($mybb->input['action'] == "profile")
Replace:
Code:
if($mybb->input['action'] == "profile" or $mybb->input['action'] == "profile_pop")
7.3 - Find:
Code:
    eval("\$profile = \"".$templates->get("member_profile")."\";");
    output_page($profile);
Replace:
Code:
if($mybb->input['action'] == "profile_pop"){
    eval("\$profile_pop = \"".$templates->get("member_profile_pop")."\";");
    output_page($profile_pop);}
else
    eval("\$profile = \"".$templates->get("member_profile")."\";");
    output_page($profile);
8 - Edit inc/function.php
Find:
Code:
return "<a href=\"{$mybb->settings['bburl']}/".get_profile_link($uid)."\"{$target}{$onclick}>{$username}</a>";
Replace:
Code:
//return "<a href=\"{$mybb->settings['bburl']}/".get_profile_link($uid)."\"{$target}{$onclick}>{$username}</a>";
return "<a onclick=\"TINY.box.show({url:'{$mybb->settings['bburl']}/member.php?action=profile_pop&uid=$uid',width:500})\" href=\"javascript:void(0)\"{$target}{$onclick}>{$username}</a>";

Image:
[Image: XUcsci0.png]

Demo: My forum

[Tutorial] Drastically Speedup Load Times With PHP Speedy

$
0
0
Time it takes: 5 minutes
Difficulty Level: Medium

Some Info:

Yesterday I found a PHP script called PHP Speedy. After reading what it could do I decided to give it ago (bear in mind I had already followed this guide so the forum has already been tweaked). After activating the script the forum went from taking around 4-5 seconds to load to 2-1.5 seconds and under. Not all the features work but the ones that do make a huge differences.

[Image: bOjvXJ1l.jpg]

http://tools.pingdom.com/fpt/#!/KEvobm75...guyos.com/

Guide:

First download the script.

.zip  php_speedy.zip (Size: 164.87 KB / Downloads: 5)

Unzip it and upload it to the root of you're MyBB install.

Next go to http://YOUR-FORUM/php_speedy/install.php

Fill in a user name and password (don't worry about this to much because we will be deleting this later)

[Image: rrKmHhtl.jpg]

On the next page just click next.

[Image: 1N8L2cil.jpg]

On the next page keep all the option as they are and click next.

On Stage 3 of the install you will see a link to a test page. Don't worry about this. It doesn't work but the script works fine.

Near the bottom of the Stage 3 page you will see this:

[Image: LPHlN9dl.jpg]

Copy the parts I have highlighted because you are going to need to add them to the global.php

In the root of you're MyBB install you will find global.php. Download it and edit it to include the bit of code you just copied.

You're global.php should look something like this:

Top of global.php
[Image: cpo1nrAl.jpg]

Bottom of global.php
[Image: CiZFKqll.jpg]

Now save it and upload it back to the MyBB root install.

If everything is working fine then you can go ahead and delete index.php and install.php from the php_speedy folder.

If you are having issues try turning on and off options on Stage 2 of the install.

If its not working at all. Just remove the code you added to the global.php

How to download FTP Folders (Very Easy)

$
0
0
How to download FTP Folders

This will help alot when switching web hosts or just to keep a backup of the whole server Smile

Stuff Needed-
FTP Application ex. FileZilla...
download_ftp_folder_as_zip.php

Step 1- Put the download_ftp_folder_as_zip.php file in which ever ftp folder(s) you want to download.

Step 2- Go to yoursite.com/ftpfolder/download_ftp_folder_as_zip.php and you should get something like this.

Step 3- Name it whatever you want and click Create Zip File and your done!

Note- Delete the download_ftp_folder_as_zip.php file from the ftp folder(s) after you're done because you wouldn't want other people downloading you forum.

Video Tutorial-




Hope this helped Smile

[Tutorial] How to add a 'Hot' prefix

$
0
0
Specifically for those who want to do away with thread icons like myself.

Open up your forumdisplay.php and look for the following code:

Code:
if($thread['replies'] >= $mybb->settings['hottopic'] || $thread['views'] >= $mybb->settings['hottopicviews'])
        {
            $folder .= "hot";
            $folder_label .= $lang->icon_hot;

Add under:

Code:
$prefix = $lang->hot_prefix;

Now go to /inc/languages/english/global.lang.php and look for

Code:
$l['poll_prefix'] = "Poll:"

Under it, add:

Code:
$l['hot_prefix'] = "Hot"

Finally, go to AdminCP -> Configuration -> Edit English (American) Language variable, edit global.lang.php, find "hot_prefix" and style however you wish. Wink

How to replace forum on/off images with different custom images

$
0
0
I found many tutorials on "how to add custom forum images to your forum" and "how to remove on/off forum images completely".

But actually u can just replace on/off images with your own custom images.

u can add unique images to the forum.

So here is the simple method to do this:

Go to: ACP > Templates > Your theme's templates > Forumbit templates > forumbit_depth2_forum and find:-
PHP Code:
<td class="{$bgcolor}align="center" valign="top" width="1"><img src="{$theme['imgdir']}/{$lightbulb['folder']}.gif" alt="{$lightbulb['altonoff']}
title="{$lightbulb['altonoff']}class="ajax_mark_read" id="mark_read_{$forum['fid']}/></td

And replace it with the below codes:-


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

Save the template.

Now Create a folder "ficons" in the image folder and add images there which you want to use as your custom forum images.

Note: Only add images with .png format. if your forum id=1 then your image should be "1.png". Name the image with the respective forum id.

Apology If this topic was posted before, i am really sorry Toungue


Have fun ShyBig GrinBig GrinBig Grin

Creating a Mybb Forum using 000webhost.(Detailed and easy to understand)

$
0
0
Hello guys, once even i used to wonder how to create a forum using 000webhost, but now, as I know it, i would like to share this with you. Wink

Requirements:

A 000webhost account
The latest version of MyBB(1.6.10 of now)

Steps

Go to 000webhost.com and create a new account.

[Image: mybb.png]

[Image: mybb1.png]

[Image: mybb2.png]

[Image: mybb3.png]

[Image: mybb4.png]

Go to 'youforum.com/install' once done. It will look something like this:

[Image: mybb5.png]

Complete the steps and your forum will be ready, it will look like this after installation:

[Image: 90557831.png]

Congo on having a new forum. Smile Big Grin

How to add a notification to posting suspensions

$
0
0
Hi, I posted this in the general support forum before I saw this one so this is how you add a notification to posting suspensions.

Open ROOT/newthread.php
Find...
PHP Code:
if($forumpermissions['canview'] == || $forumpermissions['canpostthreads'] == || $mybb->user['suspendposting'] == 1)

and below it add...
PHP Code:
//Custom for Suspend time
    
if ($mybb->user['suspendposting'] == 1)
    {
            
$susdate my_date($mybb->settings['dateformat'], $mybb->user['suspensiontime']);
            
$sustime my_date($mybb->settings['timeformat'], $mybb->user['suspensiontime']);
            
        
error("Your posting privileges are currently suspended until $susdate $sustime.""Posting Suspended");
    }
    
//Custom for Suspend time 
Then open ROOT/newreply.php
Find...
PHP Code:
if($forumpermissions['canview'] == || $forumpermissions['canpostreplys'] == || $mybb->user['suspendposting'] == 1)

and below it add...
PHP Code:
//Custom for Suspend time
    
if ($mybb->user['suspendposting'] == 1)
    {
            
$susdate my_date($mybb->settings['dateformat'], $mybb->user['suspensiontime']);
            
$sustime my_date($mybb->settings['timeformat'], $mybb->user['suspensiontime']);
            
        
error("Your posting privileges are currently suspended until $susdate $sustime.""Posting Suspended");
    }
    
//Custom for Suspend time 
You are done, you can edit the message to whatever suites your needs.
Here is a screenshot of what it will look like.
[Image: mrsm6u.png]

IF YOU DO NOT WANT TO EDIT IT YOURSELF YOU CAN DOWNLOAD MY EDIT OF THE TWO FILES BELOW.

.zip  Upload to server.zip (Size: 16.75 KB / Downloads: 2)

inc and config.php file that can not be accessed directly using this method.

$
0
0
hi friends.

inc and config.php file that can not be accessed directly using this method.

create a file .htaccess and insert it into inc

for this code in the file .htaccess

<files config.php>

Order Internal Server Error, allow

Internal Server Error from all

</files>


  Now, Whenever someone goes to yoursite.com/inc, they'll get a 500 internal server error.

like this.

.png  internal server error.png (Size: 115.71 KB / Downloads: 9)

Portal Page

$
0
0
I suggested to add Portal Page

Instruction of http://mybbhacks.zingaburga.com/showthread.php?tid=54

To do this, open up portal.php
Find:
Code:
$query = $db->query("
    SELECT p.pid, p.message, p.tid
    FROM ".TABLE_PREFIX."posts p
    LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)
    WHERE t.fid IN (".$mybb->settings['portal_announcementsfid'].") AND t.visible='1' AND t.closed NOT LIKE 'moved|%' AND t.firstpost=p.pid
    ORDER BY t.dateline DESC
    LIMIT 0, ".$mybb->settings['portal_numannouncements']
);

Replace with:
Code:
$page = intval($mybb->input['page']);
if($page < 1) $page = 1;
$numann = $db->fetch_field($db->simple_select('threads', 'COUNT(*) AS numann', "fid IN (".$mybb->settings['portal_announcementsfid'].") AND visible='1' AND closed NOT LIKE 'moved|%'"), 'numann');
$perpage = intval($mybb->settings['portal_numannouncements']);
$multipage = multipage($numann, $perpage, $page, $_SERVER['PHP_SELF'].'?paged=1');
$query = $db->query("
    SELECT p.pid, p.message, p.tid
    FROM ".TABLE_PREFIX."posts p
    LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)
    WHERE t.fid IN (".$mybb->settings['portal_announcementsfid'].") AND t.visible='1' AND t.closed NOT LIKE 'moved|%' AND t.firstpost=p.pid
    ORDER BY t.dateline DESC
    LIMIT ".(($page-1)*$perpage).", ".$perpage
);

Then find:
Code:
$query = $db->query("
    SELECT t.*, t.username AS threadusername, u.username, u.avatar
    FROM ".TABLE_PREFIX."threads t
    LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid = t.uid)
    WHERE fid IN (".$mybb->settings['portal_announcementsfid'].") AND t.visible='1' AND t.closed NOT LIKE 'moved|%'
    ORDER BY t.dateline DESC
    LIMIT 0, ".$mybb->settings['portal_numannouncements']
);

Replace with:

Code:
$query = $db->query("
    SELECT t.*, t.username AS threadusername, u.username, u.avatar
    FROM ".TABLE_PREFIX."threads t
    LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid = t.uid)
    WHERE fid IN (".$mybb->settings['portal_announcementsfid'].") AND t.visible='1' AND t.closed NOT LIKE 'moved|%'
    ORDER BY t.dateline DESC
    LIMIT ".(($page-1)*$perpage).", ".$perpage
);

Once you've done the above modifications, just open up your portal template, and add {$multipage} wherever you want your pagination to be.

I figured out how to prevent bots.

$
0
0
I honestly figured out a way to prevent bots even with out the security questions, all you need is one single plugin.

Go to http://www.keycaptcha.com

Register for an account

Once you sign up, you will be on the dashboard, click add site.

Follow all the steps

After step 4, you will receive instructions on how to install the plugin, which is just like any other plugin

All other things you will have to do will be shown to you after step 4.



So, if you're having problems with bots and can't find a legitimate way to stop them, here is your solution!

back view the first index.

$
0
0
use this code to redirect to view the first index that tries to access a directory directly.

Code:
<?phpheader('location:/index.php');
die();

save with format : index.php
and place it in any directory you want.


like this. :



Wink
Viewing all 690 articles
Browse latest View live