رفتن به مطلب

(+آموزش) اضافه کردن «Badge» در پروفایل کاربری با توجه به آیدی گروه کاربری و روز تولد کاربر


ارسال‌های توصیه شده

درود دوستان، وقتتون بخیر

من قصد دارم به ستون سایدبار برخی از پروفایل های کاربران نشان یا Badge با توضیحات خاصی رو اضافه کنم بدین صورت که :

  1. زمانی که کاربری عضو گروه اولیه یا ثانویه مورد نظرم شوند
  2. زمانی که کاربری روز تولدش باشد

برای اینکار باید چکار کنیم و چه تغییراتی رو در کدها ایجاد کنیم؟ @علی یوسفلاوی @وحید نامنی @محمد قاسمی

☀️ به عنوان مثال :

  1. کاربر x عضو گروه کاربری « تیم مدیریت (گروه کاربری اولیه) » یا «نفر برتر المپیاد (گروه کاربری ثانویه)» شده است، من قصد دارم Badge خاصی در پروفایلش نمایش داده شود
  2. کاربر x امروز « 1400/10/13 تاریخ تولدش » است، ، من قصد دارم Badge خاصی در پروفایلش نمایش داده شود

📷 نمونه تصاویر افزودن Badge با عنوان و توضیحات خاص به پروفایل کاربری :

B.thumb.png.79fd9631f865aaae352c1451cc5333b0.png

2101485390_B.thumb.png.1555ce589e7b40e3d2fab064c4e8327e.png

لینک ارسال
به اشتراک گذاری در سایت های دیگر

  • تیم مدیریت/توسعه دهنده

درود بر شما.

خب این یک پروژه برنامه نویسی و زمان بر به حساب میاد، 2 حالت میشه پیاده سازیش کرد:


1) از طریق یک افزونه و هوک نویسی.
2) از طریق ویرایش قالب مربوطه با نمونه کدهایی که وجود دارد، همانند تصویر که ضمیمه کردید.

لینک ارسال
به اشتراک گذاری در سایت های دیگر

۵۹ دقیقه قبل، محمد قاسمی گفته است:

درود بر شما.

خب این یک پروژه برنامه نویسی و زمان بر به حساب میاد، 2 حالت میشه پیاده سازیش کرد:


1) از طریق یک افزونه و هوک نویسی.
2) از طریق ویرایش قالب مربوطه با نمونه کدهایی که وجود دارد، همانند تصویر که ضمیمه کردید.

درود جناب قاسمی

بله صحیح، ضمن اینکه افزونه ای در این مورد وجود داره، منظورم این افزونه زیر هستش که کسانی که عضو تیم مدیران (کارکنان) هستند این Badge با توضیحاتش در پروفایلشون نمایش داده میشه :

ما قصد داریم با افزودن کد این کار رو انجام بدیم (نه به صورت افزونه)، اون تصویری که پیوست کردم و مشاهده کردین مربوط به دستورات کدهای Badge یا نشان lastDayWon بودش که بصورت پیش فرض در پوسته دیفالت موجود است.

ما قصد داریم مثلا در یک قطعه کد مشابه کد پیش فرض lastDayWon بیایم تعریف کنیم و بگیم اگر کاربری member_idـش عضو گروه کاربری اولیه یا ثانویه x بود فلان Badgeـی با فلان توضیحاتی در پروفایلش نمایش داده بشه :

به عنوان مثال به این آدرس مراجعه کنین : https://larascasse.fr/forum/profil/1-marcox/

توضیحات : در اینجا کاربر MarcoX عضو گروه کاربری ثانویه Supporters + است در نتیجه Badge یا نشان VIP | Supporters + با همراه توضیحاتش در پروفایل این کاربر نمایش داده شده است 😇

 

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= پست جدید =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

کدهای شرطی مربوط به Badge های روز تولد کاربر و گروه های کاربری خاص که مربوط به پوسته Fluent Design Theme Edition هستش :

