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

Add the ability to enable/disable comments per post #816

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

KuJoe
Copy link
Contributor

@KuJoe KuJoe commented Sep 14, 2024

Provide a drop down in the add/edit posts for the author to specify if comments should be enabled or disabled for that specific post. Addresses issue #794

Provide a drop down in the add/edit posts for the author to specify if comments should be enabled or disabled for that specific post.
Themes were incorrectly using the method from the issue that was opened which wasn't the best solution for all themes. Switched to a better, more uniform solution.
@danpros
Copy link
Owner

danpros commented Sep 14, 2024

Sorry but we should use more simpler method so we do not need to change existing themes or change the get/post during content edit/create.

We just need to use read more or toc method. Check if the no-comment tag available or not than return empty for any printed comment scripts based on those tag availability:

// Disqus on post.
function disqus($title = null, $url = null)
{
    if (!check_comments_state()) {
       return false;
    }
// ...
}

@KuJoe
Copy link
Contributor Author

KuJoe commented Sep 15, 2024

You're 100% right, I don't know why I didn't think of that. I guess I had tunnel vision from the issue example.

@danpros
Copy link
Owner

danpros commented Sep 15, 2024

Just checking the workflow and seems not possible without changing some of the theme code. At least we need this kind of code (example from your PR):

$post->comments = check_comments_state($content);

Some possible solutions that could be implemented, the $post->comments contains the comment scripts?

But no need to modify the post/get.

@KuJoe
Copy link
Contributor Author

KuJoe commented Sep 15, 2024

I'm thinking instead of having specific calls to Facebook and Disqus in the themes, we change the specific functions into a single function that will return the script for the comment system that is selected, this way if other comment systems are added or removed in the future we won't need to make any changes to the themes and just keep them consolidated into one function call. What do you think?

@danpros
Copy link
Owner

danpros commented Sep 15, 2024

Sure, like comments($post) is enough because many vars on $post or $p.

Edit: and we should not remove the old functions, for older theme compatibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants