Changeset 763873
- Timestamp:
- 08/28/2013 10:30:42 PM (13 years ago)
- Location:
- bp-group-hierarchy/trunk
- Files:
-
- 2 added
- 5 edited
-
bp-group-hierarchy-actions.php (modified) (1 diff)
-
bp-group-hierarchy-classes-legacy.php (added)
-
bp-group-hierarchy-classes.php (modified) (5 diffs)
-
extension.php (modified) (4 diffs)
-
includes/hierarchy.js (modified) (2 diffs)
-
readme.txt (modified) (1 diff)
-
templates/tree/index-compat.php (added)
Legend:
- Unmodified
- Added
- Removed
-
bp-group-hierarchy/trunk/bp-group-hierarchy-actions.php
r758142 r763873 48 48 49 49 if( version_compare( (float)bp_get_version(), '1.9', '>=' ) ) { 50 // Load BP 1.9+ class -- still using same file until the new one is written50 // Load BP 1.9+ class 51 51 require ( dirname( __FILE__ ) . '/bp-group-hierarchy-classes.php' ); 52 52 } else { 53 53 // Load legacy (BP 1.6 - 1.8) class 54 require ( dirname( __FILE__ ) . '/bp-group-hierarchy-classes .php' );54 require ( dirname( __FILE__ ) . '/bp-group-hierarchy-classes-legacy.php' ); 55 55 } 56 56 require ( dirname( __FILE__ ) . '/bp-group-hierarchy-template.php' ); -
bp-group-hierarchy/trunk/bp-group-hierarchy-classes.php
r758142 r763873 1 1 <?php 2 3 /** 4 * Groups class for BuddyPress 1.9+ 5 */ 2 6 3 7 define( 'BP_GROUPS_HIERARCHY_ANY_PARENT', -1 ); … … 184 188 * @param string Slug group slug to check 185 189 * @param int ParentID optional ID of parent group to search (ANY group if omitted) 186 * Not declared as static in parent, but called statically187 */ 188 function check_slug( $slug, $parent_id = BP_GROUPS_HIERARCHY_ANY_PARENT ) {190 * Declared static since BP 1.9 191 */ 192 public static function check_slug( $slug, $parent_id = BP_GROUPS_HIERARCHY_ANY_PARENT ) { 189 193 global $wpdb, $bp; 190 194 … … 213 217 214 218 /** 215 * Not declared as static in parent, but called statically216 */ 217 function group_exists( $path, $parent_id = 0 ) {219 * Declared static since BP 1.9 220 */ 221 public static function group_exists( $path, $parent_id = 0 ) { 218 222 219 223 if(strpos( $path, '/' )) { … … 234 238 235 239 /** 236 * Not declared as static in parent, but called statically237 */ 238 function get_id_from_slug( $slug, $parent_id = 0 ) {240 * Declared static since BP 1.9 241 */ 242 public static function get_id_from_slug( $slug, $parent_id = 0 ) { 239 243 return self::group_exists( $slug, $parent_id ); 240 244 } … … 334 338 335 339 /** 336 * Not declared as static in parent, but called statically337 */ 338 function get_group_extras( $paged_groups, $group_ids, $type = false ) {340 * Declared static since BP 1.9 341 */ 342 public static function get_group_extras( $paged_groups, $group_ids, $type = false ) { 339 343 340 344 foreach($paged_groups as $key => $group) { -
bp-group-hierarchy/trunk/extension.php
r752661 r763873 703 703 /** 704 704 * Change the HTML title to reflect custom Group Tree name 705 * Works with either the BP 1.2 bp_page_title hook or the standard wp_title hook used in BP 1.5+ 706 */ 707 function bp_group_hierarchy_group_tree_title( $full_title, $title, $sep_location = null ) { 705 */ 706 function bp_group_hierarchy_group_tree_title( $title, $sep, $sep_location = null ) { 708 707 global $bp; 709 708 if($sep_location != null) { 710 return bp_group_hierarchy_clean_title( $bp->group_hierarchy->extension_settings['group_tree_name'] ) . ' ' . $title . ' '; 711 } 712 return $full_title . bp_group_hierarchy_clean_title( $bp->group_hierarchy->extension_settings['group_tree_name'] ); 709 return str_replace( 710 sprintf( __( '%s Directory', 'buddypress' ), bp_get_name_from_root_slug() ), 711 bp_group_hierarchy_clean_title( $bp->group_hierarchy->extension_settings['group_tree_name'] ), 712 $title 713 ); 714 } 715 716 // I think this is left over from BP 1.2, so just return the title 717 return $title; 713 718 } 714 719 … … 778 783 add_filter( 'bp_user_can_create_groups', 'bp_group_hierarchy_can_create_any_group', 10, 2 ); 779 784 785 786 /** 787 * (BP 1.7+) Add plugin templates folder to list of available template paths 788 */ 789 function bp_group_hierarchy_register_template_location() { 790 return dirname( __FILE__ ) . '/templates/'; 791 } 792 793 /** 794 * (BP 1.7+) Replace groups/index with tree/index-compat depending on user settings 795 */ 796 function bp_group_hierarchy_maybe_replace_group_loop_template( $templates, $slug, $name ) { 797 798 if( 'groups/index' != $slug ) 799 return $templates; 800 801 return array( 'tree/index-compat.php' ); 802 } 803 780 804 /** 781 805 * Get the party started … … 786 810 add_action( 'wp_ajax_groups_tree_filter', 'bp_dtheme_object_template_loader' ); 787 811 add_action( 'wp_ajax_nopriv_groups_tree_filter', 'bp_dtheme_object_template_loader' ); 812 813 /** Register templates folder for theme compatibility support when available */ 814 if( function_exists( 'bp_register_template_stack' ) ) 815 bp_register_template_stack( 'bp_group_hierarchy_register_template_location' ); 788 816 789 817 $bp->group_hierarchy->extension_settings = array( … … 813 841 * Override BP's default group index with the tree 814 842 */ 815 add_filter( 'groups_template_directory_groups', create_function( '$template', 'return "tree/index";' ) ); 843 if( 844 ! class_exists( 'BP_Theme_Compat' ) || 845 current_theme_supports('buddypress') || 846 in_array( 'bp-default', array( get_stylesheet(), get_template() ) ) 847 ) { 848 add_filter( 'groups_template_directory_groups', create_function( '$template', 'return "tree/index";' ) ); 849 } else { 850 add_filter( 'bp_get_template_part', 'bp_group_hierarchy_maybe_replace_group_loop_template', 10, 3 ); 851 } 816 852 } 817 853 -
bp-group-hierarchy/trunk/includes/hierarchy.js
r508651 r763873 1 1 jQuery(document).ready( function() { 2 3 /** Mark the Group Tree tab active (unless user has been traversing the tree) */ 4 jQuery(window).load(function() { 5 bp_init_objects(["tree"]); 6 }); 7 2 8 /** Add tree class to groups panel for AJAX loading */ 3 9 jQuery('div.groups').addClass('tree'); … … 44 50 return false; 45 51 }); 52 53 /** Set groups scope when a tree button is clicked -- keeps "My Groups" tab from being active after a reload */ 54 jq('div.item-list-tabs').on( 'click', function(event) { 55 if ( jq(this).hasClass('no-ajax') ) 56 return; 57 58 var targetElem = ( event.target.nodeName == 'SPAN' ) ? event.target.parentNode : event.target; 59 var target = jq( targetElem ).parent(); 60 if ( 'LI' == target[0].nodeName && !target.hasClass( 'last' ) ) { 61 var css_id = target.attr('id').split( '-' ); 62 var object = css_id[0]; 63 64 if ( 'tree' != object ) 65 return; 66 67 var scope = css_id[1]; 68 69 jq.cookie('bp-groups-scope', scope, { 70 path: '/' 71 }); 72 } 73 } 46 74 }); -
bp-group-hierarchy/trunk/readme.txt
r758142 r763873 62 62 = 1.4.0 = 63 63 * Removed: Support for BuddyPress 1.5 64 * Added: Support for BuddyPress 1.9 65 * Added: Support for BP theme compatibility mode 66 * Changed: Updated extension class to conform (better) to new BP_Group_Extension guidelines 67 * Fixed: Weird HTML title when hiding the flat group list 68 * Fixed: Wrong tab could be highlighted when loading the Groups list page under certain circumstances - thanks, Mike 64 69 65 70 = 1.3.9 =
Note: See TracChangeset
for help on using the changeset viewer.