Recursive function
-
Hello.
I was wondering if i could get some help. I want to create a function to count all the unread documents in a group.
I already did that for members, but now i’m struggling with this one. This is my approach:
function bp_docs_get_unread_count_group($user_id = false, $group_id) { if ( false === $user_id ) { $user_id = bp_loggedin_user_id(); } $unread_post_count = 0; if (bp_group_hierarchy_has_subgroups()) { // recursively call bp_docs_get_unread_count_group for every child } else { // for every member in the group call bp_docs_get_unread_count and add all the counts } if( $unread_post_count == 0) { $unread_post_count = ''; } return $unread_post_count; }
Can anyone help me?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Recursive function’ is closed to new replies.