{{if $member->bday_day == \IPS\DateTime::create()->format( 'd' ) and $member->bday_month == \IPS\DateTime::create()->format( 'm' ) and \IPS\Settings::i()->profile_birthday_type == 'public' and theme.fluent_global_birthday and theme.fluent_global_birthday_block }}
						<div class='aXenBlock_profile:birthday cProfileSidebarBlock ipsMargin_bottom ipsPadding ipsRadius'>
							<p class='ipsType_reset ipsType_medium'>
								<strong>
									<span class='ipsType_blendLinks'>{lang='fluent_birthday_happyBirthday'}!</span>
								</strong>
							</p>
							<p class='ipsType_reset ipsType_small'>{lang='fluent_birthday_block_text'}</p>
						</div>
                  	{{endif}}
                  	{{if $member->inGroup( theme.fluent_user_1_id ) and theme.fluent_user_1 and theme.fluent_user_1_block }}
						<div class='aXenBlock_profile:1 cProfileSidebarBlock ipsMargin_bottom ipsPadding ipsRadius'>
							<p class='ipsType_reset ipsType_medium'>
								<strong>
									<span class='ipsType_blendLinks'>{lang='fluent_user_1_title'}</span>
								</strong>
							</p>
							<p class='ipsType_reset ipsType_small'>{lang='fluent_user_1_text'}</p>
						</div>
                  	{{endif}}
                    {{if $member->inGroup( theme.fluent_user_2_id ) and theme.fluent_user_2 and theme.fluent_user_2_block }}
						<div class='aXenBlock_profile:2 cProfileSidebarBlock ipsMargin_bottom ipsPadding ipsRadius'>
							<p class='ipsType_reset ipsType_medium'>
								<strong>
									<span class='ipsType_blendLinks'>{lang='fluent_user_2_title'}</span>
								</strong>
							</p>
							<p class='ipsType_reset ipsType_small'>{lang='fluent_user_2_text'}</p>
						</div>
                  	{{endif}}
                    {{if $member->inGroup( theme.fluent_user_3_id ) and theme.fluent_user_3 and theme.fluent_user_3_block }}
						<div class='aXenBlock_profile:3 cProfileSidebarBlock ipsMargin_bottom ipsPadding ipsRadius'>
							<p class='ipsType_reset ipsType_medium'>
								<strong>
									<span class='ipsType_blendLinks'>{lang='fluent_user_3_title'}</span>
								</strong>
							</p>
							<p class='ipsType_reset ipsType_small'>{lang='fluent_user_3_text'}</p>
						</div>
                  	{{endif}}
                    {{if $member->inGroup( theme.fluent_user_4_id ) and theme.fluent_user_4 and theme.fluent_user_4_block }}
						<div class='aXenBlock_profile:4 cProfileSidebarBlock ipsMargin_bottom ipsPadding ipsRadius'>
							<p class='ipsType_reset ipsType_medium'>
								<strong>
									<span class='ipsType_blendLinks'>{lang='fluent_user_4_title'}</span>
								</strong>
							</p>
							<p class='ipsType_reset ipsType_small'>{lang='fluent_user_4_text'}</p>
						</div>
                  	{{endif}}
                    {{if $member->inGroup( theme.fluent_user_5_id ) and theme.fluent_user_5 and theme.fluent_user_5_block }}
						<div class='aXenBlock_profile:5 cProfileSidebarBlock ipsMargin_bottom ipsPadding ipsRadius'>
							<p class='ipsType_reset ipsType_medium'>
								<strong>
									<span class='ipsType_blendLinks'>{lang='fluent_user_5_title'}</span>
								</strong>
							</p>
							<p class='ipsType_reset ipsType_small'>{lang='fluent_user_5_text'}</p>
						</div>
                  	{{endif}}
                    {{if $member->inGroup( theme.fluent_user_6_id ) and theme.fluent_user_6 and theme.fluent_user_6_block }}
						<div class='aXenBlock_profile:6 cProfileSidebarBlock ipsMargin_bottom ipsPadding ipsRadius'>
							<p class='ipsType_reset ipsType_medium'>
								<strong>
									<span class='ipsType_blendLinks'>{lang='fluent_user_6_title'}</span>
								</strong>
							</p>
							<p class='ipsType_reset ipsType_small'>{lang='fluent_user_6_text'}</p>
						</div>
                  	{{endif}}
                    {{if $member->inGroup( theme.fluent_user_7_id ) and theme.fluent_user_7 and theme.fluent_user_7_block }}
						<div class='aXenBlock_profile:7 cProfileSidebarBlock ipsMargin_bottom ipsPadding ipsRadius'>
							<p class='ipsType_reset ipsType_medium'>
								<strong>
									<span class='ipsType_blendLinks'>{lang='fluent_user_7_title'}</span>
								</strong>
							</p>
							<p class='ipsType_reset ipsType_small'>{lang='fluent_user_7_text'}</p>
						</div>
                  	{{endif}}
                    {{if $member->inGroup( theme.fluent_user_8_id ) and theme.fluent_user_8 and theme.fluent_user_8_block }}
						<div class='aXenBlock_profile:8 cProfileSidebarBlock ipsMargin_bottom ipsPadding ipsRadius'>
							<p class='ipsType_reset ipsType_medium'>
								<strong>
									<span class='ipsType_blendLinks'>{lang='fluent_user_8_title'}</span>
								</strong>
							</p>
							<p class='ipsType_reset ipsType_small'>{lang='fluent_user_8_text'}</p>
						</div>
                  	{{endif}}
                    {{if $member->inGroup( theme.fluent_user_9_id ) and theme.fluent_user_9 and theme.fluent_user_9_block }}
						<div class='aXenBlock_profile:9 cProfileSidebarBlock ipsMargin_bottom ipsPadding ipsRadius'>
							<p class='ipsType_reset ipsType_medium'>
								<strong>
									<span class='ipsType_blendLinks'>{lang='fluent_user_9_title'}</span>
								</strong>
							</p>
							<p class='ipsType_reset ipsType_small'>{lang='fluent_user_9_text'}</p>
						</div>
                    {{endif}}
                  	{{if $member->inGroup( theme.fluent_user_10_id ) and theme.fluent_user_10 and theme.fluent_user_10_block }}
						<div class='aXenBlock_profile:10 cProfileSidebarBlock ipsMargin_bottom ipsPadding ipsRadius'>
							<p class='ipsType_reset ipsType_medium'>
								<strong>
									<span class='ipsType_blendLinks'>{lang='fluent_user_10_title'}</span>
								</strong>
							</p>
							<p class='ipsType_reset ipsType_small'>{lang='fluent_user_10_text'}</p>
						</div>
                 	{{endif}}
					{{if settings.reputation_enabled and settings.reputation_show_profile}}
						{{if settings.reputation_leaderboard_on and settings.reputation_show_days_won_trophy and $member->getReputationDaysWonCount() and $lastDayWon = $member->getReputationLastDayWon()}}
							{{$formattedDate = $lastDayWon['date']->dayAndMonth() . (  $lastDayWon['date']->format('Y') == \IPS\DateTime::ts( time() )->format('Y' ) ? '' : " " . $lastDayWon['date']->format('Y') );}}
							<div class='ipsLeaderboard_trophy_1 cProfileSidebarBlock ipsMargin_bottom ipsPadding ipsRadius'>
								<p class='ipsType_reset ipsType_medium'>
									<strong>
										<a class='ipsType_blendLinks' href="{url="app=core&module=discover&controller=popular&tab=leaderboard&custom_date_start={$lastDayWon['date']->getTimeStamp()}&custom_date_end={$lastDayWon['date']->getTimeStamp()}" seoTemplate="leaderboard_leaderboard"}">
											{{if $member->member_id == \IPS\Member::loggedIn()->member_id}}
												{lang="profile_you_won" sprintf="$formattedDate"}
											{{else}}
												{lang="profile_member_won" sprintf="$member->name, $formattedDate"}
											{{endif}}
										</a>
									</strong>
								</p>
								<p class='ipsType_reset ipsType_small'>{{if $member->member_id == \IPS\Member::loggedIn()->member_id}}{lang="profile_you_congrats"}{{else}}{lang="profile_member_congrats" sprintf="$member->name"}{{endif}}</p>
							</div>
						{{endif}}

