$value = $user->get( $field->get( 'name' ) );
Please Log in to join the conversation.
global $_PLUGINS;
$_PLUGINS->loadPluginGroup( 'user', array( (int) 1 ) );
$_PLUGINS->registerUserFieldTypes( array( 'ldapthumbnail' => 'CBfield_ldapthumbnail' ) );
$_PLUGINS->registerUserFieldParams();
class CBfield_ldapthumbnail extends cbFieldHandler {
function getField( &$field, &$user, $output, $reason, $list_compare_types ) {
global $_CB_framework, $ueConfig, $_CB_database;
$oReturn = null;
//grab user profile id
$user = $user->id;
// grab ldap.thumbnailPhoto from user_profile table
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->select($db->quoteName('profile_value'))
->from($db->quoteName('#__user_profiles'))
->where($query->quoteName('profile_key') . ' = ' . $query->quote('ldap.thumbnailPhoto'))
->where($query->quoteName('user_id') . ' = ' . $query->quote((int) $user));
$db->setQuery($query);
$result=$db->loadResult();
//check the result of the Query from the DB
if($result!==null){
//if there is something in the result stream back the image
$image= '<img src="data:image/jpeg;base64,'.$result.'"/>';
}else{
//if no image from Ldap then check CB avatar field
if ( $cbUser !== null ) {
$cbUser =& CBuser::getInstance( $user );
//$thumbnailAvatarHtmlWithLink = $cbUser->getField( 'avatar', null, 'html', 'none', 'list' );
$bigAvatarHtmlWithLink = $cbUser->getField( 'avatar' );
$image = $bigAvatarHtmlWithLink;
}
}
$oReturn=$image;
return $oReturn;
}
}//end of ldap Thumbnail field
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.
$user = $user->id;
Please Log in to join the conversation.
Please Log in to join the conversation.