wordpress Archive

Enabling Twitter avatars within BuddyPress

Article
02Mar
17

First up, the first step in this process is to install the Twit Connect plugin which you can do by following these instructions, then you can proceed with enabling Twitter avatars.

First up, the first step in this process is to install the Twit Connect plugin which you can do by following these instructions, then you can proceed with enabling Twitter avatars.

This is just a quick filter that I wrote while I was setting up help.deanjrobinson.com last week after I discovered that the twitter avatars weren’t working because of a different function/filter being used by BuddyPress.

I make no claims that this additional function is perfect, but I haven’t come across any problems with it yet, and I only knocked it together quickly. If you find anything wrong with it, or have any suggestions as to how it could be improved/simplified please let me know.

This new function based on one of the original functions that comes with the Twit Connect plugin which enables twitter avatars on regular WordPress blogs, just a with a few tweaks.

What you need to do is add the following code to the functions.php in your current BuddyPress theme. You can download a plain text copy of this function here (it’ll probably more reliable than copy-and-pasting from this page). Remember to backup your functions.php file before making any changes… just in case.

UPDATE: Appears some people who added this function the functions.php file in the default BuddyPress theme were seeing some error messages (I have not yet been able to recreate this error, but more than one user has reported it). Ideally you shouldn’t be modifying the default BP theme directly, you should be doing it via a child theme (find out how), so this code should be then added to the functions.php in your child theme.

7th March, UPDATE I’ve updated the function below (and the downloadable version above) to use http://tweetimag.es for the static twitter avatar URLs, it looks like it might a more reliable/consistent service.

<?php

 function bp_twc_get_avatar($avatar, $id_or_email='') {
  global $comment, $twc_user_login_suffix;

  if(is_object($comment)) {
   $user_id = $comment->user_id;
  }

  if (is_object($id_or_email)) {
   $user_id = $id_or_email->user_id;
  }

  if (is_array($id_or_email)) {
   if ($id_or_email['object']=='user') {
    $user_id = $id_or_email['item_id'];
   }
  }

  if (get_usermeta($user_id, 'twcid')) {
   $user_info = get_userdata($user_id);
   $twav_suffix = '';

   if ( $id_or_email['width'] ) {
    $twav_size = $id_or_email['width'];
    if( $twav_size < 32 ) {
     $twav_suffix = 'm';
    } else if ( $twav_suffix < 64 ) {
     $twav_suffix = 'n';
    } else {
     $twav_suffix = 'b';
    }
   } else if ( 'full' == $id_or_email['type'] ) {
    $twav_size = BP_AVATAR_FULL_WIDTH;
    $twav_suffix = 'b';
   } else if ( 'thumb' == $id_or_email['type'] ) {
    $twav_size = BP_AVATAR_THUMB_WIDTH;
    $twav_suffix = 'n';
   }

   $out = 'http://img.tweetimag.es/i/'. str_replace($twc_user_login_suffix,"",$user_info->user_login) . '_' .$twav_suffix;

   $avatar = "<img alt='Twitter Avatar' src='{$out}' class='avatar avatar-{$twav_size}' height='{$twav_size}' width='{$twav_size}' />";
   return $avatar;

  } else {
   return $avatar;
  }

 }

 // Check if Twit Connect exists (since its without it this function is pointless)
 if( function_exists( 'twit_connect' ) ) {

  add_filter( 'bp_core_fetch_avatar', 'bp_twc_get_avatar',10,4);

 }

?>

Show me the original version

I will add an explanation of what its doing if people are interested/curious.

••••

Fluency Admin 2.2 now available

Sidenote
21Dec
2

WordPress 2.9 compatibility, fixes a few minor style bugs, adds options for custom menu width, menu positioning (fixed or absolute) and show/hide menu icons. More info here or download from the WordPress plugin directory here.

••••

New WordPress theme: Dear Diary

Article
24Oct
1

Dear Diary is a super simplistic theme for WordPress. It is best suited to a basic journal or diary where content is king and the theme should stay mostly out of your way.

Dear Diary is a super simplistic theme for WordPress. It is best suited to a basic journal or diary where content is king and the theme should stay mostly out of your way.

deardiaryheader

What’s it great for?

With its ruled-notepad styling Dear Diary is perfect for a simple online journal or diary. Of course you can still posts images and videos etc, but simple text is what Dear Diary does best. You can check out a full live preview here.

» Continue reading “New WordPress theme: Dear Diary”

••••
Link
18Oct

Fluency Admin 2.1.1 update available now After 2.1 hit 5,000 downloadsin less than a month I decided I’d knock out a quick update. Its not a huge update, but it does fix a few plugin display issues for the following plugins: Acronyms, NextGen Gallery, One-Click Plugin Updater, HeadSpace2 and WP-Polls. Fixes broken styling of Media Library popup and also added an option to set custom logo to display at the top of the menu (replaces WordPress logo). Download it here. Find out more here.

••••

Introducing WPAPI.ORG

Article
18Oct
0

Ok, so I actually launched this last weekend, but I’m only just now getting around to writing (briefly) about it. WPAPI.ORG is a super easy to use API which you can use to retrieve stats for all those great plugins and themes that you’ve got hosted on WordPress.org. Why would you want to do this?

Ok, so I actually launched this last weekend, but I’m only just now getting around to writing (briefly) about it. WPAPI.ORG is a super easy to use API which you can use to retrieve stats for all those great plugins and themes that you’ve got hosted on WordPress.org. Why would you want to do this?