پیوست : نتیجه یه سری حرکاتی که با کدهای بالا زدم و خودمم نفهمیدم چکار کردم این شد! 😅 :

H.thumb.png.5a6c81046b2e58de5a217fc9db2f8a33.png

 

لینک ارسال
به اشتراک گذاری در سایت های دیگر

سلام دوست عزیز

باید از دستورات شرطی استفاده کنید

فکر کنم تاپیک زیر کمک می کنه:

 

لینک ارسال
به اشتراک گذاری در سایت های دیگر

۱ ساعت قبل، علی یوسفلاوی گفته است:

سلام دوست عزیز

باید از دستورات شرطی استفاده کنید

فکر کنم تاپیک زیر کمک می کنه:

 

درود جناب یوسفلاوی عزیز ، وقتتون بخیر

بله اون تاپیک رو مشاهده کرده بودم، منتهی دستور شرطی مورد نیاز ما داخلش نبود

تا جایی که من متوجه شدم برای اضافه کردن « نشان روز تولد » باید از این کد ها استفاده کرد ولی دستور شرطش ایراد داره و درست نیست!

{if $member->bday_day == \IPS\DateTime::create()->format( 'd' ) and $member->bday_month == \IPS\DateTime::create()->format( 'm' ) and \IPS\Settings::i()->profile_birthday_type == 'public' and theme.fluent_global_birthday and theme.fluent_global_birthday_block }}
						<div class='aXenBlock_profile:birthday cProfileSidebarBlock ipsMargin_bottom ipsPadding ipsRadius'>
							<p class='ipsType_reset ipsType_medium'>
								<strong>
									<span class='ipsType_blendLinks'>{lang='fluent_birthday_happyBirthday'}!</span>
								</strong>
							</p>
							<p class='ipsType_reset ipsType_small'>{lang='fluent_birthday_block_text'}</p>
						</div>

