The effects of alcohol on
sustanon 250 leucine for – real weight loss & bodybuilding benefits?
Hiding Comments
Summarize Topic
✦
✦
✦
AI is analyzing the discussion...
How-to and Troubleshooting
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
Show original
Translating...
Nov 08, 2021 3:57 pm
(@aaronmckeon)
Trusted Member
Joined: 5 years ago
I need to programmatically hide and disable comments on certain posts depending on a user's role. However, the typical code for hiding comments is not working. With wpDiscuz deactivated, the comments disappear. With wpDiscuz, the code has no effect. Can you suggest a better code that would eliminate comments entirely from a page? This was run during the template_redirect action.
$comments = array();
return $comments;
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
Show original
Translating...
Nov 08, 2021 4:31 pm
(@asti)
Illustrious Member
Joined: 8 years ago
@aaronmckeon ,
You can do it using the wpDiscuz options.
First of all, you should create a new comment form and enable it for certain post IDs. The option calls Display comment form for post IDs. More info here: https://wpdiscuz.com/docs/wpdiscuz-7/getting-started/manage-comment-forms/comment-form-settings/#comment_form_for_post_id
In the next step, you should find the "Hide comment section for roles" section on the form add/edit section and select certain user roles.
(@aaronmckeon)
Joined: 5 years ago
Trusted Member
Posts: 47
Nov 08, 2021 4:43 pm
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
Show original
Translating...
@asti Thanks for the quick reply, although unfortunately it's not quite that simple. Some of our posts are categorized as premium (requiring a particular role) and some are not. This is set by a custom taxonomy called "access-control". I have a code snippet in place that contains all the logic, but the one piece I can't figure out is how to get rid of comments.
For example, one post may be set to "public" and another may be set to "tier-2" (requiring a tier-2 membership to the site). If a user is logged in with an unpaid account and the post is set to require tier-2, the comments need to be hidden. So, I'm hoping there is a line of code that would allow me to stop wpDiscuz for rendering on the page that I can then insert into my code snippet.
-- Aaron
(@asti)
Joined: 8 years ago
Illustrious Member
Posts: 8299
Nov 08, 2021 5:42 pm
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
Show original
Translating...
@aaronmckeon ,
Please provide us with the following information:
Please send us the admin login details
Provide some testing user's (User A) login details that should be restricted to see the content of some pages
Provide us some example URL where the testing user (User A) should not see the content
Please send all those information to info[at]gvectors.com email address. I'll ask the developers to check the issue and provide some solutions for you if it's possible.
Otherwise, they'll add a new hook in the next version of the wpDiscuz plugin.
(@aaronmckeon)
Joined: 5 years ago
Trusted Member
Posts: 47
Nov 08, 2021 7:44 pm
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
Show original
Translating...
@asti Thanks - just sent the e-mail with all requested information.
(@asti)
Joined: 8 years ago
Illustrious Member
Posts: 8299
Nov 09, 2021 1:31 pm
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
Show original
Translating...
ok, thank you.
We'll check and back to you ASAP.
(@asti)
Joined: 8 years ago
Illustrious Member
Posts: 8299
Nov 09, 2021 3:15 pm
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
Show original
Translating...
We'll add a new hook in the next version, so you'll be able to get it to work as you like.
(@aaronmckeon)
Joined: 5 years ago
Trusted Member
Posts: 47
Nov 09, 2021 4:35 pm
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
Show original
Translating...
@asti Excellent, thanks. Can you tell me about how soon that would be? I'm just trying to gauge if it'll be before my site is scheduled to go live.
- Aaron
(@asti)
Joined: 8 years ago
Illustrious Member
Posts: 8299
Nov 09, 2021 4:43 pm
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
Show original
Translating...
@aaronmckeon ,
We do all our best to release it ASAP. I'll update this topic once it's ready.
(@aaronmckeon)
Joined: 5 years ago
Trusted Member
Posts: 47
Nov 23, 2021 8:15 pm
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
Show original
Translating...
@asti Just checking in on this. I noticed an update get released and wasn't sure if this were included. We are planning on going live this Friday and if this fix isn't in place we'll need to come up with a workaround. Thanks for any updates.
(@asti)
Joined: 8 years ago
Illustrious Member
Posts: 8299
Nov 24, 2021 2:40 pm
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
Show original
Translating...
@aaronmckeon ,
The hook isn't added yet. It'll be available in the next version (no ETA yet).
(@asti)
Joined: 8 years ago
Illustrious Member
Posts: 8299
Nov 26, 2021 2:06 pm
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
Show original
Translating...
@aaronmckeon ,
Here we also need the admin login details. Please send it to us again to info[at]gvectors.com email address.
(@aaronmckeon)
Joined: 5 years ago
Trusted Member
Posts: 47
Nov 26, 2021 3:32 pm
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
Show original
Translating...
(@asti)
Joined: 8 years ago
Illustrious Member
Posts: 8299
Nov 30, 2021 4:29 pm
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
Show original
Translating...
@aaronmckeon ,
The new hook is already added. It's called wpdiscuz_load_template. More info here: https://wpdiscuz.com/docs/codex/filters/wpdiscuz_load_template/
(@aaronmckeon)
Joined: 5 years ago
Trusted Member
Posts: 47
Nov 30, 2021 5:51 pm
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
Show original
Translating...
@asti Great news, thanks. I'm trying to call this as part of another function, which currently runs inside the 'template_redirect' action, but it doesn't seem to be working. Can you confirm if this is possible? Below please find a shortened version of my code so you understand what I'm doing:
add_action( 'template_redirect', 'pp_disable_access' );
function pp_disable_access($post_object) {
some code here to determine if comments should be hidden...
if ($pp_disable_view_comments == true) {
add_filter("wpdiscuz_load_form_and_comments", '__return_false', 10 ,3);
}
}
(@aaronmckeon)
Joined: 5 years ago
Trusted Member
Posts: 47
Nov 30, 2021 6:00 pm
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
Show original
Translating...
@asti PS - I also tried running it by copying and pasting it exactly as you have it in your documentation and it does not hide comments if you are not logged in. Let me know if you think I'm doing something wrong. Thanks.
(@asti)
Joined: 8 years ago
Illustrious Member
Posts: 8299
Dec 01, 2021 2:39 pm
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
Show original
Translating...
@aaronmckeon ,
You've added the hook name incorrectly
It should be wpdiscuz_load_template.
Super Globals
Options and Features