Changeset 1089

Show
Ignore:
Timestamp:
05/14/08 18:00:59 (7 months ago)
Author:
bloggsbe
Message:

Fixed problem with avatars not showing if bb-avatars where not in use.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • bb-twitter/trunk/bb-twitter.php

    r1082 r1089  
    44Plugin URI:  http://shuttlex.blogdns.net 
    55Description:  Show users latest twitter on profile page 
    6 Version: 0.1 
     6Version: 0.2 
    77Author: RuneG 
    88Author URI: http://shuttlex.blogdns.net 
     
    1717Version History: 
    18180.1     : First public release 
     190.2             : Fixed problem avatars did not show. This happend if bb-avatars where not in use. 
    1920*/ 
    2021 
     
    3839<table border=0> 
    3940<tr> 
    40 <td>Twitter username : </td><td><input type="text" name="twitter" value="<?php echo $twitter;?> " size="25"/></td> 
     41<td>Twitter brukernavn : </td><td><input type="text" name="twitter" value="<?php echo $twitter;?> " size="25"/></td> 
    4142</tr> 
    4243<tr> 
    43 <td>Show your last tweet in profile?</td><td> 
     44<td>Vis din siste <em>tweet</em> i profilen?</td><td> 
    4445<?php 
    4546if ($tweets_on == "yes"){ 
     
    8384 } else { 
    8485 if ($tweets_on == "yes"){ 
    85 _e('<h4>Latest Tweet : </h4><code> 
     86_e('<h4>Siste Tweet : </h4><code> 
    8687        <ul id="twitter_update_list"></ul> 
    8788        <script type="text/javascript" src="http://twitter.com/javascripts/blogger.js"></script> 
     
    9394} 
    9495 
     96function tweet_start(){ 
     97global $user_id, $bb_twitter,$bb_current_user; 
     98if ( ! bb_get_option('avatars_show') ) 
     99                return false; 
     100$author_id = get_post_author_id( $post_id ); 
     101$userid = bb_get_user_id( $user_id ) ; 
     102$twitter = bb_get_usermeta($user_id,twitter); 
     103$tweets_on = bb_get_usermeta($user_id,twitter_on); 
     104if ( !is_bb_profile() ){ 
     105 $tweet_print = ""; 
     106 } else { 
     107 if ($tweets_on == "yes"){ 
     108$tweet_print = ('<h4>Siste Tweet : </h4><code> 
     109        <ul id="twitter_update_list"></ul> 
     110        <script type="text/javascript" src="http://twitter.com/javascripts/blogger.js"></script> 
     111        <script type="text/javascript" src="http://twitter.com/statuses/user_timeline/'.$twitter.'.json?callback=twitterCallback2&count=1"></script></code><br/>'); 
     112} else { 
     113 end; 
     114 }} 
     115 $email = bb_get_user_email($author_id); 
     116        if ($email == '' || $email == ' '){ 
     117                $author_id = bb_get_user_id( $post_id ); 
     118                $email = bb_get_user_email($author_id); 
     119                } 
     120        if ($avatars['default'] == 'Your Own Gravatar'){ 
     121                $default = $avatars['standard']; 
     122        } else { 
     123                $default = $avatars['default']; 
     124        } 
     125        $size = $avatars['size']; 
     126                $src = 'http://www.gravatar.com/avatar/'; 
     127                $src .= md5( strtolower( $email ) ); 
     128                $src .= '?s=' . $size; 
     129                $src .= '&amp;d=' . urlencode( $default ); 
    95130 
    96 add_action( 'bb_get_avatar','bb_show_tweets',1); 
     131                $rating = $avatars['rating']; 
     132                if ( !empty( $rating ) ) 
     133                        $src .= '&amp;r=' . $rating; 
     134 
     135                $class = 'avatar avatar-' . $size; 
     136         
     137                $class = 'avatar avatar-' . $size . ' avatar-default'; 
     138         
     139 
     140        $avatar = '<img alt="" src="' . $src . '" class="' . $class . '" style="height:' . $size . 'px; width:' . $size . 'px;" />'; 
     141         
     142         
     143         
     144         
     145        if ( $link = get_user_link( $author_id ) ) { 
     146                if (!function_exists('bb_avatars_show')) { 
     147                echo '<a href="' . attribute_escape( $link ) . '">' . $avatar . '</a>'; 
     148                } 
     149                echo $tweet_print; 
     150        } else { 
     151        if (!function_exists('bb_avatars_show')) { 
     152                echo $avatar; 
     153        } 
     154                echo $tweet_print; 
     155                 
     156         
     157
     158  
     159}        
     160         
    97161 
    98162 
    99163 
     164 
     165if (!function_exists('bb_avatars_show')) { 
     166add_action( 'bb_get_avatar','tweet_start',10); 
     167}else{ 
     168add_action( 'bb_get_avatar','bb_show_tweets',1); 
     169} 
     170 
     171 
    100172?> 
  • bb-twitter/trunk/readme.txt

    r1083 r1089  
    44Requires at least: 0.9.x 
    55Tested up to: 1.0-dev 
    6 Stable Tag: 0.1 
     6Stable Tag: 0.2 
    77 
    88Shows users latest tweet in the profilepage.