Recent Topics

Problems with Comments

Started by on Jul 18, 2019 – Contents updated: Aug 02, 2019

Jul 18, 2019 22:16    

Hello,

Anonymous Users told me that they could not comment on my blogs. Even the comment an tried to send the comment they only got the preview notice and that they should not to forget to send. But the comment has vanished. After several attempts they finally gave it up in anger.
I tried it on different blogs with different skins and two different installations at two different hosters', tried it using firefox, chrome and thor …
Sometimes it worked. E.g. in replying to a comment. But normally it comments did not work.

As a logged in user commenting is no problem.

Does anyone have an idea how to fix this. It is really bothering to write a comment and then loose it, again and again. I can understand the user's anger.

Thanks and Regards, Will

PS: I attach a ZIP File with a print of the page including a DEBUG report.

Complete URL where problem appears :https://www.npo-consulting.net/blogs/notepad.php/unternehmensserviceportal-seltsame-praktiken-bmdw
Exact b2evolution version :6.11.2

Jul 18, 2019 23:44

Hello,

The following frequent issues seem to apply to your support request: (This is a semi-automated response):

  • You did not provide a screenshot (as requested for support)

Try disabling AJAX forms.

Jul 19, 2019 00:43

@fplanque
I disabled AjAX (to get this done I had to disable also both cache options). Now Comment form shows without AJAX, but the problem remains nearly the same (see screenshot - The screenshot shows two alerts with information towards preview, although no preview was ordered, but send - "Pireview: This is a previes only! …" And next follows an information that one should activate E-Mail notification because an E-Mail is given (recommended) So the bug may be caused by this. I have never got such a message before although E-Mails have to be set, because it is mandatory.

Which is striking, the questions of the captcha no longer renew themselves. I use plugin: captcha_qstn (May be because the comment sending process has not worked and therefore did not trigger the plugin)

Jul 19, 2019 11:40

After recycling the last comment in all collections of this instance and - because this had no effect - I deleted the comment. But even that didn't solve the problem.
In a next step I run all routines in system maitenance an cleared all caches. After this I was able to send a test comment.
In a next step I tried to post that comment a user sent via contact form - and this showed the same problem as before. I recognized, that the body of the comment shows an eMail address. I replaced @ by (at) and then publishing the comment was no problem.
What does not work even after this interventions is preview. This leads to an alert at top of the "item single" : Preview …


Here is the URL: for showing that:
https://www.npo-consulting.net/blogs/notepad.php/unternehmensserviceportal-seltsame-praktiken-bmdw?redir=no&comment_cookies=0&comment_allow_msgform=0&comment_type=feedback#comment_preview
but the comment itself was lost and sending was not possible. You may reproduce this by trying yourself. Use link above.

Jul 19, 2019 13:25

I thought, that the bug may be caused also by captcha. So I compared the versions on my installation (6.7.9) with that one on the b2e demo server (6.11.2). I tried to upgrade my plugin, but there was no newer Plugin available for installation. So, where do I get the 6.11.2 Plugin Version, to see whether this causes the bug?

Jul 19, 2019 13:58

Have you tried disabling the captcha to assess/confirm it is the problem?

_captcha_qstn.plugin.php in my 6.11.2 has the following version

class captcha_qstn_plugin extends Plugin
{
	var $version = '6.11.2';
	var $group = 'antispam';
	var $code = 'captcha_qstn';

Jul 19, 2019 14:45

@amoun I disabled the plugin, then I took the actual (6.11.2) plugin out of the 6.11.2 Download - no change. captcha obviously is not part of the bug. (But I am asking myself why some files are not updated by AUTO Upgrade. So I cannot be shure that all files are up to date.

Jul 19, 2019 15:20

@saunders As I understand you get "Preview" action instead of expected "Send comment", right?
If yes, I guess you press "Enter/Return" key instead of clicking on the button "Send comment", please confirm what and where you press or click, thanks.

Jul 19, 2019 15:51

@yurabakhtin Yes, at first the problem was that I triggered a preview when I pressed Send button, but that didn't really worked either. After some trying and emptying all caches under mantenace at least sending comments works again.

But there is still the problem that the preview function is faulty and doesn't work as expected. I don't see the comment in a preview. In addition, the original comment is even lost and so I can no longer send the comment. I.e. the comment must be entered again, which is annoying for users.
You can try the e.g. at https://www.npo-consulting.net/blogs/notepad.php/unternehmensserviceportal-seltsame-praktiken-bmdw yourself. (In case you want a debug report. The password for this is "94110" (without quotation marks) (In case you'll use it, please deactivate debugging afterwords)

In this screenshot you see the result of calling preview. There is only the alert but the original comment is missing and also the preview of the comment.

PS: This bug exists on two different installations at two different hoster's spaces.

Jul 19, 2019 17:30

@saunders wrote earlier:

@amoun . . . why some files are not updated by AUTO Upgrade. So I cannot be shure that all files are up to date.

Not sure but the auto-upgrade may check by file size and not by version number. Unless you kept the version you replaced it will be difficult to see if you had an older version. ????

RE the first image in post #5 shows two versions but I don't understand which versions they are
Both refer to 6.11.2 whilst the captcha in one is 6.7.9

Jul 19, 2019 18:56

@saunders ah finally a real screenshot! Thank you!!

What skin are you using?

Try switching to a default skin like "Bootstrap Blog Skin" and confirm whether or not you still get the same bug.

If yes, please describe the exact steps to reproduce this on the demo server:

IMPORTANT: as already requested by @yurabakhtin before, please confirm wether you click with your mouse or press Return on your keyboard to submit the comment.

Jul 19, 2019 23:39

@saunders Again, this works on https://demo.b2evolution.net as far as I can tell.

Please give the exact procedure to reproduce this on the demo server.

Otherwise I consider you have a plugin that is interfering and you did not isolate which plugin it is.

Jul 19, 2019 23:53

@fplanque What I described, step by step, is the exact procedure to run the preview that does not work. There is nothing I did in the dashboard or elsewhere.
You mentioned plugins. As I recognized not all plugins seem to be upgraded by Auto Upgrade process. So I cannot tell you, what plugins may cause this. I first have to compare the plugin files of my installations with the plugin files delivered by a full download of the same version 6.11.2 But at first glance, there is no reason to suppose one of these plugins to cause the problem..

How can I - meanwhile - comment out that preview button in comments form?

Here you'll find a list of plugins older than 15.6.2019:

Jul 20, 2019 02:42

Hi @saunders
I'm not sure a list of the plugins and their dates relates to @fplanque notion that a plugin maybe the issue, only disabling or uninstalling all of them would show if it one or not.

if that worked then enabling one at a time etc.etc.

Jul 20, 2019 09:51

@amoun
I 've deactivated all plugins, cleared all caches inclusive browser cache and cookies and nonetheless the problem persists. Preview is not working for not logged in users. Conclusion: There is no indication that use plugins caused this.
I compared _advanded.php of my installation with _advanced.php in download (exept Date/ Time and Degbug PWD) there is not differend.
I compared my .htaccess with sample .htaccess. There is a problem: using sample.htaccess as. .htaccess the bog does not load because the blog is installed on a subdir. (But I don't think, that htaccess causes the problem; nevertheless I'll add the file)

So - not to waste to much time and keep effective ;-) - I ask for a way to comment out or suppress that preview button in comments form. If there is no preview option the bug won't cause troubles.


Attachments:

Jul 20, 2019 11:42

You can use Firefox > Developer > Inspector to find the button's ID and then use css to display:none

Will do on this site and post ID

Jul 20, 2019 11:46

Of course it's a class? not an ID as there could be many of them ???

Trying to find where to add the css :)

Jul 20, 2019 12:18

Haven't found a simple css option so took to messing with the core Oops!

/inc/items/model/_items.funcs.php

commented out as below

	// ---------- PREVIEW ----------
	//if( ! $inskin || $display_preview )
	//{
	//	$url = url_same_protocol( $Blog->get( 'url' ) ); // was dynurl
	//	$Form->button( array( 'button', '', /* TRANS: Verb */ T_('Preview'), 'PreviewButton', 'b2edit_open_preview(this.form, \''.$url.'\');' ) );
	//}

Jul 20, 2019 12:41

I've set the aforementioned file back to it's original form.
From the next image you can see I have added the display:none css via Firefox > Developer > Inspector and the button has gone, it just didn't work in the file. Will try again (cache, close browser etc.)

Jul 20, 2019 12:48

OK Got it.

in /skins_adm/bootstrap/rsc/css/style.min.css

added .PreviewButton{display:none} to the end

Jul 21, 2019 18:15

Ok so as not to have the css overwritten with upgrades I have made it a small plugin.
The idea is to invoke a stylesheet before the end of the html head section when posting/editing via the back office.

So all the plugin does is to insert a line to call the css with the code previously mentioned.

The plugin provides the option to override or insert any code in the head section of the html

Attaching a zip which contains1/ the plugin.php, 2/ a css file with the single line mentioned and 3/ an empty html file in case of access to the directory.


Attachments:

Jul 21, 2019 20:04

@amoun thanks for the work around. Because the bug happens only when not logged in, I do need the plugin not working in back office, but in front. And secondly: Is there a way to activate this plugin only for not logged in users? (Because preview works pretty when logged in?)

Jul 21, 2019 20:45

@saunders wrote earlier:

(1)Because the bug happens only when not logged in, I do need the plugin not working in back office, but in front
and secondly(2) : Is there a way to activate this plugin only for not logged in users? (Because preview works pretty when logged in?)

  1. Thinking out loud. "I do need the plugin not working in the back office" etc.
    You mean you only want the preview button hidden in the front office ?? Is that because it is only the new comments that are the problem. Yes I'm getting there? I speak and work before I think things through else I'd get nothing done lol
  1. Probably and will have a look at that once I'm clear about point 1.

EDIT 1
OK so is it's only the preview button on comments to existing posts by anonymous users in the front office?

EDIT 2 If that is the case I can see I have a problem. I will continue to look into it out of interest and hopefully a proper solution to the problem soon.

Jul 21, 2019 21:22

@amoun → I only want the preview button hidden in the front office.
There is no anonymous user at none of my collections who ever edited a published comment in front office. So, yes, I only want the preview button for anonymous users hidden in the front office it is only the new comments to focus at.

Jul 21, 2019 21:26

Ok I edited my previous post to say if that is the case I have a problem with my simple css display:none method, but will update you with any progress. Hope the real issue is resolved. I will enable comments for anonymous users on my site to see if I have that problem with 6.11.2

Jul 21, 2019 21:51

I think I have a temp fix but can't test it yet so I haven't given up :)

