Jump to content

Индивидуальный профиль в темах

Featured Replies

Posted
comment_137653

Как сделать отображение определенного профиля, как у Respected'a в темах?

comment_137655

Туда, где нужно вывести определенный текст (в postcontainer'e): 
 

{{if $comment->author()->member_id == X}}
<!--Код, для X ид !-->
{{else}}
<!--Код, для остальных ID пользователей !--> 
{{endif}}

 

  • Author
comment_137656
48 минут назад, okayvk сказал:

Туда, где нужно вывести определенный текст (в postcontainer'e): 
 


{{if $comment->author()->member_id == X}}
<!--Код, для X ид !-->
{{else}}
<!--Код, для остальных ID пользователей !--> 
{{endif}}

 

Добавить получилось, но вот остальную информацию убрать не могу.

comment_137657

Что то Я вообще ничего не понял) А можно поточнее инструкцию - что, куда и как) Думаю очень полезная информация будет.

comment_137659

Приведу пример на PostContainer от дефолтного стиля: 
Этот код (начинается с 39 строки): 

{{if $comment->author()->member_id}}
<li class='ipsResponsive_hidePhone'>{template="reputationBadge" group="global" app="core" params="$comment->author()"}</li>
<li class='ipsType_light'>{lang="member_post_count" pluralize="$comment->author()->member_posts"}</li>
{{if $comment->author()->reputationImage()}}

Мы заменим на этот: 
 

{{if $comment->author()->member_id == X}} <!-- где X - это ID нужного пользователя -->
<span style="color:red; font-weight:bold;">Какой-то текст</span>
{{else}}
<li class='ipsResponsive_hidePhone'>{template="reputationBadge" group="global" app="core" params="$comment->author()"}</li>
<li class='ipsType_light'>{lang="member_post_count" pluralize="$comment->author()->member_posts"}</li>
{{if $comment->author()->reputationImage()}}

Или, например, выдать определенный текст целой группе пользователей: 
 

{{if $comment->author()->member_group_id == X}} <!-- где X - это ID нужной группы -->
<span style="color:red; font-weight:bold;">Какой-то текст</span>
{{else}}
<li class='ipsResponsive_hidePhone'>{template="reputationBadge" group="global" app="core" params="$comment->author()"}</li>
<li class='ipsType_light'>{lang="member_post_count" pluralize="$comment->author()->member_posts"}</li>
{{if $comment->author()->reputationImage()}}

 

  • 4 месяца спустя...
comment_144208
В 14.10.2017 в 00:27, Quzask сказал:

Добавить получилось, но вот остальную информацию убрать не могу.

Ну можешь самым простым способом сделать.
Когда написать код:

{{if $comment->author()->member_id == X}}
<!--Код, для X ид !-->
{{else}}
<!--Код, для остальных ID пользователей !--> 
{{endif}}

Между:

{{if $comment->author()->member_id == X}}
<!--Код, для X ид !-->
{{else}}

В самом низу напиши:

<style>
.название /* Название class */ {
	display: none;
}
</style>

И так с каждым class/id, просто отключаешь и все.

comment_144210

Способ выше не совсем подходит, т.к если пользователь с X id пишет в тему, то там автоматически отключает CSS.
Все дело в расстановке. Т.е код: 

{{if $comment->author()->member_id == X}}

Должен стоять выше всех пунктов в меню, в нашем случае до:

<li class='cAuthorPane_photo'>
	{template="userPhoto" app="core" group="global" params="$comment->author(), 'large', $comment->warningRef()"}
</li>

Т.е все, что выше: 

{{if $comment->author()->member_id == X}}

Будет отображать, а ниже - нет.
Но не забываем еще ставить 

{{else}}

И обязательно в конце всех пунктов ставить:

{{endif}}

 

Пример(стандартный стиль IPS)

