mirror of
https://github.com/e107inc/e107.git
synced 2025-04-13 09:01:59 +02:00
Some User-Avatar cleanup.
This commit is contained in:
parent
daf5495214
commit
cf90582418
@ -597,11 +597,23 @@ class user_shortcodes extends e_shortcode
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function sc_user_photo($parm)
|
||||
{
|
||||
$row = array('user_image'=>$this->var['user_sess']);
|
||||
|
||||
return e107::getParser()->toAvatar($row, $parm);
|
||||
}
|
||||
|
||||
|
||||
function sc_user_picture($parm)
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
$parm['id'] = 'user-profile-avatar';
|
||||
return $tp->toAvatar($this->var, $parm);
|
||||
|
||||
|
||||
|
||||
return $tp->parseTemplate("{USER_AVATAR=".$this->var['user_sess']."}",true);
|
||||
|
||||
if ($this->var['user_sess'] && file_exists(e_MEDIA."avatars/".$this->var['user_sess']))
|
||||
|
@ -242,9 +242,11 @@ class usersettings_shortcodes extends e_shortcode
|
||||
function sc_photo_upload($parm)
|
||||
{
|
||||
$diz = LAN_USET_27.". ".LAN_USET_28.".";
|
||||
|
||||
$text = '';
|
||||
|
||||
if(USERPHOTO)
|
||||
{
|
||||
|
||||
$text .= e107::getParser()->parseTemplate("{PICTURE}",true);
|
||||
}
|
||||
|
||||
@ -373,7 +375,7 @@ class usersettings_shortcodes extends e_shortcode
|
||||
$fieldList = $sql->db_getList();
|
||||
foreach($fieldList as $field)
|
||||
{
|
||||
cachevars("extendedfield_{$cat['user_extended_struct_name']}", $field);
|
||||
cachevars("extendedfield_{$field['user_extended_struct_name']}", $field);
|
||||
//TODO use $this instead of parseTemplate();
|
||||
$ret .= $this->sc_userextended_field($field['user_extended_struct_name']);
|
||||
// $ret .= $tp->parseTemplate("{USEREXTENDED_FIELD={$field['user_extended_struct_name']}}", TRUE, $usersettings_shortcodes);
|
||||
|
@ -2,9 +2,19 @@
|
||||
// $Id$
|
||||
function user_avatar_shortcode($parm=null) //TODO new function $tp->toAvatar(); so full arrays can be passed to it.
|
||||
{
|
||||
if(is_string($parm))
|
||||
{
|
||||
$data = array('user_image'=>$parm);
|
||||
}
|
||||
elseif(is_array($parm))
|
||||
{
|
||||
$data = $parm;
|
||||
}
|
||||
|
||||
return e107::getParser()->toAvatar($data, $data);
|
||||
/*
|
||||
global $loop_uid;
|
||||
|
||||
|
||||
|
||||
$tp = e107::getParser();
|
||||
$width = $tp->thumbWidth;
|
||||
$height = ($tp->thumbHeight !== 0) ? $tp->thumbHeight : "";
|
||||
@ -87,6 +97,7 @@ function user_avatar_shortcode($parm=null) //TODO new function $tp->toAvatar();
|
||||
$text = "<img class='img-rounded user-avatar e-tip' title='".$title."' src='".$img."' alt='' style='width:".$width."px; height:".$height."px' />";
|
||||
// return $img;
|
||||
return $text;
|
||||
*/
|
||||
|
||||
}
|
||||
?>
|
@ -217,7 +217,58 @@ $USER_EMBED_USERPROFILE_TEMPLATE = "
|
||||
|
||||
|
||||
|
||||
// Convert Templates from v1.x to v2.x Standards.
|
||||
// Convert Templates from v1.x to v2.x Standards.
|
||||
/** TODO EXPERIMENTAL */
|
||||
/*
|
||||
if(defset('BOOTSTRAP') == 3)
|
||||
{
|
||||
//EXPERIMENTAL
|
||||
e107::css('inline', "
|
||||
#user-profile-avatar {
|
||||
max-width: 150px;
|
||||
margin-top: -90px;
|
||||
margin-bottom: 15px;
|
||||
border: 5px solid #fff;
|
||||
border-radius: 100%;
|
||||
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
|
||||
margin-left:auto;
|
||||
margin-right:auto;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
");
|
||||
|
||||
|
||||
$USER_FULL_TEMPLATE = '{SETIMAGE: w=600}
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="panel panel-default panel-profile">
|
||||
<div class="ans panel-heading" style="height:180px; background-size: cover;background-image: url({USER_PHOTO: type=url});"></div>
|
||||
<div class="panel-body text-center">
|
||||
{SETIMAGE: w=200}
|
||||
{USER_PICTURE: shape=circle&link=1}
|
||||
|
||||
<h5>{USER_NAME}</h5>
|
||||
<p>{USER_SIGNATURE}</p>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
';
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
$USER_TEMPLATE['view'] = $USER_FULL_TEMPLATE;
|
||||
$USER_TEMPLATE['extended']['start'] = $EXTENDED_CATEGORY_START;
|
||||
|
@ -3342,7 +3342,7 @@ class e_parser
|
||||
public function toAvatar($userData=null, $options=array())
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
$width = $tp->thumbWidth;
|
||||
$width = !empty($options['w']) ? intval($options['w']) : $tp->thumbWidth;
|
||||
$height = ($tp->thumbHeight !== 0) ? $tp->thumbHeight : "";
|
||||
$linkStart = '';
|
||||
$linkEnd = '';
|
||||
@ -3355,7 +3355,7 @@ class e_parser
|
||||
}
|
||||
|
||||
|
||||
$image = varset($userData['user_image']);
|
||||
$image = (!empty($userData['user_image'])) ? varset($userData['user_image']) : null;
|
||||
|
||||
$genericImg = $tp->thumbUrl(e_IMAGE."generic/blank_avatar.jpg","w=".$width."&h=".$height,true);
|
||||
|
||||
@ -3387,20 +3387,26 @@ class e_parser
|
||||
$img = $genericImg;
|
||||
}
|
||||
|
||||
if(($img == $genericImg) && ($userData['user_id'] == USERID))
|
||||
if(($img == $genericImg) && ($userData['user_id'] == USERID) && !empty($options['link']))
|
||||
{
|
||||
$linkStart = "<a class='e-tip' title=\"".LAN_EDIT."\" href='".e107::getUrl()->create('user/myprofile/edit',$userData)."'>";
|
||||
$linkStart = "<a class='e-tip' title=\"".LAN_EDIT."\" href='".e107::getUrl()->create('user/myprofile/edit')."'>";
|
||||
$linkEnd = "</a>";
|
||||
}
|
||||
|
||||
$title = (ADMIN) ? $image : $tp->toAttribute($userData['user_name']);
|
||||
$shape = (vartrue($options['shape'])) ? "img-".$options['shape'] : "img-rounded";
|
||||
$shape = (!empty($options['shape'])) ? "img-".$options['shape'] : "img-rounded";
|
||||
|
||||
if(!empty($options['type']) && $options['type'] == 'url')
|
||||
{
|
||||
return $img;
|
||||
}
|
||||
|
||||
|
||||
$heightInsert = empty($height) ? '' : "height='".$height."'";
|
||||
$id = (!empty($options['id'])) ? "id='".$options['id']."' " : "";
|
||||
|
||||
$text = $linkStart;
|
||||
$text .= "<img class='".$shape." img-responsive user-avatar e-tip' title=\"".$title."\" src='".$img."' alt='' width='".$width."' ".$heightInsert." />";
|
||||
$text .= "<img ".$id."class='".$shape." user-avatar e-tip' title=\"".$title."\" src='".$img."' alt='' width='".$width."' ".$heightInsert." />";
|
||||
$text .= $linkEnd;
|
||||
// return $img;
|
||||
return $text;
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 66 KiB |
@ -183,7 +183,7 @@ class theme_shortcodes extends e_shortcode
|
||||
$text = '
|
||||
|
||||
<ul class="nav navbar-nav navbar-right'.$direction.'">
|
||||
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">{SETIMAGE: w=20}{USER_AVATAR} '. USERNAME.' <b class="caret"></b></a>
|
||||
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">{SETIMAGE: w=20} {USER_AVATAR: shape=circle} '. USERNAME.' <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li>
|
||||
<a href="{LM_USERSETTINGS_HREF}"><span class="glyphicon glyphicon-cog"></span> '.LAN_SETTINGS.'</a>
|
||||
|
Loading…
x
Reference in New Issue
Block a user