Jul 21, 2019 22:34

OK Think this is it.

Ensure you have the file _item_comment_form.inc.php in the skin you are using.

Find the following code, line 445 in my ancient file

$Form->begin_fieldset();
		echo $Form->buttonsstart;

		$preview_text = ( $Item->can_attach() ) ? T_('Preview/Add file') : T_('Preview');
		$Form->button_input( array( 'name' => 'submit_comment_post_'.$Item->ID.'[preview]', 'class' => 'preview btn-info', 'value' => $preview_text, 'tabindex' => 9 ) );
		$Form->button_input( array( 'name' => 'submit_comment_post_'.$Item->ID.'[save]', 'class' => 'submit SaveButton', 'value' => $params['form_submit_text'], 'tabindex' => 10 ) );

Just checked /skins_fallback_v6/_item_comment_form.inc.php and the code starts at line 528

To put a condition around the button to only show when a registered user is logged on a front office post ~replace line 449 above line 532 in /skins_fallback_v6/_item_comment_form.inc.php with

if (isset($current_User)){
$Form->button_input( array( 'name' => 'submit_comment_post_'.$Item->ID.'[preview]', 'class' => 'preview btn-info', 'value' => $preview_text, 'tabindex' => 9 ) );
}

Jul 21, 2019 23:15

@amoun sorry I am confused.

Did you mean, to edit two files
N° 1 _item_comment_form.inc.php line 445 and
N° 2 /skins_fallback_v6/_item_comment_form.inc.php line 532)
and overwrite those both lines with
if (isset($current_User)){ $Form->button_input( array( 'name' => 'submit_comment_post_'.$Item->ID.'[preview]', 'class' => 'preview btn-info', 'value' => $preview_text, 'tabindex' => 9 ) ); } ?

Jul 22, 2019 00:14

No
If you have _item_comment_form.inc.php in your skin, edit that one, but I won't know the version and line numbers, hence the No. 1 which is the old file in my skin starting at line 445

if you don't have that file in your skin then
No. 2. Copy the file from the /skin_fallback_v6/ and put it in your skin and edit it there. starting at line 528

The line to edit in my old file is 449, if you use a copy from /skin_fallback_v6/_item_comment_form.inc.php then it's 532

The line numbers in the code are from my old file, you will need a) to have such a file b) to find the feed back code and edit one line.

Jul 22, 2019 08:13

@amoun thx; but I am not familiar in php, could you please use the following lines out of my skin_fallback_v6 and do what you suggested (To put a condition around the button)? that would be helpful.

	$Form->begin_fieldset();
		echo $Form->buttonsstart;

		$preview_text = ( $Item->can_attach() ) ? T_('Preview/Add file') : T_('Preview');
		$Form->button_input( array( 'name' => 'submit_comment_post_'.$Item->ID.'[preview]', 'class' => 'preview btn-info', 'value' => $preview_text, 'tabindex' => 9 ) );
		$Form->button_input( array( 'name' => 'submit_comment_post_'.$Item->ID.'[save]', 'class' => 'submit SaveButton', 'value' => $params['form_submit_text'], 'tabindex' => 10 ) );

		if( $Item->can_attach() )
		{	// Don't display "/Add file" on the preview button if JS is enabled:
			echo '<script type="text/javascript">jQuery( "input[type=submit].preview.btn-info" ).val( "'.TS_('Preview').'" )</script>';
		}

		$Plugins->trigger_event( 'DisplayCommentFormButton', array( 'Form' => & $Form, 'Item' => & $Item ) );

		echo $Form->buttonsend;