{{$idField = $comment::$databaseColumnId;}}
{{$itemClassSafe = str_replace( '\\', '_', mb_substr( $comment::$itemClass, 4 ) );}}
{{if $comment->isIgnored()}}
	<div class='ipsComment ipsComment_ignored ipsType_light' id='elIgnoreComment_{$comment->$idField}' data-ignoreCommentID='elComment_{$comment->$idField}' data-ignoreUserID='{$comment->author()->member_id}'>
		{lang="ignoring_content" sprintf="$comment->author()->name"} <a href='#elIgnoreComment_{$comment->$idField}_menu' data-ipsMenu data-ipsMenu-menuID='elIgnoreComment_{$comment->$idField}_menu' data-ipsMenu-appendTo='#elIgnoreComment_{$comment->$idField}' data-action="ignoreOptions" title='{lang="see_post_ignore_options"}' class='ipsType_blendLinks'>{lang="options"} <i class='fa fa-caret-down'></i></a>
		<ul class='ipsMenu ipsHide' id='elIgnoreComment_{$comment->$idField}_menu'>
			<li class='ipsMenu_item ipsJS_show' data-ipsMenuValue='showPost'><a href='#'>{lang="show_this_post"}</a></li>
			<li class='ipsMenu_sep ipsJS_show'><hr></li>
			<li class='ipsMenu_item' data-ipsMenuValue='stopIgnoring'><a href='{url="app=core&module=system&controller=ignore&do=remove&id={$comment->author()->member_id}" seoTemplate="ignore"}'>{lang="stop_ignoring_posts_by" sprintf="$comment->author()->name"}</a></li>
			<li class='ipsMenu_item'><a href='{url="app=core&module=system&controller=ignore" seoTemplate="ignore"}'>{lang="change_ignore_preferences"}</a></li>
		</ul>
	</div>
{{endif}}

<a id='comment-{$comment->$idField}'></a>
<article {{if $comment->author()->hasHighlightedReplies()}}data-memberGroup="{$comment->author()->member_group_id}" {{endif}} id='elComment_{$comment->$idField}' class='cPost ipsBox {{if $otherClasses}}{$otherClasses}{{endif}} ipsComment {{if ( settings.reputation_highlight and $comment->reactionCount() >= settings.reputation_highlight and settings.reputation_enabled ) OR $comment->isFeatured()}}ipsComment_popular{{endif}} ipsComment_parent ipsClearfix ipsClear ipsColumns ipsColumns_noSpacing ipsColumns_collapsePhone {{if $comment->author()->hasHighlightedReplies()}}ipsComment_highlighted{{endif}}{{if $comment->isIgnored()}}ipsHide{{endif}} {{if $comment->hidden() OR $item->hidden() === -2}}ipsModerated{{endif}}'>
	{{if $item->isQuestion() and !$comment->new_topic}}
		{template="postRating" group="topics" app="forums" params="$item, $comment, $votes"}
	{{endif}}

	<div class='cAuthorPane cAuthorPane_mobile ipsResponsive_showPhone ipsResponsive_block'>
		<h3 class='ipsType_sectionHead cAuthorPane_author ipsResponsive_showPhone ipsResponsive_inlineBlock ipsType_break ipsType_blendLinks ipsTruncate ipsTruncate_line'>
			{template="userLink" group="global" app="core" params="$comment->author(), $comment->warningRef(), $comment->author()->group['g_id']"}
			<span class='ipsResponsive_showPhone ipsResponsive_inline'>&nbsp;&nbsp;{template="reputationBadge" group="global" app="core" params="$comment->author()"}</span>
		</h3>
		<div class='cAuthorPane_photo'>
			{template="userPhoto" app="core" group="global" params="$comment->author(), 'large', $comment->warningRef()"}
		</div>
	</div>
	<aside class='ipsComment_author cAuthorPane ipsColumn ipsColumn_medium ipsResponsive_hidePhone'>
		<h3 class='ipsType_sectionHead cAuthorPane_author ipsType_blendLinks ipsType_break'><strong>{$comment->author()->link( $comment->warningRef() )|raw}</strong> <span class='ipsResponsive_showPhone ipsResponsive_inline'>&nbsp;&nbsp;{template="reputationBadge" group="global" app="core" params="$comment->author()"}</span></h3>
		
		<ul class='cAuthorPane_info ipsList_reset'>
			{{if $comment->author()->member_title && $comment->author()->member_id}}
				<li class='ipsType_break'>{$comment->author()->member_title}</li>
			{{elseif $comment->author()->rank['title'] && $comment->author()->member_id}}
				<li class='ipsType_break'>{$comment->author()->rank['title']}</li>
			{{endif}}
			{{if $comment->author()->rank['image'] && $comment->author()->member_id}}
				<li>{$comment->author()->rank['image']|raw}</li>
			{{endif}}

			<li class='cAuthorPane_photo'>
				{template="userPhoto" app="core" group="global" params="$comment->author(), 'large', $comment->warningRef()"}
			</li>
			<li>{expression="\IPS\Member\Group::load( $comment->author()->member_group_id )->formattedName" raw="true"}</li>
			{{if \IPS\Member\Group::load( $comment->author()->member_group_id )->g_icon }}
				<li><img src='{file="$comment->author()->group['g_icon']" extension="core_Theme"}' alt='' class='cAuthorGroupIcon'></li>
			{{endif}}
			{{if $comment->author()->member_id}}
				<li>{template="reputationBadge" group="global" app="core" params="$comment->author()"}</li>
				<li class='ipsType_light'>{lang="member_post_count" pluralize="$comment->author()->member_posts"}</li>
				{{if $comment->author()->reputationImage()}}
					<li class='ipsPad_half'>
						<img src='{file="$comment->author()->reputationImage()" extension="core_Theme"}' title='{{if $comment->author()->reputation()}}{$comment->author()->reputation()}{{endif}}' alt=''>
					</li>
				{{endif}}
				{template="customFieldsDisplay" group="global" app="core" params="$comment->author()"}
			{{endif}}
		</ul>
	</aside>
	<div class='ipsColumn ipsColumn_fluid'>
		{template="post" group="topics" app="forums" params="$item, $comment, $item::$formLangPrefix . 'comment', $item::$application, $item::$module, $itemClassSafe"}
	</div>
</article>

 

Получается так:

{{$idField = $comment::$databaseColumnId;}}
{{$itemClassSafe = str_replace( '\\', '_', mb_substr( $comment::$itemClass, 4 ) );}}
{{if $comment->isIgnored()}}
	<div class='ipsComment ipsComment_ignored ipsType_light' id='elIgnoreComment_{$comment->$idField}' data-ignoreCommentID='elComment_{$comment->$idField}' data-ignoreUserID='{$comment->author()->member_id}'>
		{lang="ignoring_content" sprintf="$comment->author()->name"} <a href='#elIgnoreComment_{$comment->$idField}_menu' data-ipsMenu data-ipsMenu-menuID='elIgnoreComment_{$comment->$idField}_menu' data-ipsMenu-appendTo='#elIgnoreComment_{$comment->$idField}' data-action="ignoreOptions" title='{lang="see_post_ignore_options"}' class='ipsType_blendLinks'>{lang="options"} <i class='fa fa-caret-down'></i></a>
		<ul class='ipsMenu ipsHide' id='elIgnoreComment_{$comment->$idField}_menu'>
			<li class='ipsMenu_item ipsJS_show' data-ipsMenuValue='showPost'><a href='#'>{lang="show_this_post"}</a></li>
			<li class='ipsMenu_sep ipsJS_show'><hr></li>
			<li class='ipsMenu_item' data-ipsMenuValue='stopIgnoring'><a href='{url="app=core&module=system&controller=ignore&do=remove&id={$comment->author()->member_id}" seoTemplate="ignore"}'>{lang="stop_ignoring_posts_by" sprintf="$comment->author()->name"}</a></li>
			<li class='ipsMenu_item'><a href='{url="app=core&module=system&controller=ignore" seoTemplate="ignore"}'>{lang="change_ignore_preferences"}</a></li>
		</ul>
	</div>
{{endif}}

