Recent Topics

1 Mar 02, 2008 15:57    

Hi,

When editing comments in 2.4, when you update the comment, the auto-br is ignored (whether or not you tick the box or not), making the comment, well, less readable :-)

2 Mar 04, 2008 18:23

My b2evolution Version: Not Entered

I am facing this issue: when I type in a comment, it looks like the line breaks work, & even when I go in to moderate/edit/publish the comment it looks like they're there. But then when I actually post it, they all disappear & the text all runs together with no line breaks. What's happening? When I hit that "save" button at the bottom of the comment dialog box it takes out all the line breaks for the original comment & my responses to the comment.

I do have the auto-br checked and this happens within the comment section of the dashboard. Please help.

3 Mar 04, 2008 18:26

Forgot to tell, the version I am using is 2.4.0

4 Mar 04, 2008 21:13

I have no problem when I write, preview and post a comment, but editing a comment does render it without line breaks.

I'll look through the bug forum and see if this has been raised.
If not I'll move this post to that forum.

Cheers
John

6 Mar 05, 2008 08:37

Is this going to be fixed? Am I have to live with it?
Or what do I need to do with it?

7 Mar 05, 2008 08:52

V2.4.0-rc is a release candidate build.
There is 2.4.1 pending even before a final release.

Bugs are continually being fixed and the fact that this is posted here will generate an investigation.

I suggest you just include <br />'s as you see fit for any edits of comments. Tiresome maybe, but show me any software that don't have a list of bugs.

Sorry I can't give anything more definitive.
Maybe one of the developers will come along with an interim patch, then again, maybe not :)

8 Mar 05, 2008 08:59

Thanks I will be waiting and for now will use <br />

9 Mar 05, 2008 10:07

Try this :

1) crack open the auto_p plugin and amend/add the following blocks of code

new setting ( approx line 60 + )

	/**
	 * @return array
	 */
	function GetDefaultSettings()
	{
		return array(
				'render_comments' => array(
					'label' => T_('Render comments'),
					'type' => 'checkbox',
					'defaultvalue' => 1,
					'note' => T_('Render comments as well as posts?'),
				),
				'br' => array(
					'label' => T_('Line breaks'),
					'type' => 'checkbox',
					'defaultvalue' => 1,
					'note' => T_('Make line breaks (&lt;br /&gt;) for single newlines.'),
				),

new function ( approx line 623+ )

	/**
	 * Add "<br />" to the end of newlines, which do not end with "<br />" already and which aren't
	 * the last line, if the "Auto-BR" setting is enabled.
	 *
	 * @return string
	 */
	function autobr( $text, $replace_last = true )
	{
		if( ! $this->use_auto_br )
		{ // don't make <br />'s
			return $text;
		}

		return preg_replace( '~(?<!<br />)\n'.( $replace_last ? '' : '(?!\z)' ).'~i', "<br />\n", $text );
	}


	/**
	 * Render comments if required
	 *
	 * @param array mixed $params
	 */
	function BeforeCommentFormInsert( $params )
	{
		// render the comment content
		if( $this->Settings->get( 'render_comments' ) )
		{
			$params[ 'data' ] = & $params['Comment']->content;
			$this->RenderItemAsHtml( $params );
		}

	}

Then crack open conf/_formatting.php and disable autobr

/**
 * Choose formatting options for comments
 * 'never'   : option will never be used
 * 'opt-in'  : option will be used only if user explicitely asks for it
 * 'opt-out' : option will be used by default, but user can refuse
 * 'always'  : option will always be used
 *
 * @todo fp> remove and let Auto-P handle the comment formatting.
 */
$comments_use_autobr = 'never';	// automatically change line breaks to <br />

Meander over to admin > global settings > plugin install and hit "reload plugins", cross yer fingers, make a comment and hope like hell I got it right ;)

¥

10 Mar 05, 2008 10:16

@¥åßßå: Is this te solution as it is already implemented in 2.4.1? I saw that the bug is non-existent there.

11 Mar 05, 2008 10:47

It is working great now. Thanks to ¥åßßå
Blonde Bimbo

12 Mar 05, 2008 10:49

I hadn't even looked at 2.4.1 I just made it up :P

Chances are that I should go see what the real solution is ;)

¥

13 Mar 05, 2008 10:58

what happens is when you would like to edit a comment from within the admin, each new comment would be converted into html coding within the comment field. This way, when you save it, it would take put it back as it is.

Well, is it possible to make the comment field within the edit section from the admin to be a html editor, so i do not need to see all the html coding? How?

14 Mar 05, 2008 10:58

Well, your solution seems to come near the TODO as it is set by francois :-)

@todo fp> remove and let Auto-P handle the comment formatting.

15 Mar 05, 2008 11:04

