Problem with a code...
 
Notifications
Clear all

wpForo 1.x.x [Solved] Problem with a code in the post when editing

6 Posts
2 Users
4 Likes
599 Views
czaban
Posts: 6
Topic starter
(@czaban)
Active Member
Joined: 2 years ago

Hi Team,

I noticed a week ago a problem with a code embedded in the post. Parts of it disappears while trying to edit it

Example:

1. I'm adding to the post a code like

#include <sample.h>

2. Saving the post and it looks fine

3. Editing post and then I see a code like

#include

The part basically disappears 

Other examples:

1. Adding code like that

aaa::bbb:ccc

2. Saving post

I see

aaaccc

 

I thought it's a problem with wpForo - Syntax Highlighter plugin I bought while I turned it off and the same is with a plain version of code formatting.

I've cleaned a wpForo cache, turned off/on other plugins installed - with no success. 

I'm attaching screenshots to visualize the problem.

This is a very unfortunate problem as the code embedded loses parts of it and forum users who copy the code from the forum have lot's of problems as it's not complete.

 

EDIT: Actually it looks that this is a general problem with wpForo not mine only. I see in this post the same issue

Please just try to edit this post and see the red text in published and edit mode: aaa::bbb::ccc

 

wpForo Version
1.9.9
WordPress Version
5.8.1
7.4.23
10.1.48-MariaDB-0ubuntu0.18.04.1
Topic Tags
5 Replies
Chris
Posts: 2342
Admin
(@chris)
Support Team
Joined: 1 year ago

Hi @czaban,

Please go to \wp-content\plugins\wpforo\wpf-includes\ open wpf-hooks.php, find 

$post['body'] = htmlspecialchars($post['body']);

this code will be comented by default, make it uncomented.

Chris
Posts: 2342
Admin
(@chris)
Support Team
Joined: 1 year ago

@czaban,

also add this at the end of the line

, ENT_NOQUOTES);

 So the code will look like this

$post['body'] = htmlspecialchars($post['body'], ENT_NOQUOTES);

 

 

3 Replies
czaban
(@czaban)
Joined: 2 years ago

Active Member
Posts: 6

@chris confirming, it solves the first case 2nd case is still problematic

please try the case in the attached screenshot

problem is after saving the post

 

Chris
Admin
(@chris)
Joined: 1 year ago

Support Team
Posts: 2342

@czaban,

Go to wp-content\plugins\wpforo\wpf-includes open function.php, find the below code

function wpforo_strip_shortcodes(

after that, make a comment, the code before the if

 

czaban
(@czaban)
Joined: 2 years ago

Active Member
Posts: 6

@chris Thanks! Wanted to confirm that all work well. 

My bests!