Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • @xgote

    Member

    Solution: Getting the URL with bp_core_fetch_avatar() and using the option ‘html’ => false to get group images by URL rather then a whole image tag.

    IE:
    `
    $avatar_options = array ( ‘item_id’ => ‘1’, ‘object’ => ‘group’, ‘type’ => ‘full’, ‘avatar_dir’ => ‘group-avatars’, ‘alt’ => ‘Group avatar’, ‘css_id’ => 1234, ‘class’ => ‘avatar’, ‘width’ => 50, ‘height’ => 50, ‘html’ => false );

    $result = bp_core_fetch_avatar($avatar_options);
    `

    Looking at this particular code makes me nervous about performance. Is it necessary to read from the database and the filesystem to get this type of resource? I sure hope there’s some caching going on somewhere.

    @xgote

    Member

    Alright, drilling down a bit further, in bp-groups/bp-grouptemplatetags.php, around line 279, there’s our bp_get_group_avatar() method.

    `
    function bp_get_group_avatar( $args = ” ) {
    global $bp, $groups_template;

    $defaults = array(
    ‘type’ => ‘full’,
    ‘width’ => false,
    ‘height’ => false,
    ‘class’ => ‘avatar’,
    ‘id’ => false,
    ‘alt’ => __( ‘Group avatar’, ‘buddypress’ )
    );

    $r = wp_parse_args( $args, $defaults );

    extract( $r, EXTR_SKIP );
    var_dump(‘buddypress group_avatar_call’, bp_core_fetch_avatar( array( ‘item_id’ => $groups_template->group->id, ‘object’ => ‘group’, ‘type’ => $type, ‘avatar_dir’ => ‘group-avatars’, ‘alt’ => $alt, ‘css_id’ => $id, ‘class’ => $class, ‘width’ => $width, ‘height’ => $height )) );
    /* Fetch the avatar from the folder, if not provide backwards compat. */
    if ( !$avatar = bp_core_fetch_avatar( array( ‘item_id’ => $groups_template->group->id, ‘object’ => ‘group’, ‘type’ => $type, ‘avatar_dir’ => ‘group-avatars’, ‘alt’ => $alt, ‘css_id’ => $id, ‘class’ => $class, ‘width’ => $width, ‘height’ => $height ) ) )
    $avatar = ‘group->avatar_thumb ) . ‘” class=”avatar” alt=”‘ . esc_attr( $groups_template->group->name ) . ‘” />’;

    return apply_filters( ‘bp_get_group_avatar’, $avatar );
    }
    `

    So I’ve var dumped the parameters that are used for bp_core_fetch_avatar() when it’s called from the default group landing page, then var_export($args, true) and copied that output directly to my own code and surprisingly, I get the same result as before, a blank img tag. So, this leads me to believe that this method is not meant to be used in the way I am using it.

    As I find a better solution, I will follow up in case this is useful to someone else.

    @xgote

    Member

    I had some time earlier to create a little spider that basically:

    – Scans the extensions page (all 12 pages!) for the direct URL’s of each plugin
    – Extracts meta-data from each of the pages (title, rating, downloads, last updated, compatible, requires.. etc)
    – Normalizes a little bit
    – Dumps to text file for database import or CSV

    Anyhow, for about 30 minutes worth of work, I was able to get most of the meta-data into a report. Some pages threw errors, probably because I didn’t set a delay between fetches or something but I could easily improve on this and cron the process into a database. Anyhow, I was mostly curious about searching through the extensions more effectively. Here’s a sampling of the top 20 or so by downloads:

    # | Title, Version, Updated, Requires, Compatible, Downloads
    1 | Plugin: BuddyPress 1.2.7 92 days ago 3 3.0.4 446618
    2 | Plugin: W3 Total Cache 0.9.1.3 126 days ago 2.8 3.0.4 263812
    3 | Plugin: MapPress Easy Google Maps 2.28 70 days ago 3 3.0.4 120369
    4 | Plugin: All in One Webmaster 6.9.9.3 44 days ago 2.9 3.1 117468
    5 | Plugin: Tweet Blender 3.2.4 50 days ago 2.8.0 3.0.4 81710
    6 | Plugin: WP-Hashcash 4.5.1 296 days ago 2.9.2 71257
    7 | Plugin: Login With Ajax 3.0.3 53 days ago 2.8 3.0.4 60193
    8 | Plugin: Codestyling Localization 1.99.7 121 days ago 2.5 3.0.4 50702
    9 | Plugin: Transposh – translation filter for wordpress 0.7.0 10 days ago 2.8 3.1 40218
    10 | Plugin: Post video players, slideshow albums, photo galleries and music / podcast playlist 1.95 2 days ago 2.0.2 3.0.4 36651
    11 | Plugin: Author Avatars List 1 121 days ago 2.8 3.0.0 32541
    12 | Plugin: Buddypress-Ajax-Chat 1.3.8 31 days ago 2.9.1,1.2 30325
    13 | Plugin: BuddyPress Media 0.1.8.7 14 days ago 2.9,1.2 3.0.4,1.2.7 26729
    14 | Plugin: Twit Connect 2.56 77 days ago 2.7.0 3.0.4 20029
    15 | Plugin: Welcome Pack 2.1 223 days ago 2.9.x,1.2.3 3.0,1.2.4.1 17864
    16 | Plugin: Invite Anyone 0.7.1 51 days ago 2.8,1.1 3.0.1,1.2.7 16969
    17 | Plugin: BuddyPress Links 0.5 91 days ago 5.2,3.x,1.2.6 5.2.x,3.x,1.2.6 15916
    18 | Plugin: BuddyPress Group Email Subscription 2.7.9 46 days ago 2.9.1 1.2 3.0.1 1.2.5.2 15806
    19 | Plugin: BuddyPress Like 0.0.8 53 days ago 2.9 3.0.4 14836

Viewing 3 replies - 1 through 3 (of 3 total)
Skip to toolbar