Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comment turned off #3680

Closed
fizi opened this issue Feb 17, 2019 · 24 comments
Closed

Comment turned off #3680

fizi opened this issue Feb 17, 2019 · 24 comments
Assignees
Labels
core: news status: awaiting feedback This issue may be fixed and is awaiting the original poster to confirm the fix. type: enhancement An improvement or new feature request
Milestone

Comments

@fizi
Copy link

fizi commented Feb 17, 2019

If I turned off the comment (cpage) the comment turned off message not appears ("comment rurned off for this item").

@Moc Moc added the status: testing required Someone needs to confirm this issue's existence and write a test to prevent the fix from regressing. label Feb 19, 2019
@Moc Moc self-assigned this Feb 19, 2019
@Moc
Copy link
Member

Moc commented Sep 17, 2019

@fizi Which LAN is supposed to display? I can only find LAN_THEME_1 which is specific to the _blank theme

@Moc Moc added the status: awaiting feedback This issue may be fixed and is awaiting the original poster to confirm the fix. label Sep 17, 2019
@fizi
Copy link
Author

fizi commented Sep 17, 2019

If I disable the comment example on the nesw item - "Comments are locked" - not appears the text on the News. If I enable the comment the number of comments appears.

@Moc Moc removed the status: awaiting feedback This issue may be fixed and is awaiting the original poster to confirm the fix. label Sep 18, 2019
@Moc
Copy link
Member

Moc commented Sep 23, 2019

I found the reason why, but question (perhaps also for @Jimmi08): when comments on news items are disabled, do you really want to show the text that comments are locked? I can make it like this for example:

image

and for non-bootstrap:
image

BUT, I can also imagine that you may want to display nothing at all... Ideally, this should be defined by templating but as far as I can see, this method is called anyway regardless of the template.

@Moc Moc added core: news type: enhancement An improvement or new feature request and removed status: testing required Someone needs to confirm this issue's existence and write a test to prevent the fix from regressing. labels Sep 23, 2019
@Moc
Copy link
Member

Moc commented Sep 23, 2019

The same situation applies to custom pages.

Self note:

news: renderComments() in news.php
custom pages: cpagecomments() in page_shortcodes.php

@Moc Moc added the status: awaiting feedback This issue may be fixed and is awaiting the original poster to confirm the fix. label Sep 23, 2019
@Moc
Copy link
Member

Moc commented Sep 23, 2019

For custom pages. It can be controlled through templating.
I guess we need to modify the news template to do the same thing, so the display of the locked message can be controlled by the template.

Do you agree? @fizi @Jimmi08

@Jimmi08
Copy link
Contributor

Jimmi08 commented Sep 23, 2019

@Moc
The correct solution for me (it doesn't mean it's good):

  • new post/page - comments OFF, no message
  • post with comments, then you set comment OFF, message - commenting was set off.

OR

Allow users to post comments NO - no message (general off, commenting is not available)
Allow users to post comments YES - message, if commenting is set off.

I have no idea (no tested) what happens if there are already comments and you change post/page settings.

@Moc
Copy link
Member

Moc commented Sep 25, 2019

@Jimmi08 Yeah I would agree with your second option. I am not a fan of option 1 because it would require storing the 'history' of news items.

@fizi
Copy link
Author

fizi commented Sep 25, 2019

I test it...the shortcode {NEWSCOMMENTS} on/off with text work on News page but not work on extend news.

Moc added a commit that referenced this issue Oct 2, 2019
@Moc Moc closed this as completed in d3978f3 Oct 2, 2019
@Moc
Copy link
Member

Moc commented Oct 2, 2019

Done. Please test and let me know if this is how you want it.

@fizi
Copy link
Author

fizi commented Oct 2, 2019

I tested it but… if the comments disabled the text appears on the News page (see it)
news1
but not appears on the extend news page (see it)
extend_news1

A see you made it that the text appears in the textbox (If you think this is better, then ok)

@Moc Moc reopened this Oct 2, 2019
@Moc
Copy link
Member

Moc commented Oct 11, 2019

@fizi Well this doesn't look good haha. Which theme are you using in the screenshot? What is the shortcode that is used in the news template to display that bit that you circled?

@Moc Moc added this to the e107 2.2.2 milestone Oct 11, 2019
@Moc
Copy link
Member

Moc commented Oct 11, 2019

I see this is your own theme. Does it use a custom news template? If yes, can you share that news template code with me please? You can send it by email or on Gitter.

@Moc
Copy link
Member

Moc commented Nov 5, 2019

@fizi can you please give me some feedback on this? :) What is the shortcode that is used to display the text that you circled in your screenshot?

@fizi
Copy link
Author

