Re: Purely Genius Way to Add Custom Profile Fields
Here it is, save as bp-music.php and copy into your muplugins
you must create a profile details group “Audio Details”, and all values will be replaced by a music player.
Check out a working copy on:
http://gorgeousgamers.com/beta/members/bradmkjr/
Brad
http://gorgeousgamers.com/beta/
<?php
/*
* Created on Dec 29, 2008
*
* Project Buddypress Addons
*
* File bp-music.php
*
*/
function bp_profile_music_player( $field_value =””, $field_type = “”, $field_id = “” ) {
if($field_value == “”)
return “Nothing to show”;
else
{ // clean up input
return “<script type=’text/javascript’>
var amzn_wdgt={widget:’MP3Clips’};
amzn_wdgt.tag=’gorgeousgamers-20′;
amzn_wdgt.widgetType=’ASINList’;
amzn_wdgt.keywords='”.addslashes($field_value).”‘;
amzn_wdgt.title=’What I’ve been listening to lately…’;
amzn_wdgt.width=’250′;
amzn_wdgt.height=’250′;
amzn_wdgt.shuffleTracks=’True’;
amzn_wdgt.marketPlace=’US’;
</script>
<script type=’text/javascript’ src=’http://wms.assoc-amazon.com/20070822/US/js/swfobject_1_5.js’>
</script>”;
}
}
function bp_profile_music_groups( $group_name =””) {
if($group_name == “Audio Details”){
remove_filter( ‘bp_the_profile_field_value’, ‘xprofile_filter_link_profile_data’, 2);
add_filter( ‘bp_the_profile_field_value’, ‘bp_profile_music_player’, 2, 3);
}else{
add_filter( ‘bp_the_profile_field_value’, ‘xprofile_filter_link_profile_data’, 2, 3);
remove_filter( ‘bp_the_profile_field_value’, ‘bp_profile_music_player’, 2);
}
return $group_name;
}
add_filter( ‘bp_the_profile_group_name’, ‘bp_profile_music_groups’, 10, 1 );
?>