[buddypress-trac] [BuddyPress] #914: Division by zero error in /buddypress/bp-activity/bp-activity-templatetags.php on line 56

buddypress-trac at lists.automattic.com buddypress-trac at lists.automattic.com
Fri Aug 7 16:39:43 UTC 2009


#914: Division by zero error in /buddypress/bp-activity/bp-activity-
templatetags.php on line 56
--------------------------+-------------------------------------------------
  Reporter:  jacobwg      |       Owner:  jacobwg
      Type:  enhancement  |      Status:  closed 
  Priority:  major        |   Milestone:  1.1    
Resolution:  worksforme   |    Keywords:         
--------------------------+-------------------------------------------------
Changes (by jacobwg):

  * status:  accepted => closed
  * type:  defect => enhancement
  * resolution:  => worksforme


Comment:

 Okay, I found the issue: my widget for sitewide activity didn't have a Max
 Items set.  You might consider adding a catch in the bp-activity-
 widget.php file (around line 25 so that line 26 would not execute if
 {{{$instance['max_items']}}} was set to 0 or was undefined.  If it was set
 to 0 or undefined, you could then display a message that would alert the
 user of the missing setting.  Something like (lines 26-62):

 {{{
         <?php
                 if ( $instance['max_items'] ) {
                         if ( bp_has_activities( 'type=sitewide&max=' .
 $instance['max_items'] . '&per_page=' . $instance['per_page'] ) ) { ?>
                         <div class="pag-count" id="activity-count">
                                 <?php bp_activity_pagination_count() ?>
                         </div>

                         <div class="pagination-links" id="activity-pag">
                                 &nbsp; <?php
 bp_activity_pagination_links() ?>
                         </div>

                         <ul id="activity-filter-links">
                                 <?php bp_activity_filter_links() ?>
                         </ul>

                         <ul id="site-wide-stream" class="activity-list">
                         <?php while ( bp_activities() ) :
 bp_the_activity(); ?>
                                 <li class="<?php bp_activity_css_class()
 ?>">
                                         <?php bp_activity_content() ?>
                                 </li>
                         <?php endwhile; ?>
                         </ul>

                 <?php } else { ?>

                         <div class="widget-error">
                                 <?php _e('There has been no recent site
 activity.', 'buddypress') ?>
                         </div>

                 <?php }
                 } else { ?>

                         <div class="widget-error">
                                 <?php _e('Please set the number of items
 per page setting in your widget configuration.', 'buddypress') ?>
                         </div>

                 <?php } ?>
 }}}

-- 
Ticket URL: <http://trac.buddypress.org/ticket/914#comment:4>
BuddyPress <http://buddypress.org/>
BuddyPress


More information about the buddypress-trac mailing list