Jump to content

How to make user profile pic by their name letter


xvids

Recommended Posts

The Screenshot have different color for each letter,

About colors for each letter I was confuse, 

 

otherwise I was using this code: but Not colors,  🙃

 

{{if $lang.enable_profiles=='true'}}
	<div id="user">
	{{if $smarty.session.user_id>0}}
			{{if $smarty.session.avatar_url!=''}}
				<img class="avatar" src="{{$smarty.session.avatar_url}}" alt="{{$data.user.display_name}}" style="border-radius: 50%;width: 40px;height: 40px;"/>
			{{else}}
				<div id="no-thumb">{{$smarty.session.display_name|substr:"0":"1"|strtoupper}}</div>
			{{/if}}
			{{else}}
			<img class="avatar" src="{{$config.statics_url}}/static/images/user.png" alt="Signup/Login" style="border-radius: 50%;width: 40px;height: 40px;"/>
			{{/if}}
	</div>
{{/if}}

 

  • Like 1
Link to comment
Share on other sites

  • 1 year later...
On 10/15/2022 at 6:55 PM, Tech Support said:

You can use this to display the first letter of the profile name:

{{$replaceme|substr:0:1|strtoupper}}

The $replaceme variable will be different in different contexts, but should define display name, for example it will be $item.display_name for list_members block.

I'm also encountering this issue, just want to clarify, where exactly does this line of code is suppose to go?

Link to comment
Share on other sites

On 4/6/2024 at 6:00 PM, wyranger said:

I'm also encountering this issue, just want to clarify, where exactly does this line of code is suppose to go?

It is many places around theme template, everywhere where avatar is displayed.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...