Skocz do zawartości
Hosting webh.pl - 20%

How to display reputation below avatar just like posts/solutions are shown?

Rekomendowane odpowiedzi

Opublikowano

Hello, I wish to achieve this without using any plugin by purely editing the template. I wish to display the total member reputation inbetween total posts and solutions.

 

image.png.16301721f4f4d7d3a9dbcdfe834e2738.png

 

So far I'm trying this code, but it does not load the reputation numbers. Can anyone help me out?

 

							<li>
								{{if \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'core', 'members', 'front' ) ) }}
									<a href='{url="app=core&module=members&controller=profile&id={$comment->author()->member_id}&do=solutions" seoTemplate="profile_solutions" seoTitle="$comment->author()->members_seo_name"}' rel="nofollow" title="{lang="profile_reputation" pluralize="$comment->author_reputation_count"}" data-ipsTooltip class='ipsType_blendLinks'>
								{{endif}}		
									   <i class='fa fa-plus-circle'></i> {number="$member->pp_reputation_points" format="short"}
								{{if \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'core', 'members', 'front' ) ) }}
									</a>
								{{endif}}
							</li>

 

Edytowane przez Maxius

Rozwiązane przez Weak.

Opublikowano
  • Manager

Hello,

not sure where did you get that part of the theme, but mine looks like this:

{{if settings.reputation_enabled and settings.reputation_show_profile}}
								{{if member.group['gbw_view_reps']}}
									<a href="{url="app=core&module=members&controller=profile&id={$member->member_id}&do=reputation" seoTemplate="profile_reputation" seoTitle="$member->members_seo_name"}" data-action="repLog" title="{lang="members_reputation" sprintf="$member->name"}" class='ipsPadding_vertical:half ipsRadius'>
								{{else}}
									<div class='ipsPadding_vertical:half'>
								{{endif}}
										<p class='ipsType_reset cProfileRepScore {{if $member->pp_reputation_points > 1}}cProfileRepScore_positive{{elseif $member->pp_reputation_points < 0}}cProfileRepScore_negative{{else}}cProfileRepScore_neutral{{endif}} ipsRadius:full ipsDimension_height:4 ipsDimension_minWidth:4 ipsPadding_horizontal:half ipsType_large ipsFlex-inline ipsFlex-ai:center ipsFlex-jc:center' {{if $member->reputation()}}data-ipsTooltip title="{$member->reputation()}"{{endif}}>{number="$member->pp_reputation_points" format="short"}</p>
										<h3 class='ipsType_reset ipsType_unbold ipsType_medium ipsType_light ipsMargin_top:half'>
											{lang="profile_reputation"}
										</h3>
								{{if member.group['gbw_view_reps']}}
									</a>
								{{else}}
									</div>
								{{endif}}
							{{endif}}

 

Did you enabled also "Show each member's total reputation points on their profile?" setting in the Reputation section?

image.png

 

 

intermedia - profesjonalne rozwiązania Invision Power Board, IC5

Opublikowano
  • Autor

This is setting is enabled. The code I have I basically copied the code that displays the solutions and began editing it to show reputation.

 

Your code is probably taken from profile page and throws an error on topicview.

 

I also tried taking the part of code from Member hovercard that shows reputation and I also get nothing.

 

I know I'm missing some sort of code that loads the data in a topic-view page which then in turn can display the reputation on the page.

 

so I short this value is not parsed (or whatever the term is)

 

{number="$member->pp_reputation_points" format="short"}

 

Opublikowano
  • Manager

Gosh, sorry, this code should be fine:

						{{if isset( $comment->author_solved_count )}}
							<li>
								{{if \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'core', 'members', 'front' ) ) }}
									<a href='{url="app=core&module=members&controller=profile&id={$comment->author()->member_id}&do=solutions" seoTemplate="profile_solutions" seoTitle="$comment->author()->members_seo_name"}' rel="nofollow" title="{lang="solved_badge_tooltip" pluralize="$comment->author_solved_count"}" data-ipsTooltip class='ipsType_blendLinks'>
								{{endif}}		
									   <i class='fa fa-check-circle'></i> {number="$comment->author_solved_count"}
								{{if \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'core', 'members', 'front' ) ) }}
									</a>
								{{endif}}
							</li>
						{{endif}}

The only condition is:

{{if isset( $comment->author_solved_count )}}

Which corresponds to:

				foreach( $results as $id => $data )
				{
					if ( isset( $solvedCounts[ $data->$authorField ] ) )
					{
						$results[ $id ]->author_solved_count = $solvedCounts[ $data->$authorField ];
					}
				}

 

 

