The effects of alcohol on sustanon 250 leucine for – real weight loss & bodybuilding benefits?
Search
Close
AI Search
Classic Search
 Search Phrase:
 Search Type:
Advanced search options
 Search in Forums:
 Search in date period:

 Sort Search Results by:

AI Assistant
Notifications
Clear all

[Solved] O comments, again

6 Posts
2 Users
3 Reactions
2,035 Views
(@albert)
Posts: 10
Active Member
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 
[#3373]

Hi again.
A couple of weeks ago you solved a problem i have. I wanted to leave a blank field instead of displaying '0 comments'. Check this forum topic https://wpdiscuz.com/community/troubleshooting/0-comments/

The solution works fine but, after a couple of weeks, I've realized it causes a Fatal Error in Wordpress dashboard. Find the attached txt to see it. 

The website works fine and wpdiscuz works fine too, but the error message keeps showing up in the dashboard.

I've run some tests and I've found out the error only shows up with this part of the code https://wpdiscuz.com/community/postid/11740/

This other part is ok and causes no error
https://wpdiscuz.com/community/postid/11714/

Can you help?

Thanks alot

Albert

 


 
Posted : 05/11/2021 5:12 pm
Asti
 Asti
(@asti)
Posts: 8267
Illustrious Member Support
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

@albert,

Please clarify a bit, if you remove the hook-code haven't you seen the issue? 


In case you want to say thank you! 🙂
We'd really appreciate if you leave a good review on the plugin page.
This is the best way to say thank you to this project and the support team.

 
Posted : 05/11/2021 5:35 pm
(@albert)
Posts: 10
Active Member
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

When If I write this first part of the code, no problem. There's no issue. Everything's OK

if (!function_exists("wpdGetCommentsCountText")) {
        add_filter("wpdiscuz_comment_count_phrase", "wpdGetCommentsCountText", 10, 2);
        function wpdGetCommentsCountText($text, $commentsCount) {
            $count = (int) $commentsCount;
            if ($count) {
                return $text;
            }
            return "";
        }
    }

When i add this second part of the code the issue shows up. It seems that this part is causing the issue.

add_filter('get_comments_number', function ($count){
    if($count == 0){
        return '';
    }
    return $count;
});

Hope it helps


 
Posted : 05/11/2021 5:55 pm
Asti
 Asti
(@asti)
Posts: 8267
Illustrious Member Support
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

@albert,

I'll ask the developers about the issue and let you know ASAP


In case you want to say thank you! 🙂
We'd really appreciate if you leave a good review on the plugin page.
This is the best way to say thank you to this project and the support team.

 
Posted : 05/11/2021 6:09 pm
Albert reacted
Asti
 Asti
(@asti)
Posts: 8267
Illustrious Member Support
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

@albert,

When i add this second part of the code the issue shows up. It seems that this part is causing the issue.

Please replace the code with the following one:

add_filter('get_comments_number', function ($count) {
        if (is_single()) {
            if ($count == 0) {
                return '';
            }
        }
        return $count;
    });

In case you want to say thank you! 🙂
We'd really appreciate if you leave a good review on the plugin page.
This is the best way to say thank you to this project and the support team.

 
Posted : 06/11/2021 11:58 am
Albert reacted
(@albert)
Posts: 10
Active Member
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

Yes!!!
Everything works fine!!
'0 Comments' is gone and there's no 'fatal error' issue.

Great thanks!
Fabulous support, as always!!


 
Posted : 06/11/2021 12:06 pm
Asti reacted