fizi commented Nov 5, 2019

I use {NEWSCOMMENTS} shortcode.

@Moc
Copy link
Member

Moc commented Nov 22, 2019

@fizi I cannot reproduce this at all. The {NEWSCOMMENTS} will output ''Disabled" when the comments are disabled. I do not see why it would output "Comments are turned off for this item" in that place.

What are your settings for:

  • "Allow users to post comments" in the Comments manager.
  • News item "Free theme - BS Gaming 03" > Advanced options > Comments

@Moc
Copy link
Member

Moc commented Apr 28, 2020

@fizi Do you still experience this issue with the latest files?

@Moc Moc removed this from the e107 2.3.0 milestone May 20, 2020
@Moc
Copy link
Member

Moc commented Jul 10, 2020

Reminder: add pref to enable/disable showing the comments locked message. Or debug message? Admin only?

@Moc Moc modified the milestones: Future, e107 2.3.0 Jul 13, 2020
@Jimmi08
Copy link
Contributor

Jimmi08 commented Jul 16, 2020

@Moc
for pages there is no scenario when you want to displays this message. Either it is standalone page and you don't want comments at all or you want comments and you set them on.

It is something different than for news.

So part solution is changing only cpagecomments() for now.

	// Not a shortcode really, as it shouldn't be cached at all :/
	function cpagecomments()
	{
		$com 		= $this->var['comments'];
		$comflag 	= $this->var['page_comment_flag'];
 
		//if($parm && isset($com[$parm])) return $com[$parm];
		if($comflag)
		{
			return e107::getComment()->parseLayout($com['comment'],$com['comment_form'],$com['moderate']);	
		}
        else return '';
		
	//	return $com['comment'].$com['moderate'].$com['comment_form'];
	}

@Moc
Copy link
Member

Moc commented Jan 29, 2021

Reminder for myself. Make this a debug message.

@Moc Moc modified the milestones: Future, e107 2.3.1 Jan 29, 2021
@Moc Moc closed this as completed in 4345df5 Feb 2, 2021
@Moc
Copy link
Member

Moc commented Feb 2, 2021

Reminder: add pref to enable/disable showing the comments locked message. Or debug message? Admin only?

Changed the message to a debug message which is shown to admins only.

I think this issue can now be closed. Please let me know if there are any questions or suggestions related to this issue.

@fizi If you can still reproduce the issue you posted in your screenshot, let me know and I'll figure it out.

@Jimmi08
Copy link
Contributor

Jimmi08 commented Feb 2, 2021

@Moc Why don't you test e_DEBUG? It is annoying for admins too...

@Moc
Copy link
Member

Moc commented Feb 2, 2021

It should only display when debug mode is enabled (because of e107::getMessage()->addDebug()).

It may occur on non-bootstrap themes though, you have point there.

@Moc
Copy link
Member

Moc commented Feb 2, 2021

Done

@Jimmi08
Copy link
Contributor

Jimmi08 commented Mar 14, 2022

@Moc
Could you or somebody check/test condition in function cpagecomments() ?

there is code for comments off:

if(e107::getPref('comments_disabled') == 0 && !$comflag)

but comment_class uses (for not to display comment form)

		if(isset($pref['comments_disabled']) && $pref['comments_disabled'] == TRUE)
		{
			
        	return FALSE;
		}

It could be confusing because comment manager uses this in inverse way...

That shortcode should maybe look like this:

	function cpagecomments()
	{
		$com 		= $this->var['comments'];
		$comflag 	= $this->var['page_comment_flag'];
 
        if(isset(e107::getPref('comments_disabled')) && e107::getPref('comments_disabled') == TRUE) {
            return '';
        }
 
		if($comflag)
		{
			return e107::getComment()->parseLayout($com['comment'],$com['comment_form'],$com['moderate']);	
		}
        else {
        
            if(ADMIN && deftrue('e_DEBUG'))
  			{
  				if(defined('BOOTSTRAP') && BOOTSTRAP)
  				{
  					return e107::getMessage()->addDebug(LAN_PAGE_17)->render(); 
  				}
  				else
  				{
  					return "<br /><div style='text-align:center'><b>".LAN_PAGE_17."</b></div>";
  				}
  			}
        }
		
	//	return $com['comment'].$com['moderate'].$com['comment_form'];
	}

Or like with news (there is different logic/order of checks)

// Only show message if global comments are enabled, but current news item comments are disabled
if(e107::getPref('comments_disabled') == 0 && $news['news_allow_comments'] == 1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core: news status: awaiting feedback This issue may be fixed and is awaiting the original poster to confirm the fix. type: enhancement An improvement or new feature request
Projects
None yet
Development

No branches or pull requests

4 participants