Could you try this:

						11{{if isset( $comment->author_solved_count )}}
							<li>
								22{{if \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'core', 'members', 'front' ) ) }}
									33<a href='{url="app=core&module=members&controller=profile&id={$comment->author()->member_id}&do=solutions" seoTemplate="profile_solutions" seoTitle="$comment->author()->members_seo_name"}' rel="nofollow" title="{lang="solved_badge_tooltip" pluralize="$comment->author_solved_count"}" data-ipsTooltip class='ipsType_blendLinks'>
								{{endif}}		
									   <i class='fa fa-check-circle'></i> {number="$comment->author_solved_count"}
								{{if \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'core', 'members', 'front' ) ) }}
									</a>
								{{endif}}
							</li>
						{{endif}}

And tell me what you're seeing in the topic view?

intermedia - profesjonalne rozwiązania Invision Power Board, IC5

Opublikowano
  • Autor

It shows up alright but @DawPi I'm not trying to show solution count twice which your code does.

I want to show MEMBERS' REPUTATION.

 

And the problem is

 

<i class='fa fa-plus-circle'></i> {number="$member->pp_reputation_points" format="short"}

 

does not return me the reputation number the member has.  :)

Opublikowano
  • Autor

I don't have any mods that have anything to do with reputation. I'm running a stock IPS pretty much. What I have installed have to remain installed anyway.

 

Look, forget anything you see about SOLVED. I just took a  piece of that code so the HTML and styling would match for REPUTATION which I want to display.

 

When this code will work I will add this clause around it and it will be complete

 

			{{if settings.reputation_enabled}}
				 
			{{endif}}

 

I just want to know what I have to do to make this code show the reputation when added to postContainer template.

 

{number="$member->pp_reputation_points" format="short"}

 

Opublikowano
  • Autor

Aleliuja there it is, thank you Weak. btw that wasn't weak. :D

Opublikowano
  • Autor

I understand DawPi, I know you are one hell of a modder with proven track record. :D

I too just wrote it off for miscommunication / tiredness.

Opublikowano
  • Manager
20 godzin temu, Maxius napisał(a):

I want to show MEMBERS' REPUTATION.

 

And the problem is

 

<i class='fa fa-plus-circle'></i> {number="$member->pp_reputation_points" format="short"}

 

does not return me the reputation number the member has.  :)

I'm dumb!

Embarrassed Shame GIF

intermedia - profesjonalne rozwiązania Invision Power Board, IC5

Opublikowano
  • Autor

this is my final code, does this seem alright to you guys @DawPi @Weak. ?

 

						{{if settings.reputation_enabled}}
							<li>
								{{if \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'core', 'members', 'front' ) ) }}
									<a href='{url="app=core&module=members&controller=profile&id={$comment->author()->member_id}&do=reputation" seoTemplate="profile_reputation" seoTitle="$comment->author()->members_seo_name"}' rel="nofollow" title="{lang="received_x_points" pluralize="$comment->author()->pp_reputation_points"}" data-ipsTooltip class='ipsType_blendLinks'>
								{{endif}}		
									   <i class='fa fa-plus-circle'></i> {number="$comment->author()->pp_reputation_points" format="short"}
								{{if \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'core', 'members', 'front' ) ) }}
									</a>
								{{endif}}
							</li>
						{{endif}}

 

Opublikowano
  • Autor

It turns out I need one more thing. This file edit I made shows the icon and number 0 even if a member does not have any reputation. That's no good. I need a IF statement to show only if a member has any sort of reputation score.

 

@DawPi do you know how should I expand this if statement to make it so that members who have no reputation would be skipped?

 

{{if settings.reputation_enabled}}

 

Something like

{{if settings.reputation_enabled and has reputation }}
Opublikowano
  • Autor

Edit I think I have found it.

 

\count( $comment->reactions() )

 

Is it right @DawPi ?

Jeśli chcesz dodać odpowiedź, zaloguj się lub zarejestruj nowe konto

Ostatnio przeglądający 0

  • Brak zarejestrowanych użytkowników przeglądających tę stronę.

Szukaj

Szukaj

Skonfiguruj powiadomienia push w przeglądarce

Chrome (Android)
  1. Stuknij ikonę kłódki obok paska adresu.
  2. Stuknij Uprawnienia → Powiadomienia.
  3. Dostosuj swoje ustawienie.
Chrome (Komputer)
  1. Kliknij ikonę kłódki na pasku adresu.
  2. Wybierz Ustawienia witryny.
  3. Znajdź Powiadomienia i dostosuj swoje ustawienie.