Hi Spuyt12, can you be more clear on this? I do not follow you correctly. Thanks

16 Mar 05, 2008 11:06

arn_b2evo wrote:

Well, is it possible to make the comment field within the edit section from the admin to be a html editor, so i do not need to see all the html coding? How?

No idea, I don't use any of the html editor plugins but I thought tiny mce also worked when editing comments?

Spuyt12 wrote:

Well, your solution seems to come near the TODO as it is set by francois :-)

@todo fp> remove and let Auto-P handle the comment formatting.

Yeah I remember that todo from a while ago, chances are that there's a cleaner solution if I played around in the core to implement it ;)

¥

17 Mar 05, 2008 11:32

Well, I'd like to stay as close as possible to the official versions. This saves you a lot of problems later on (trust me, I know :-)

I took a look at the latest versions in de CVS-repository and I found how francois solved it.

Look up the file inc/comments/_comments.ctrl.php, and you'll find at (around) line 117:

param_check_html( 'content', T_('Invalid comment text.'));


Change this to:

param_check_html( 'content', T_('Invalid comment text.'), '#', $post_autobr );	

Then look up the file inc/_core/_param.funcs.php, and find the function param_check_html (around line 1540). Add an extra parameter $autobr to the function, so that it looks like this:

function param_check_html( $var, $err_msg = '#', $field_err_msg = '#', $autobr = 0 )

After that go a few lines down and look for the following line

$altered_html = check_html_sanity(...)

and change this to:

$altered_html = check_html_sanity( $GLOBALS[$var], 'posting', $autobr );

That'll do it. At least, it did it for me :-)

18 Mar 05, 2008 12:14

The auto-br is actually working great now. But there is one more glitch here. If you would edit the comment, all the <br /> would still show up untill you clean them out. If you have cleaned them out, it is all gone forever, even when you re-edit it again - the <br /> is not there anymore. But how come it is still there when you click edit the first time?

19 Mar 05, 2008 13:04

Which version, 'mine' or ¥åßßå's?

21 Mar 05, 2008 13:11

I mean mine and it is 2.4.0. Know why? another bug?

22 Mar 05, 2008 19:25

*Sigh*

Did you use the solution I provided, or ¥åßßå's? I used my solution on my own blog and it works like a charm...

23 Mar 05, 2008 19:37

/me suppresses a giggle ;)

¥

24 Mar 05, 2008 19:45

"The auto-br is actually working great now. But there is one more glitch here. If you would edit the comment, all the <br /> would still show up untill you clean them out. If you have cleaned them out, it is all gone forever, even when you re-edit it again - the <br /> is not there anymore. But how come it is still there when you click edit the first time?"

Maybe this is the answer to your question: With auto-br, you do not need <br />'s in your post. See this as a feature, not as a bug :)

25 Mar 07, 2008 03:45

Yes, that is what I am doing. Thanks for the help. It works alright now.

26 Mar 07, 2008 04:06

Okay this is getting old. There are two possible solutions to the issue here. One came from Yabba and one came from Spuyt12. When asked "which one did you use" the answer "yes" doesn't help worth a damn.

Either Yabba's solution is what you implemented, or, Spuyt12's solution is what you implemented.

Work with us a little bit okay? We try to answer questions quickly and accurately, and we LIKE to know if a solution works. If it doesn't we like to know why. When faced with two solutions "this works" is not a helpful answer. Therefore I'm going to split a simple question in half just to FINALLY get to the bottom line:

1. Did you use [url=http://forums.b2evolution.net/viewtopic.php?p=70473#70473]this solution[/url] proposed by Yabba? "yes" or "no" would pretty much be the options here.

2. Did you use [url=http://forums.b2evolution.net/viewtopic.php?p=70482#70482]this solution[/url] proposed by Spuyt12? "yes" or "no" would pretty much be the options here as well.

In theory both of these can not be answered with "yes" and both can not be answered with "no", however, it is possible that you've found a method that is partially both and potentially unrelated to either. Therefore if you honestly need to answer "yes" or "no" to both of these questions PLEASE take the time to explain exactly what you did to resolve the issue of comments losing their formatting.

Thanks!

27 Mar 07, 2008 04:14

I actually use both of them. The first one (Yabba) I used and I also applied Spuyt12. They are working with this situation: every new comment that I need to edit will still show the <br > but then if you either clean them out or keep having them there, the save button would either keep it as it should be. I mean the line break is working fine (either you have the <br /> or not on the editing comment section.

28 Mar 08, 2008 12:11

I only have my solution. Implementing both may not be the best approach. This could result in unexpected behaviour...

29 Mar 29, 2008 18:26

It's already fixed on 2.4.1?


Form is loading...

Build your own website! – This forum is powered by b2evolution CMS, a complete engine for your website.