Jul 22, 2019 10:50

Line 5 in your screenshot needs to have the condition. So

1) it has to be surrounded by curly brackets { line 5} to isolate it from the surrounding code.
2} immediately preceding the opening bracket you have to add if (isset($current_User))

php is not that difficult once you've played around a bit if you are familiar with any other coding language.

a) the if statement is enclosed in common brackets. ()
b) the isset is a common function to test if a variable ($) is set
c) in this case we are trying to see if the current user has a value (ID), which anonymous users don't. If the user is registered they have an ID number. If the ID exists then the result is positive and the action will pass to the next code, else it will skip it.
d) the variable to be checked is within another pair of common brackets.
e) If you waned the if statement to cover more than one continuous line of code you must enclose all of then in the single pair of curly brackets. I used the brackets anyway even though there is only one line of code to condition.

All similar to lines 8.9,10 in you screen shot. You can even add a comment to indicate you have inserted a change.

Jul 22, 2019 11:01

So with you code I would ammend it as in the shot below NOT THE REAL LINE NUMBERS

$Form-&gt;begin_fieldset();
	echo $Form-&gt;buttonsstart;

        if(isset($currentuser))
               {
                 // I added the above if statement and enclosed the following line in curly barckets to hide the preview button for anonymous users
		$preview_text = ( $Item-&gt;can_attach() ) ? T_('Preview/Add file') : T_('Preview');
		$Form-&gt;button_input( array( 'name' =&gt; 'submit_comment_post_'.$Item-&gt;ID.'[preview]', 'class' =&gt; 'preview btn-info', 'value' =&gt; $preview_text, 'tabindex' =&gt; 9 ) );
               }

		$Form-&gt;button_input( array( 'name' =&gt; 'submit_comment_post_'.$Item-&gt;ID.'[save]', 'class' =&gt; 'submit SaveButton', 'value' =&gt; $params['form_submit_text'], 'tabindex' =&gt; 10 ) );

		if( $Item-&gt;can_attach() )
		{	// Don't display &quot;/Add file&quot; on the preview button if JS is enabled:
			echo '&lt;script type=&quot;text/javascript&quot;&gt;jQuery( &quot;input[type=submit].preview.btn-info&quot; ).val( &quot;'.TS_('Preview').'&quot; )&lt;/script&gt;';
		}

		$Plugins-&gt;trigger_event( 'DisplayCommentFormButton', array( 'Form' =&gt; &amp; $Form, 'Item' =&gt; &amp; $Item ) );

		echo $Form-&gt;buttonsend;

