Saif Altalib 2024-10-24T14:50:00-04:00

Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • Saif Altalib
    Participant
    Post count: 2

    We got it to work by removing the following code from the achievement-reports.php page:

       // If Buddy Press is activated, only then display Group Filters
        if( class_exists( 'BP_Groups_Group' ) && bp_is_active( 'groups' ) && class_exists("BadgeOS_Group_Management")){
    
            // Query filter for tables based on groups
            if(isset($_REQUEST['groups']) && !empty($_REQUEST['groups']))
            $group_filter = "AND groups.id = ".$_REQUEST['groups'];
    
            // Query filter for tables based on users
            if(badgeos_get_user_role()=="school_admin"){
                $usermeta_filter = "AND usermeta.meta_key = 'school_id' AND usermeta.meta_value =".get_current_user_id();
            }elseif(badgeos_get_user_role()=="author"){
                /*$usermeta_filter = " AND (usermeta.meta_key = 'school_id' AND usermeta.meta_value =".badgeos_get_school_id()."
                                   OR usermeta.meta_key = 'teacher_id' AND usermeta.meta_value =".get_current_user_id().")";   */
                $usermeta_filter = " AND usermeta.meta_key = 'teacher_id' AND usermeta.meta_value =".get_current_user_id();
            }
    
            // Load Groups drop down based on user roles
            $user_role = badgeos_get_user_role( absint( get_current_user_id() ));
            $user_id = ($user_role=="author")?absint( get_current_user_id() ):'';
            $group_meta_query = ($user_role=="school_admin")?array ( array ('key' => 'school_id','value' => absint( get_current_user_id() ) ) ):'';
    
            $bp_public_groups = groups_get_groups(
                array(
                    'user_id' => $user_id,
                    'meta_query' => $group_meta_query,
                    'orderby' => 'name',
                    'order'   => 'ASC'
                )
            );
    
            $selected_id = isset( $_REQUEST['groups'] ) ? absint( $_REQUEST['groups'] ) : 0;
    
            if ( $bp_public_groups['total'] > 0 ) {
                $groups_drop_down = '<h3>Groups:</h3>';
                $groups_drop_down .= ' <select name="groups" id="groups" class="achievement-reports" onchange="this.form.submit()" style="max-width: 15%" form="report-filter">';
                $groups_drop_down .= '<option value="">' . __( 'All', 'badgeos-reports' ) . '</option>';
                foreach( $bp_public_groups['groups'] as $group ) {
    
                    if($user_role=="author" && !groups_is_user_admin($user_id,$group->id))
                        continue;
    
                    $groups_drop_down .= '<option value="' . absint( $group->id ) . '" ' . selected( $selected_id, $group->id, false ) . '>' . esc_attr( $group->name ) . '</option>';
                }
                $groups_drop_down .= '</select>';
            }
        }
    
    Saif Altalib
    Participant
    Post count: 2

    I am experiencing the same problem. All the custom achievement report links are blank. Only the “Active Users Report” is working. Need help ASAP please.

Viewing 2 posts - 1 through 2 (of 2 total)