PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Fri Dec 15, 2017 5:08 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 115 posts ]  Go to page Previous  1 ... 4, 5, 6, 7, 8
Author Message
PostPosted: Tue Sep 19, 2017 5:32 am 
Offline
DevNet Master

Joined: Wed Oct 08, 2008 3:39 pm
Posts: 4377
Location: United Kingdom
But why is it now doing that - if I switch it back to the previous function and file, it doesn't do it. Is something in there making them all appear when they shouldn't?

_________________
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.


Top
 Profile  
 
PostPosted: Tue Sep 19, 2017 5:34 am 
Offline
Moderator
User avatar

Joined: Tue Nov 09, 2010 3:39 pm
Posts: 6403
Location: Montreal, Canada
Apparently. You'd need to dig through the code and find where get_comments is being called, and with which arguments. You can pull those arguments up to your get_comments call if you like, or you can modify whatever function calls get_comments by default and pull all of our changes higher. Either way seems fine, but the latter is obviously going to be more work.

_________________
Supported PHP versions No longer supported versions


Top
 Profile  
 
PostPosted: Tue Sep 19, 2017 5:39 am 
Offline
Moderator
User avatar

Joined: Tue Nov 09, 2010 3:39 pm
Posts: 6403
Location: Montreal, Canada
https://codex.wordpress.org/Function_Re ... t_comments

Looks like the status argument is what you're after.

_________________
Supported PHP versions No longer supported versions


Top
 Profile  
 
PostPosted: Tue Sep 19, 2017 6:03 am 
Offline
DevNet Master

Joined: Wed Oct 08, 2008 3:39 pm
Posts: 4377
Location: United Kingdom
I don't see that argument in the new code. What's puzzling me is why the 'NEW' code is "unlocking" the standard feature of showing only comments that are approved.

_________________
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.


Top
 Profile  
 
PostPosted: Tue Sep 19, 2017 6:10 am 
Offline
Moderator
User avatar

Joined: Tue Nov 09, 2010 3:39 pm
Posts: 6403
Location: Montreal, Canada
simonmlewis wrote:
I don't see that argument in the new code.

That was my point.

simonmlewis wrote:
What's puzzling me is why the 'NEW' code is "unlocking" the standard feature of showing only comments that are approved.

Because we're overriding the default behaviour in order to accomplish a set of goals the default behaviour doesn't allow for. We're necessarily doing things differently. Adding that missing key to the get_comments in the modified code should resolve the issue.

_________________
Supported PHP versions No longer supported versions


Top
 Profile  
 
PostPosted: Tue Sep 19, 2017 6:27 am 
Offline
DevNet Master

Joined: Wed Oct 08, 2008 3:39 pm
Posts: 4377
Location: United Kingdom
Adding it where....??

_________________
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.


Top
 Profile  
 
PostPosted: Tue Sep 19, 2017 7:59 am 
Offline
Moderator
User avatar

Joined: Tue Nov 09, 2010 3:39 pm
Posts: 6403
Location: Montreal, Canada
Do you see where post_id gets passed into get_comments? Just add another key/value pair to that array.

_________________
Supported PHP versions No longer supported versions


Top
 Profile  
 
PostPosted: Tue Sep 19, 2017 8:14 am 
Offline
DevNet Master

Joined: Wed Oct 08, 2008 3:39 pm
Posts: 4377
Location: United Kingdom
Syntax: [ Download ] [ Hide ]
$comments = get_comments(['post_id' => get_the_ID()] ['post_id' => get_the_ID()]);

Changing the last bit ??

_________________
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.


Top
 Profile  
 
PostPosted: Tue Sep 19, 2017 8:19 am 
Offline
Moderator
User avatar

Joined: Tue Nov 09, 2010 3:39 pm
Posts: 6403
Location: Montreal, Canada
simonmlewis wrote:
Syntax: [ Download ] [ Hide ]
$comments = get_comments(['post_id' => get_the_ID()] ['post_id' => get_the_ID()]);

Changing the last bit ??


That's the right spot, but that syntax is no good and you're missing the status key. Try something like this
Syntax: [ Download ] [ Hide ]
$comments = get_comments(['post_id' => get_the_ID(), 'status' => 'approve']);

_________________
Supported PHP versions No longer supported versions


Top
 Profile  
 
PostPosted: Tue Sep 19, 2017 10:51 am 
Offline
DevNet Master

Joined: Wed Oct 08, 2008 3:39 pm
Posts: 4377
Location: United Kingdom
Gotcha. Can you see why when they post the comment it now doesn't show their 'own' new comment waiting for moderation?
It use to do that as a way of saying "we have it, just needs moderating".
I'm sure it's something down in that function that at the moment shows only if it's live.

_________________
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 115 posts ]  Go to page Previous  1 ... 4, 5, 6, 7, 8

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group