Jul 22, 2019 11:16

@amoun thanks; Preview is still viewed.
What I did:
1 I copied skin_fallback_v6 folder into the skin folder bootstrap_blog_skin
2 I edited _item_comment_form.inc.php
3 I inserted your If Clause
4 Saved all

Checked: preview button is not hidden, still viewed.
What did I handle wrong?

Jul 22, 2019 11:28

@saunders#c113640]@amoun thanks; Preview is still viewed.
What I did:
1 I copied skin_fallback_v6 folder into the skin folder bootstrap_blog_skin

Oops! only copy the single file from the folder

2 I edited _item_comment_form.inc.php
3 I inserted your If Clause
4 Saved all

The file won't be accessed as it is hidden in the folder, remove it from the folder and place it naked in the skin, then delete the fallback folder.

Jul 22, 2019 11:46

@saunders

Sorry about the false hopes.
I've just created a new blog with the /bootstrap_blog_skin and my mod doesn't work in that skin, it clearly doesn't use that file.

So you've done nothing wrong. Will post back yet again when I can do it to that skin lol

In that skin I think I need to find a different file or soemthing ???

Jul 22, 2019 12:02

@amoun ok I copied the file into the folder. now the file is interpreded but caused an error:
Parse error: syntax error, unexpected '&' in /home/.sites/383/site150/web/blogs/skins/bootstrap_blog_skin/_item_comment_form.inc.php on line 534

Jul 22, 2019 12:20

Oh I noticed an error in my code the if statement is
if (isset($current_User))not if(isset($currentuser)) not that it gets it to work.

Even if I comment out the line in the file it doesn't work so I am looking for the problem still

Jul 22, 2019 12:37

OK Again

I was messing with the wrong skin, the bootstrap_business blog skin, so I couldn't get it to work on my site but now it seems fine on the bootstrap_blog skin

Apologies again for all the flaffing around,

See my test site at https://calstock.org.uk/index.php/test/extended-post

So my post #35 works fine

I'm not happy finding solutions for another peoples problem 'per se', but I do like the process, so I use other people's problems to find processes and that is what I post. I know it may seem inefficient in all you have to read but I wouldn't find it interesting enough if I had to work alone and just post a tidy result.

So again please excuse my method
It better work now :)

Jul 22, 2019 12:56

@amoun … the parse error (see #37) persists even after fixed according to #38

Jul 22, 2019 12:59

So here's the code with proper line numbers and I have attached the file for convenience and viewing, but I had to change the extension from php to txt to enable attachment in this blog.

$Form->begin_fieldset();
		echo $Form->buttonsstart;

			$preview_text = ( $Item->can_attach() ) ? T_('Preview/Add file') : T_('Preview');
		if (isset($current_User))
		{
		$Form->button_input( array( 'name' => 'submit_comment_post_'.$Item->ID.'[preview]', 'class' => 'preview btn-info', 'value' => $preview_text, 'tabindex' => 9 ) );
		}
		$Form->button_input( array( 'name' => 'submit_comment_post_'.$Item->ID.'[save]', 'class' => 'submit SaveButton', 'value' => $params['form_submit_text'], 'tabindex' => 10 ) );


Attachments:

Jul 22, 2019 13:12

@amoun
now I got another Parse error message:
Parse error: syntax error, unexpected '}', expecting end of file in /home/.sites/383/site150/web/blogs/skins/bootstrap_blog_skin/_item_comment_form.inc.php on line 564

But I could fix it.

Now it is working :-.) Thanks very much! Great!

Jul 22, 2019 13:19

OK looks like you're/we're getting there

The code line that needs conditioning. Check the brackets and copy and post the code from line 528 to 534 please.

Ensure you have two closing brackets on the first line
if (isset($current_User))

if (isset($current_User))
		{
		$Form->button_input( array( 'name' => 'submit_comment_post_'.$Item->ID.'[preview]', 'class' => 'preview btn-info', 'value' => $preview_text, 'tabindex' => 9 ) );
		}

This post has 1 feedback awaiting moderation...


Form is loading...

Website builder – This forum is powered by b2evolution CMS, a complete engine for your website.