Changeset 2077 for trunk/bp-groups/bp-groups-widgets.php
- Timestamp:
- 11/02/2009 07:54:21 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/bp-groups/bp-groups-widgets.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-groups/bp-groups-widgets.php
r1926 r2077 3 3 /* Register widgets for groups component */ 4 4 function groups_register_widgets() { 5 add_action('widgets_init', create_function('', 'return register_widget("BP_Groups_Widget");') ); 5 add_action('widgets_init', create_function('', 'return register_widget("BP_Groups_Widget");') ); 6 6 } 7 7 add_action( 'plugins_loaded', 'groups_register_widgets' ); … … 12 12 function bp_groups_widget() { 13 13 parent::WP_Widget( false, $name = __( 'Groups', 'buddypress' ) ); 14 14 15 15 if ( is_active_widget( false, false, $this->id_base ) ) 16 wp_enqueue_script( 'groups_widget_groups_list-js', BP_PLUGIN_URL . '/bp-groups/js/widget-groups.js', array('jquery', 'jquery-livequery-pack') ); 16 wp_enqueue_script( 'groups_widget_groups_list-js', BP_PLUGIN_URL . '/bp-groups/js/widget-groups.js', array('jquery', 'jquery-livequery-pack') ); 17 17 } 18 18 19 19 function widget($args, $instance) { 20 20 global $bp; 21 21 22 22 extract( $args ); 23 23 24 24 echo $before_widget; 25 25 echo $before_title 26 . $widget_name 26 . $widget_name 27 27 . $after_title; ?> 28 28 29 29 <?php if ( bp_has_site_groups( 'type=popular&per_page=' . $instance['max_groups'] . '&max=' . $instance['max_groups'] ) ) : ?> 30 30 <div class="item-options" id="groups-list-options"> 31 31 <span class="ajax-loader" id="ajax-loader-groups"></span> 32 <a href="<?php echo site_url() . '/' . $bp->groups->slug ?>" id="newest-groups"><?php _e("Newest", 'buddypress') ?></a> | 33 <a href="<?php echo site_url() . '/' . $bp->groups->slug ?>" id="recently-active-groups"><?php _e("Active", 'buddypress') ?></a> | 32 <a href="<?php echo site_url() . '/' . $bp->groups->slug ?>" id="newest-groups"><?php _e("Newest", 'buddypress') ?></a> | 33 <a href="<?php echo site_url() . '/' . $bp->groups->slug ?>" id="recently-active-groups"><?php _e("Active", 'buddypress') ?></a> | 34 34 <a href="<?php echo site_url() . '/' . $bp->groups->slug ?>" id="popular-groups" class="selected"><?php _e("Popular", 'buddypress') ?></a> 35 35 </div> 36 36 37 37 <ul id="groups-list" class="item-list"> 38 38 <?php while ( bp_site_groups() ) : bp_the_site_group(); ?> … … 49 49 50 50 <?php endwhile; ?> 51 </ul> 51 </ul> 52 52 <?php wp_nonce_field( 'groups_widget_groups_list', '_wpnonce-groups' ); ?> 53 53 <input type="hidden" name="groups_widget_max" id="groups_widget_max" value="<?php echo attribute_escape( $instance['max_groups'] ); ?>" /> 54 54 55 55 <?php else: ?> 56 56 … … 60 60 61 61 <?php endif; ?> 62 62 63 63 <?php echo $after_widget; ?> 64 64 <?php … … 84 84 function groups_ajax_widget_groups_list() { 85 85 global $bp; 86 86 87 87 check_ajax_referer('groups_widget_groups_list'); 88 88 … … 101 101 if ( bp_has_site_groups( 'type=' . $type . '&per_page=' . $_POST['max_groups'] . '&max=' . $_POST['max_groups'] ) ) : ?> 102 102 <?php echo "0[[SPLIT]]"; ?> 103 103 104 104 <ul id="groups-list" class="item-list"> 105 105 <?php while ( bp_site_groups() ) : bp_the_site_group(); ?> … … 113 113 <div class="item-meta"> 114 114 <span class="activity"> 115 <?php 115 <?php 116 116 if ( 'newest-groups' == $_POST['filter'] ) { 117 117 bp_the_site_group_date_created(); … … 128 128 129 129 <?php endwhile; ?> 130 </ul> 130 </ul> 131 131 <?php wp_nonce_field( 'groups_widget_groups_list', '_wpnonce-groups' ); ?> 132 132 <input type="hidden" name="groups_widget_max" id="groups_widget_max" value="<?php echo attribute_escape( $_POST['max_groups'] ); ?>" /> 133 133 134 134 <?php else: ?> 135 135 … … 137 137 138 138 <?php endif; 139 139 140 140 } 141 141 add_action( 'wp_ajax_widget_groups_list', 'groups_ajax_widget_groups_list' );
Note: See TracChangeset
for help on using the changeset viewer.