Plugin Directory

Changeset 763873


Ignore:
Timestamp:
08/28/2013 10:30:42 PM (13 years ago)
Author:
ddean
Message:

Bunch of changes and new stuff - check the readme changelog for a list

Location:
bp-group-hierarchy/trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • bp-group-hierarchy/trunk/bp-group-hierarchy-actions.php

    r758142 r763873  
    4848
    4949    if( version_compare( (float)bp_get_version(), '1.9', '>=' ) ) {
    50         // Load BP 1.9+ class -- still using same file until the new one is written
     50        // Load BP 1.9+ class
    5151        require ( dirname( __FILE__ ) . '/bp-group-hierarchy-classes.php' );
    5252    } else {
    5353        // 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' );
    5555    }
    5656    require ( dirname( __FILE__ ) . '/bp-group-hierarchy-template.php' );
  • bp-group-hierarchy/trunk/bp-group-hierarchy-classes.php

    r758142 r763873  
    11<?php
     2
     3/**
     4 * Groups class for BuddyPress 1.9+
     5 */
    26
    37define( 'BP_GROUPS_HIERARCHY_ANY_PARENT', -1 );
     
    184188     * @param string Slug group slug to check
    185189     * @param int ParentID optional ID of parent group to search (ANY group if omitted)
    186      * Not declared as static in parent, but called statically
    187      */
    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 ) {
    189193        global $wpdb, $bp;
    190194
     
    213217   
    214218    /**
    215      * Not declared as static in parent, but called statically
    216      */
    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 ) {
    218222       
    219223        if(strpos( $path, '/' )) {
     
    234238   
    235239    /**
    236      * Not declared as static in parent, but called statically
    237      */
    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 ) {
    239243        return self::group_exists( $slug, $parent_id );
    240244    }
     
    334338
    335339    /**
    336      * Not declared as static in parent, but called statically
    337      */
    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 ) {
    339343
    340344        foreach($paged_groups as $key => $group) {
  • bp-group-hierarchy/trunk/extension.php

    r752661 r763873  
    703703/**
    704704 * 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 */
     706function bp_group_hierarchy_group_tree_title(  $title, $sep, $sep_location = null ) {
    708707    global $bp;
    709708    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;
    713718}
    714719
     
    778783add_filter( 'bp_user_can_create_groups', 'bp_group_hierarchy_can_create_any_group', 10, 2 );
    779784
     785
     786/**
     787 * (BP 1.7+) Add plugin templates folder to list of available template paths
     788 */
     789function 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 */
     796function 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
    780804/**
    781805 * Get the party started
     
    786810    add_action( 'wp_ajax_groups_tree_filter', 'bp_dtheme_object_template_loader' );
    787811    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' );
    788816   
    789817    $bp->group_hierarchy->extension_settings = array(
     
    813841             * Override BP's default group index with the tree
    814842             */
    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            }
    816852        }
    817853       
  • bp-group-hierarchy/trunk/includes/hierarchy.js

    r508651 r763873  
    11jQuery(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
    28    /** Add tree class to groups panel for AJAX loading */
    39    jQuery('div.groups').addClass('tree');
     
    4450        return false;
    4551    });
     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    }   
    4674});
  • bp-group-hierarchy/trunk/readme.txt

    r758142 r763873  
    6262= 1.4.0 =
    6363* 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
    6469
    6570= 1.3.9 =
Note: See TracChangeset for help on using the changeset viewer.