Open dpacmittal opened 9 years ago
I am facing the same issue. Any update on this?
So, as of now a coauthor selected by get_terms()
can be dropped if
The first case can be filtered out in get_terms()
itself with the exclude
argument, so that' good. The second case can't really be filtered out a priori, as far as I know.
One solution would be to select maybe 20 coauthors already excluding the $ignored
ones, and then filtering for permissions. At this point I expect the resulting set to contain something, at least, but possibly more than 10 coauthors. We may then return at most 10 of them. What do you guys think @philipjohn ?
Even with a limit of 20 we're likely to hit the same issue on a site with a large number of contributors.
What's stopping us from bumping the limit up to something like 100? What effect would that have on the query - would it make it too expensive? If so, could we be clever with caching to limit the impact?
With #544, users who do not have the capability to be added as coauthors will not have a wp_term set up anymore at all, so this problem is likely to be at least 80% fixed. At that point, the limit will just be how many coauthors we are ignoring. For the search results to be empty, the post will have to have 10 coauthors already. If this happens often, we could bump the limit to 20 and we should be fine! Thoughts @philipjohn ? :)
In search_authors() function:
This searches for only 10 terms. The array is then filtered using get_coauthor_by function. Sometimes this leaves the resultset to be empty, when it shouldn't be (because we only looked for 10 terms in the first place).
We should increase the 'number' to more sensible value, or find a better way (using SQL?) to get coauthors from the terms. Another solution would be to loop it until we have atleast X number of results.