SoFunction
Updated on 2025-04-13

Discuz! Plugin: Automatically hide posts page 2/2


Solution 2:
First, replace the two of the above modified content: dhtmlspecialchars with: put_html
Then add in front of the last  ?>  of the file:
//hidemsg by KaijuanStudio
function put_html($message) {
        if(preg_match('/([^\f]+)<[^>]+$/', $message, $put1)) {
                $message = $put1[1];
        }
        $tour1 = preg_replace('/<img|<br|<p|li/i', '', $message);
        $tour2 = explode('<', trim($tour1));
        foreach($tour2 as $tour3) {
                if(preg_match('/^([a-z]{1,}).*>.*/i', $tour3, $tour4)) {
                        $fronts[] = $tour4[1];
                        $kmsg[] = $tour3;
                }
                if(preg_match('/^\/([a-z]{1,}).*>.*/i', $tour3, $tour5)) {
                        $backs[] = $tour5[1];
                }
        }
        $fronts = $fronts ? $fronts : array();
        $backs = $backs ? $backs : array();
        foreach($fronts as $i1 => $front) {
                foreach($backs as $i2 => $back) {
                        if($fronts[$i1] != '') {
                                if($front == $back) {
                                        $fronts[$i1] = '';
                                        $backs[$i2] = '';
                                }
                        }
                }
                if($fronts[$i1] != '' && !$badcode) {
                        $badcode = $kmsg[$i1];
                }
        }
        if($badcode) {
                $badcode = '<'.str_replace('/', '\/', $badcode);
                preg_match('/([^\f]*)'.$badcode.'/i', $message, $put2);
                $message = $put2[1];
        }
        return $message;
}
//hidemsg end This method is suitable for forums that enable HTML code. It mainly uses a HTML error-resolving function we created to filter incorrect HTML elements in the truncated text. There may be some incompleteness in this function. I hope that friends will report it in time after discovering the problem. The effect of this method is basically the same as above, but there will be no truncated code at the end of the text. However, the disadvantage is that if all post content is included in a quote or table table, after the post is truncated, the post content will not be previewed due to incomplete code.
Interference code compatibility modification (Same as DZ4.1/DZ5.0/DZ5.5)
Note: If your forum does not enable the jammer function, you can skip this modification. This modification continues the above modifications to the file.
turn up:
        if(!$htmlon && !$allowhtml) {
                $message = $jammer ? preg_replace("/\r\n|\n|\r/e", "jammer()", dhtmlspecialchars($message)) : dhtmlspecialchars($message);
}Replace with:
        if(!$htmlon && !$allowhtml) {
                $message = dhtmlspecialchars($message);
}Continue to search:
if($highlight) {Add on the line above:
        if(!$htmlon && !$allowhtml) {
                $message = $jammer ? preg_replace("/\r\n|\n|\r/e", "jammer()", $message) : $message;
}The compatibility modification of the interference code has ended.
Modification: (Same as DZ4.1/DZ5.0/DZ5.5)
Open: templates\default\  and find:
'post_hide_reply_hidden' => '**** You can only browse this content by replying to posts and replies *****', add it to the following line:
'post_hide_limit' => '<div style="border: 1px solid #dddddd; padding: 10px; margin: 5px; margin-left: 0; background-color: #ffffff; font: 12px verdana; color: blue; text-align: center"><img src="images/" border="0" //    I’m very sorry, your current status is a tourist, so you can only read some of the content. To read the full content, please: <a href=""><u>Register</u></a>  or <a href="?action=login"><u>Login</u></a> . </div>',
Modification: (Same as DZ4.1/DZ5.0)
Add at the end:
$hidemsg= 4; //Open studio posts automatically hide switch, 0=off, 1=Automatically hide posts on the 1st floor, 2=Automatically hide all posts, 3=Automatically hide all posts except the 1st floor, 4=Only restrict tourists to read all post content. Note: When this setting is enabled, the following $hidecut value must be set, otherwise this setting will be invalid
$hidecut = 100;//Set the number of bytes of the post content that is allowed to be previewed, 0=off preview, 100=preview can be previewed 100 bytes, you can also set it to other values. The larger the value, the more content you can preview
$leavemod= 0; //Set allow or exclude forum fid in $hidefids , 0= allow, automatic hiding will be enabled in the set forum. Forums other than $hidefids, hiding will not be enabled. 1=Exclude, automatic hiding will not be enabled in the set forum, and forums other than $hidefids will be enabled in all forums. When there is no forum fid in $hidefids, this setting is also invalid, which means that automatic hiding is enabled for all forums
$hidefids=array();//Set the fid of the forum that enables or excludes automatic hiddenness. When setting multiple forums, separates them with English commas, and when setting up a forum, there is no need to add a comma. For example: $hidefid = array(2,3,5); then enables the automatic hidden function in the three forums with fid of 2, 3, and 5 respectively; $hidefid = array(2); then only enables automatic hiddenness in the forums with fid of 2. When the default is array(), automatic hiding is enabled for all forums.
Complete, upload and update the file!
Finally, the attachment provides 55 small icons in front of the prompt information. You can select one of them and change the name to:  , and then upload it to the forum's picture directory.
Previous page12Read the full text