MyBB Community Forums

Full Version: help with hide code
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How do i intall hide code



#### search.php ####

Search:
---
if(strlen($result['subject']) > 50)
{
$title = substr($result['subject'], 0, 50)."...";
}
else
{
$title = $result['subject'];
}
---
Add after:
---
$searcharray[]="/\[hide](.*)\[\/hide\]/siU";
$replacearray[]=" HIDDEN CONTENT ";
$result['message'] = preg_replace($searcharray, $replacearray, $result['message']);
---

#### showthread.php ####

Search:
---
// Lets get the pid's of the posts on this page
---
Add before:
--
$result = $db->query("SELECT count(message) FROM ".TABLE_PREFIX."posts WHERE tid='$tid' AND uid='$mybbuser[uid]'");
$selfposted = $db->fetch_array($result, $selfposted->db);
--

### newreply.php ###

Search:
---
$username = htmlspecialchars_uni($mybb->input['username']);
---
Add after:
--
$searcharray[]="/\[hide](.*)\[\/hide\]/siU";
$replacearray[]="";
$post[message] = preg_replace($searcharray, $replacearray, $post[message]);
---

### /inc/functions_post.php ###

Search:
---
function doquotes($message)
---

Add before:
---

function hidetags($message) {
global $db, $n, $mybbuser, $selfposted;
// if user a guest, answered to Posting, or moderators are not the text indicated
if ( ($mybbuser[uid] != "0" && $selfposted[0]) || $mybbuser[cancp]) {
$search="/\[hide](.*)\[\/hide\]/siU";
$replace="<font color=red><b><i>Content Unlocked. Thanks for replying.<p></i></b></font> $1";
$message = preg_replace($search, $replace, $message);
$message = str_replace("\'", "'", $message);
} else {
// sonst nix anzeigen
$searcharray[]="/\[hide](.*)\[\/hide\]/siU";
$replacearray[]="<font color=red><b><i>Hidden Content. Please reply to see the content</i></b></font>";
$message = preg_replace($searcharray, $replacearray, $message);
$message = str_replace("\'", "'", $message);
}
return $message;
}

---
Search:
---
$message = nl2br($message);
---

Add after:
---
$message = hidetags($message);
---

Bearbeitete Dateien hochladen

Templates:

### edit codebuttons ####

---
Search:
---
<img name="php" src="./images/codebuttons/php.gif" onclick="insertCode('php')" class="toolbar_normal" onmouseover="toolbarHover('php')" onmouseout="toolbarUnHover('php')" onMouseDown="toolbarMouseDown('php')" alt="$lang->alt_php">

---
Add after:
---
<img name="hide" src="./images/codebuttons/hide.gif" onclick="insertCode('hide')" alt="Hidden Text" border="0" class="toolbar_normal" onmouseover="toolbarHover('hide')" onmouseout="toolbarUnHover('hide')" onMouseDown="toolbarMouseDown('hide')">
---
Done.
They tell you in the text you have provided which file you have to open
example Wrote:#### search.php ####

What to search for in that file
example Wrote:Search:
---
if(strlen($result['subject']) > 50)
{

and what to do after finding what was asked from you to search for
example Wrote:Add after:
---
$searcharray[]="/\[hide](.*)\[\/hide\]/siU";

there is also one about templates which you do the same editing procedures in
example Wrote:Templates:

### edit codebuttons ####


regards