show doc counts in group and user tabs, fixes #423 #442
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi Boone,
Here's my fix for our issue at mlaa#1, which may help out with #423 and #261. My understanding of the problem was:
update_doc_count()
wasn't working, because it relies on usingbp_is_group
to check whether we're creating or deleting a group document, andbp_is_group
returned 0, because, judging from the slug/docs
at least, BP didn't know that it was in a group context.update_doc_count()
weren't working, since they were hooked in usingadd_filter
instead ofadd_action
, and the hooksbp_docs_doc_saved
andbp_docs_doc_deleted
appear to be action hooks instead of filter hooks.This fixes the issue by rewriting
update_doc_count()
so that it can tell, through a variety of methods, what group the doc is associated with (if any), and update the groupmeta accordingly. It's probably not the most elegant solution, but seems to be working so far.Let me know what you think.