Integrating sign in with Twitter or Login with Twitter to buddypress
-
Hi all,
I have just written a tutorial on how to sign in with Twitter on Buddypress over on WPin, it’s rather a long tutorial and I have tried to cover as much as possible with pictures etc check it out on http://bit.ly/d5imku
Hope you like it,
All the best
WPin.me
-
Cool! Got an example of a user who signed up using Twitter on your site?
Hmm, testing this. I logged in easy enough but do not like that it adds twitter to the end of username.
I haven’t tested this, but it looks like you can set the suffix… maybe you can set the suffix blank?
Although if you do set the suffix blank, I’m not sure if that plugin has a lookup routine to see if there are duplicate usernames…
If you read the post you just delete the suffix and voila it is done.
MidlandUK and webalista are both signups via twitter for testing, it worked on both occasions. Quick note even if you delete the suffix it will still show in the box in the back end, worry not as it will be deleted from the database.
Another update it does check for duplicate names!
Is this for wordpress MU or single with BP and does the user access all the BP features?
Demo site for this..
You can try it on http://www.wpin.me as I have it up and running.
will it work with WPMU/BuddyPress1.2 ? or is it WordPress/BuddyPress1.2 only?
@WPin.me, I’ve login using my twitter acc but no avatar displayed and also can you make it as a plugin, so that one does need to hardcode it?
There is a function created to pull in your avatar but it only works on a child theme. If you add the function to the default functions.php it throws up errors.
http://deanjrobinson.com/article/enabling-twitter-avatars-within-buddypress/
I got it working in the parent functions.php file.
I removed the spaces after the opening <?php and after and inserted the correct tab spaces for the file. Here is it:
<?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 = ‘/mini’;
} else if ( $twav_suffix < 64 ) {
$twav_suffix = ”;
} else {
$twav_suffix = ‘/bigger’;
}
} else if ( ‘full’ == $id_or_email['type'] ) {
$twav_size = BP_AVATAR_FULL_WIDTH;
$twav_suffix = ‘/bigger’;
} else if ( ‘thumb’ == $id_or_email['type'] ) {
$twav_size = BP_AVATAR_THUMB_WIDTH;
}
$out = ‘http://purl.org/net/spiurl/’. 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);
}
?>
better yet…download it from here: http://www.antonrsa.co.za/testblog/functions.phps
On the admin side of the plugin deleteing @twitter didn’t work. Had to manually delete @twitter in the db. Search for “twc_user_login_suffix” and delete @twitter manually. It works 100%
yeah, but the file will get over written when you up grade so its best to just create a child theme functions file.
@anton thanks for posting your find!
@GP01 – unfortunately I am neither a programmer or developer, I am sure someone will evolve this plugin to incorporate Twitter+buddypress in the future.
Oops sorry @arnonel the twit connect plugin is running on single WP install on wpin.me however I believe it may work with WPMU you can only test it out (or hope someone else does!)
I can’t delete @twitter either. How about an update to the plugin?
Also, I’m having a hard time getting the twitter login to show on the front page. The tutorial written on WPin.me says to look for a certain code which doesn’t exist. Perhaps the plugin has been updated and code changed.
Anyyhow, if anyone knows how to get it to show on the front page I’d be super happy.
@billydecola send me a message, I may be able to help you.
Hi billydecola, I had the same problem, and after a time I noticed that it wasn’t working cause I copied the wrong code:
<?php if(function_exists(´twit_connect´)){twit_connect();} ?> –> WRONG (it using written accent instead quotation marks)
<?php if(function_exists(‘twit_connect’)){twit_connect();} ?> –> OK
Hope it helps.
Anyway, the plugin has a bug, cause when I log in my social network using the twit connect buttom it works perfectly and it creates a new user, but if I log out or I clear browsing data, the next time that I try to connect using the twit connect buttom again, it show me the next message: “User name XXXXXX cannot be added. It already exists.”
So, what’s the solution?, if I’m logged in using twit connect I can’t never log out or delete the cookies?. The plugin must to check that if already exists a user with that username, maybe it’s the same user trying to log in again, so it should check if the email and password are the same, in that case, to log in with that username.
Hi, the bug was Fixed???
Thanks
I am having the identical issue as _dorsvenabill and also cannot delete the @twitter suffix. Would love to get this working on my site!
I’am with the same problem, the user can create but can’t login in the account.
You must be logged in to reply to this topic.