<a id='comment-{$comment->$idField}'></a>
<article {{if $comment->author()->hasHighlightedReplies()}}data-memberGroup="{$comment->author()->member_group_id}" {{endif}} id='elComment_{$comment->$idField}' class='cPost ipsBox {{if $otherClasses}}{$otherClasses}{{endif}} ipsComment {{if ( settings.reputation_highlight and $comment->reactionCount() >= settings.reputation_highlight and settings.reputation_enabled ) OR $comment->isFeatured()}}ipsComment_popular{{endif}} ipsComment_parent ipsClearfix ipsClear ipsColumns ipsColumns_noSpacing ipsColumns_collapsePhone {{if $comment->author()->hasHighlightedReplies()}}ipsComment_highlighted{{endif}}{{if $comment->isIgnored()}}ipsHide{{endif}} {{if $comment->hidden() OR $item->hidden() === -2}}ipsModerated{{endif}}'>
	{{if $item->isQuestion() and !$comment->new_topic}}
		{template="postRating" group="topics" app="forums" params="$item, $comment, $votes"}
	{{endif}}

	<div class='cAuthorPane cAuthorPane_mobile ipsResponsive_showPhone ipsResponsive_block'>
		<h3 class='ipsType_sectionHead cAuthorPane_author ipsResponsive_showPhone ipsResponsive_inlineBlock ipsType_break ipsType_blendLinks ipsTruncate ipsTruncate_line'>
			{template="userLink" group="global" app="core" params="$comment->author(), $comment->warningRef(), $comment->author()->group['g_id']"}
			<span class='ipsResponsive_showPhone ipsResponsive_inline'>&nbsp;&nbsp;{template="reputationBadge" group="global" app="core" params="$comment->author()"}</span>
		</h3>
		<div class='cAuthorPane_photo'>
			{template="userPhoto" app="core" group="global" params="$comment->author(), 'large', $comment->warningRef()"}
		</div>
	</div>
	<aside class='ipsComment_author cAuthorPane ipsColumn ipsColumn_medium ipsResponsive_hidePhone'>
		<h3 class='ipsType_sectionHead cAuthorPane_author ipsType_blendLinks ipsType_break'><strong>{$comment->author()->link( $comment->warningRef() )|raw}</strong> <span class='ipsResponsive_showPhone ipsResponsive_inline'>&nbsp;&nbsp;{template="reputationBadge" group="global" app="core" params="$comment->author()"}</span></h3>
		<ul class='cAuthorPane_info ipsList_reset'>
			{{if $comment->author()->member_title && $comment->author()->member_id}}
				<li class='ipsType_break'>{$comment->author()->member_title}</li>
			{{elseif $comment->author()->rank['title'] && $comment->author()->member_id}}
				<li class='ipsType_break'>{$comment->author()->rank['title']}</li>
			{{endif}}
			{{if $comment->author()->rank['image'] && $comment->author()->member_id}}
				<li>{$comment->author()->rank['image']|raw}</li>
			{{endif}}

			<li class='cAuthorPane_photo'>
				{template="userPhoto" app="core" group="global" params="$comment->author(), 'large', $comment->warningRef()"}
			</li>
          	{{if $comment->author()->member_id == 1}}
				<br>
				<li style="color: black; font-size: 13px; font-weight: bold; border-bottom: 0; margin-bottom: 10px;">Администратор проекта</li>
				<a href="https://99fps.ru/topic/2936-voodnik-kachestvennye-i-nedorogie-uslugi" target="_blank" style="color: red; font-size: 20px; font-weight: bold; border-bottom: 1px solid red;">Платные услуги</a>
				<br>
				<br>
				<a href="http://ipbmafia.ru/topic/4956-kratkie-pravila-foruma-ipbmafiaru/" target="_blank" style="color: #6D7E8C; font-size: 15px; font-weight: bold; border-bottom: 1px solid #6D7E8C;">Краткие правила форума</a>
          	{{else}}
			<li>{expression="\IPS\Member\Group::load( $comment->author()->member_group_id )->formattedName" raw="true"}</li>
			{{if \IPS\Member\Group::load( $comment->author()->member_group_id )->g_icon }}
				<li><img src='{file="$comment->author()->group['g_icon']" extension="core_Theme"}' alt='' class='cAuthorGroupIcon'></li>
			{{endif}}
				<li>{template="reputationBadge" group="global" app="core" params="$comment->author()"}</li>
				<li class='ipsType_light'>{lang="member_post_count" pluralize="$comment->author()->member_posts"}</li>
				{{if $comment->author()->reputationImage()}}
					<li class='ipsPad_half'>
						<img src='{file="$comment->author()->reputationImage()" extension="core_Theme"}' title='{{if $comment->author()->reputation()}}{$comment->author()->reputation()}{{endif}}' alt=''>
					</li>
				{{endif}}
				{template="customFieldsDisplay" group="global" app="core" params="$comment->author()"}
		</ul>
      {{endif}}
	</aside>
	<div class='ipsColumn ipsColumn_fluid'>
		{template="post" group="topics" app="forums" params="$item, $comment, $item::$formLangPrefix . 'comment', $item::$application, $item::$module, $itemClassSafe"}
	</div>