WPapi.org

Why did I build this thing?

Because I could. No, seriously, the reason that I’ve built this (and made it available to everyone else) is that I was looking for ways to pull back the stats from WordPress.org and display them on the project pages here on my site, maybe even with some sexy graphs using something like Raphaël JS. After some investigation I found the xml feed that powers the graphs on WordPress.org, but that didn’t really help me. What I really wanted was JSON.

» Continue reading “Introducing WPAPI.ORG

••••

Fluency 2.1 now available

Article
20Sep
3

It’s been a while between updates, mostly due to the time spent working on getting Hahlo4 finished, but with that out of the way it was time to update Fluency to work with the latest version of WordPress. The big news is that Fluency is now hosted in the WordPress plugins directory, meaning that you will be able to use the built-in plugin installer, and auto update features in WordPress when new version are released.

Fluency 2.1 now available

It’s been a while between updates, mostly due to the time spent working on getting Hahlo4 finished, but with that out of the way it was time to update Fluency to work with the latest version of WordPress. The big news is that Fluency is now hosted in the WordPress plugins directory, meaning that you will be able to use the built-in plugin installer, and auto update features in WordPress when new version are released.

You can get more details, and grab Fluency 2.1 from the WordPress plugin directory here.

New features

There aren’t mountains of new features but there a couple worth mentioning. I’ve added a ‘Fluency Options’ page, which can be found under the ‘Settings’ menu, there are just two options for the moment. Both were requests from users, you can disable the Fluency style on the login page, and you can also specify a custom logo to be displayed on the login page (this works with the Fluency login style turned on or off)

For few versions now WordPress has come with two default admin color schemes, but up until now Fluency has only had a grey-based scheme. I’ve now added full support for a Classic/Blue color scheme, based on whichever color scheme you have selected in you user profile on your blog.

» Continue reading “Fluency 2.1 now available”

••••

And then it was redesigned

Article
21Jul
5

Surely I’m not the only one with this ‘problem’, I can’t sit on one design for too long, personally I think I’ve done well to hold out for nearly 7 months this time. If you’re reading this in your favourite feedreader, then you’re missing out on the interesting bit, you can’t see my *awesome* redesign unless you’re reading this in a browser, so, hop to it.

Surely I’m not the only one with this ‘problem’, I can’t sit on one design for too long, personally I think I’ve done well to hold out for nearly 7 months this time. If you’re reading this in your favourite feedreader, then you’re missing out on the interesting bit, you can’t see my *awesome* redesign unless you’re reading this in a browser, so, hop to it.

Wait

Isn’t it only like 6 weeks since you last redesigned? No, the last redesign went live the week after Christmas last year, which means its over 6 months since I’ve redesigned. So there :P

Why

I’ve gotten into a habit of redesigning (or at least refreshing) around the time that I upgrade to the latest and great version of WordPress. This time around I knew 2.8 was just around the corner and planned to go live with redesign while I was upgrading. That didn’t happen.

I also needed to do something to escape/take my mind off/avoid certain other things, and a redesign is great for that. Only problem that brought was that I didn’t have as much time to dedicate to the redesign as I normally would.

» Continue reading “And then it was redesigned”

••••
Link
29Apr

WordPress design tweaks voting WP users should vote, I’ve got a few options in there (all based on Fluency), voting closes until 2am Thursday UTC. There a re ten choice all up, check ‘em all out and vote for your preferred one. I’m think the possible final solution could end up being a combination of ideas from a few different designs, will be interesting to see the feedback after voting. I’ve written a little more about my suggestions here if you’re at all interested.

••••
Link
18Mar

P2: The New Prologue New WordPress theme by the good folk at Automattic, which brings easy microblogging to WordPress. Very handy for setting up a twitter-esque system for internal use (I’ve done this myself a couple of times using the first version of Prologue). This new version has a few neat features such as keyboard shortcuts, auto refresh etc. Check out the link for a brief demo video.

••••

Fluency Admin 2 Released

Article
12Dec
18

There is no doubt that the brand spanking new admin interface in WordPress 2.7 is a huge leap forward, and so long as you don’t switch to the ‘blue’ version (seriously, worst, blue, ever) its actually pretty nice to look at and use. The navigation is now down the left-hand side, just as I preferred (which is why that’s where it was in Fluency 1.x), and because of this, styling and customising the menu in-particular has been a lot simpler that it was in previous versions of WP.

Fluency 2

There is no doubt that the brand spanking new admin interface in WordPress 2.7 is a huge leap forward, and so long as you don’t switch to the ‘blue’ version (seriously, worst, blue, ever) its actually pretty nice to look at and use. The navigation is now down the left-hand side, just as I preferred (which is why that’s where it was in Fluency 1.x), and because of this, styling and customising the menu in-particular has been a lot simpler that it was in previous versions of WP.

So whats new.

Well, technically, everything is. Fluency 2 was a ground up rewrite due to the fact that just about every part of both the design and underlying structure of the default admin has changed. This was definitely a good thing, as it allowed me to make sure I’m only including what really needs to be included. However I did make this a little hard for myself when I started work using the early trunk builds, which meant that every time I updated my build I had to update Fluency…again. I actually ended up building the Fluency 2 CSS from scratch twice, and what it looks like now isn’t at all what it looked like when I first began playing around.

Keep reading for further details, screenshots, and most importantly the download link.

» Continue reading “Fluency Admin 2 Released”

deanjrobinson.com
twitter was not updated. | tumblr was not updated. | lastfm was not updated. |