و برای اضافه کردن «نشان های مختلف برای گروه های کاربری با آیدی مشخص » باید از کدهای زیر استفاده کرد که متاسفانه این مورد هم دستور شرطش درست نیست و ایراد داره!

{{if $member->inGroup( theme.fluent_user_1_id ) and theme.fluent_user_1 and theme.fluent_user_1_block }}
						<div class='aXenBlock_profile:1 cProfileSidebarBlock ipsMargin_bottom ipsPadding ipsRadius'>
							<p class='ipsType_reset ipsType_medium'>
								<strong>
									<span class='ipsType_blendLinks'>عنوان نشان مورد نظر</span>
								</strong>
							</p>
							<p class='ipsType_reset ipsType_small'>توضیحات نشان مورد نظر</p>
						</div>
                  	{{endif}}

در آخر هم، باید با توجه به کلاس های تغییر داده شده و تعریف شده، در بخش custom.css برای هر Badge مورد نظر استایل «بک گراند و رنگ» رو تعریف کرد.

لینک ارسال
به اشتراک گذاری در سایت های دیگر

برای تولد :

{{if $member->bday_day == \IPS\DateTime::create()->format( 'd' ) and $member->bday_month == \IPS\DateTime::create()->format( 'm' )}}
  <div class='bdaye'>
    ...
  </div>
{{endif}}

برای گروه باید آی دی گروه مورد نظر رو قرار بدید

{{if $member->inGroup( '1' )}}
  ...
{{endif}}

 

لینک ارسال
به اشتراک گذاری در سایت های دیگر

خروجی کدهای شرطی که جناب @علی یوسفلاوی عزیز زحمت کشیدن ارسال کردن در نهایت شد این :

البته همونطوری که بالا هم عرض کردم، یادتون نره که برای badge هاتون در custom.css استایل تعریف کنین

227516569_Screenshot2021-06-06at22-02-05Sajjad-InvisionCommunity.thumb.png.5f29814593393496e88ca87317598540.png

لینک ارسال
به اشتراک گذاری در سایت های دیگر

  • سجاد محمدرضائی عنوان را به (+آموزش) اضافه کردن «Badge» در پروفایل کاربری با توجه به آیدی گروه کاربری و روز تولد کاربر تغییر داد

بایگانی شده

این موضوع بایگانی و قفل شده و دیگر امکان ارسال پاسخ نیست.

  • کاربران آنلاین در این صفحه   0 کاربر

    • هیچ کاربر عضوی،در حال مشاهده این صفحه نیست.
×
×
  • اضافه کردن...