</article>

 

Скрин:

Screenshot_2.png.084115fe4b7ceb132d377b869a909d5d.png

  • 1 year later...
comment_157297

Позвольте вопрос, а как нескольким разным пользователям сделать разные минипрофили?

  • 1 месяц спустя...
comment_158360

Попробовал.

Не вышло, прочел:

https://invisionbyte.ru/docs/custom/templates/logika-ifelseifelse-r179/

Не работает так.

Прошу, приведите пример 2х пользователей с индивидуальным профилем, тогда пойму в чем моя ошибка.

  • 1 year later...
comment_167774

Maiden8 держи

 

Спойлер

			{{if $comment->author()->member_id == 3}}
			<!--Код, для X ид !-->
          		<span style='font-weight: bold; background: linear-gradient(to right, #ffd400, #d53a3a); -webkit-background-clip: text; -webkit-text-fill-color: transparent;'> П О Н Т И Ф И К </span>
          		<li>{template="reputationBadge" group="global" app="core" params="$comment->author()"}</li>
				<li class='ipsType_light'>{lang="member_post_count" pluralize="$comment->author()->member_posts"}</li>
          	{{if $comment->author()->reputationImage()}}
					<li class='ipsPad_half'>
						<img src='{file="$comment->author()->reputationImage()" extension="core_Theme"}' title='{{if $comment->author()->reputation()}}{$comment->author()->reputation()}{{endif}}' alt=''>
					</li>
				{{endif}}
          			{template="customFieldsDisplay" group="global" app="core" params="$comment->author()"}
          
          	{{elseif $comment->author()->member_id == 1}}
          	<!--Код, для X ид !-->
          		<span style='font-weight: bold; background: linear-gradient(to right bottom, #02ffff, #00d3ff, #00a3ff, #006df6, #2525c2 ); -webkit-background-clip: text; -webkit-text-fill-color: transparent;'> Б А Н К И Р =) </span>
          		<li>{template="reputationBadge" group="global" app="core" params="$comment->author()"}</li>
				<li class='ipsType_light'>{lang="member_post_count" pluralize="$comment->author()->member_posts"}</li>
          	{{if $comment->author()->reputationImage()}}
					<li class='ipsPad_half'>
						<img src='{file="$comment->author()->reputationImage()" extension="core_Theme"}' title='{{if $comment->author()->reputation()}}{$comment->author()->reputation()}{{endif}}' alt=''>
					</li>
          		{{endif}}
          			{template="customFieldsDisplay" group="global" app="core" params="$comment->author()"}
          
          	{{elseif $comment->author()->member_id == 126}}
          	<!--Код, для X ид !-->
          		<span style='font-weight: bold; background: linear-gradient(to right bottom, #ff02f4, #ff009f, #ff375d, #ec6931, #c28525 ); -webkit-background-clip: text; -webkit-text-fill-color: transparent;'>УЛЬТРУХА КОСЯК</span>
          		<li>{template="reputationBadge" group="global" app="core" params="$comment->author()"}</li>
				<li class='ipsType_light'>{lang="member_post_count" pluralize="$comment->author()->member_posts"}</li>
          	{{if $comment->author()->reputationImage()}}
					<li class='ipsPad_half'>
						<img src='{file="$comment->author()->reputationImage()" extension="core_Theme"}' title='{{if $comment->author()->reputation()}}{$comment->author()->reputation()}{{endif}}' alt=''>
					</li>
          		{{endif}}
          			{template="customFieldsDisplay" group="global" app="core" params="$comment->author()"}
          
          	{{elseif $comment->author()->member_id == 153}}
			<!--Код, для X ид !-->
          		<span style='font-weight: bold; background: linear-gradient(to right, #02FF0D, #C2C225); -webkit-background-clip: text; -webkit-text-fill-color: transparent;'> Д И К И Й Д А У Н </span>
          		<li>{template="reputationBadge" group="global" app="core" params="$comment->author()"}</li>
				<li class='ipsType_light'>{lang="member_post_count" pluralize="$comment->author()->member_posts"}</li>
          	{{if $comment->author()->reputationImage()}}
					<li class='ipsPad_half'>
						<img src='{file="$comment->author()->reputationImage()" extension="core_Theme"}' title='{{if $comment->author()->reputation()}}{$comment->author()->reputation()}{{endif}}' alt=''>
					</li>
				{{endif}}
          			{template="customFieldsDisplay" group="global" app="core" params="$comment->author()"}
          
          	{{elseif $comment->author()->member_id == 318}}
			<!--Код, для X ид !-->
          		<span style='font-weight: bold; background: linear-gradient(to right, #E3DDE3, #C02F3C); -webkit-background-clip: text; -webkit-text-fill-color: transparent;'> М А Т Ь Х И Л О В </span>
          		<li>{template="reputationBadge" group="global" app="core" params="$comment->author()"}</li>
				<li class='ipsType_light'>{lang="member_post_count" pluralize="$comment->author()->member_posts"}</li>
          	{{if $comment->author()->reputationImage()}}
					<li class='ipsPad_half'>
						<img src='{file="$comment->author()->reputationImage()" extension="core_Theme"}' title='{{if $comment->author()->reputation()}}{$comment->author()->reputation()}{{endif}}' alt=''>
					</li>
				{{endif}}
          			{template="customFieldsDisplay" group="global" app="core" params="$comment->author()"}
          
          	{{elseif $comment->author()->member_id == 232}}
			<!--Код, для X ид !-->
          		<span style='font-weight: bold; background: linear-gradient(to right, #7a11b8, #E7A01B); -webkit-background-clip: text; -webkit-text-fill-color: transparent;'> К Р Е Й З И С О В А </span>
          		<li>{template="reputationBadge" group="global" app="core" params="$comment->author()"}</li>
				<li class='ipsType_light'>{lang="member_post_count" pluralize="$comment->author()->member_posts"}</li>
          	{{if $comment->author()->reputationImage()}}
					<li class='ipsPad_half'>
						<img src='{file="$comment->author()->reputationImage()" extension="core_Theme"}' title='{{if $comment->author()->reputation()}}{$comment->author()->reputation()}{{endif}}' alt=''>
					</li>
				{{endif}}
          			{template="customFieldsDisplay" group="global" app="core" params="$comment->author()"}
          
            	{{elseif $comment->author()->member_id == 491}}
			<!--Код, для X ид !-->
          		<span style='font-weight: bold; background: linear-gradient(to right, #3EADCF, #ABE9CD); -webkit-background-clip: text; -webkit-text-fill-color: transparent;'> н е д о М А Г</span>
          		<li>{template="reputationBadge" group="global" app="core" params="$comment->author()"}</li>
				<li class='ipsType_light'>{lang="member_post_count" pluralize="$comment->author()->member_posts"}</li>
          	{{if $comment->author()->reputationImage()}}
					<li class='ipsPad_half'>
						<img src='{file="$comment->author()->reputationImage()" extension="core_Theme"}' title='{{if $comment->author()->reputation()}}{$comment->author()->reputation()}{{endif}}' alt=''>
					</li>
				{{endif}}
          			{template="customFieldsDisplay" group="global" app="core" params="$comment->author()"}
          
				{{else}}
         
			<!--Код, для остальных ID пользователей !--> 
				
			
				<li data-role='reputation-badge'>
					{template="reputationBadge" group="global" app="core" params="$comment->author()"}
					{{if isset( $comment->author_solved_count )}}
						&nbsp;{template="solvedBadge" group="global" app="core" params="$comment->author(), $comment->author_solved_count"}
					{{endif}}
				</li>
				<li data-role='posts' class='ipsType_light'>{lang="member_post_count" pluralize="$comment->author()->member_posts"}</li>

				{{if $comment->author()->reputationImage()}}
					<li data-role='reputation-image' class='ipsPadding:half'>
						<img src='{file="$comment->author()->reputationImage()" extension="core_Theme"}' title='{{if $comment->author()->reputation()}}{$comment->author()->reputation()}{{endif}}' alt=''>
					</li>
				{{endif}}
				{template="customFieldsDisplay" group="global" app="core" params="$comment->author()"}
		

 

 

  • 3 недели спустя...

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
Ответить в этой теме...

Последние посетители 0

  • No registered users viewing this page.