# Reputation Plugin Version 0.2

**URL:** https://meta.discourse.org/t/reputation-plugin-version-0-2/54758
**Category:** Plugin
**Tags:** broken
**Created:** [December 25, 2016, 6:46am UTC](https://meta.discourse.org/t/reputation-plugin-version-0-2/54758 "2016-12-25T06:46:03Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![Alavi1412](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alavi1412/32/67721_2.png) [@Alavi1412](https://meta.discourse.org/u/Alavi1412)
#### Post date: [December 25, 2016, 6:46am UTC](https://meta.discourse.org/t/reputation-plugin-version-0-2/54758/1 "2016-12-25T06:46:03Z")

</div>

[REPUTATION PLUGIN](https://github.com/Alavi1412/discourse-reputation-plugin)  
this plugin shows a reputation for each user in user’s card:

 ![](https://global.discourse-cdn.com/meta/original/3X/6/2/62d7fc15cf1b9405595d2d2d97b0699463b0bce9.png)  
For now this is showing just the received like but I will improve the rules for giving reputation and make some more complex algorithm than counting just received likes for reputation  
This is my first plugin for discourse and this is the 0.1 version of this pluing and I hope I can develope this plugin with your helps.  
I’m trying to develope this plugin to get the reputation calculation rules from admin in admin pannel  
v0.2:

- Outlet text conflict SOLVED
- Showing s start image with “Your reputation” tooltip

special thanks from cakeday’s author. I learned many things from his [plugin](https://meta.discourse.org/t/cakeday-celebrating-birthdays-and-anniversaries/38447).

---

<div class="post-metadata">

### Author: ![Alavi1412](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alavi1412/32/67721_2.png) [@Alavi1412](https://meta.discourse.org/u/Alavi1412)
#### Post date: [December 25, 2016, 6:47am UTC](https://meta.discourse.org/t/reputation-plugin-version-0-2/54758/2 "2016-12-25T06:47:49Z")

</div>

I have some translation problem for showing the word “Your reputation” in diffrent language.You every body now any answer for this?  
[SOLVED]

---

<div class="post-metadata">

### Author: ![Pad\_Pors](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pad_pors/32/52016_2.png) [@Pad\_Pors](https://meta.discourse.org/u/Pad_Pors)
#### Post date: [December 25, 2016, 6:51am UTC](https://meta.discourse.org/t/reputation-plugin-version-0-2/54758/3 "2016-12-25T06:51:34Z")

</div>

[https://meta.discourse.org/t/contribute-a-translation-to-discourse/14882/30?u=pad\_pors](https://meta.discourse.org/t/contribute-a-translation-to-discourse/14882/30)

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [December 25, 2016, 8:04am UTC](https://meta.discourse.org/t/reputation-plugin-version-0-2/54758/4 "2016-12-25T08:04:36Z")

</div>

> [@Alavi1412](#):
>
> I have some translation problem for showing the word “Your reputation” in diffrent language.You every body now any answer for this?

For something so deceptively simple looking, yml files sure can be enough of a bother at times.

In this case you have a spelling error. It’s “label” _not_ “lable” that you’re after.

---

<div class="post-metadata">

### Author: ![Alavi1412](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alavi1412/32/67721_2.png) [@Alavi1412](https://meta.discourse.org/u/Alavi1412)
#### Post date: [December 25, 2016, 10:35am UTC](https://meta.discourse.org/t/reputation-plugin-version-0-2/54758/5 "2016-12-25T10:35:53Z")

</div>

Is there any problem with this code for reading likes(this is helper):

```plaintext
import { registerUnbound } from 'discourse-common/lib/helpers';
registerUnbound('show', function(params) {
	var target = -1;
	$.ajax({
  url: "/users/" + params + "/summary.json",
  dataType: 'json',
  async: false,
  success: function(data) {
  	target = data.user_summary.likes_received;
  }
});
	return new Handlebars.SafeString(target);
});

```

and the handlebar is:  
`{{show username}}`  
It works well in local but doesn’t work well in website

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [December 25, 2016, 4:52pm UTC](https://meta.discourse.org/t/reputation-plugin-version-0-2/54758/6 "2016-12-25T16:52:46Z")

</div>

> [@Alavi1412](#):
>
> It works well in local but doesn’t work well in website

I would look into getting the Likes Given count from one of the tables instead of an AJAX request. If for only your own site, it might not be a problem. But it is possible for a site to set the Summary page to logged in only, which could cause a problem.

AFAICT there are 3 tables that have Likes Given counts.

One is `directory_items.likes_received` (the Users page) but that can also be logged in only, and it has various `period_type`’s

Another is `user_stats.likes_received` (the Summary page)

The other is `user_actions.action_type` where `user_actions.action_type = 2`  
and it would need to do a COUNT query.

---

<div class="post-metadata">

### Author: ![Alavi1412](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alavi1412/32/67721_2.png) [@Alavi1412](https://meta.discourse.org/u/Alavi1412)
#### Post date: [December 25, 2016, 5:36pm UTC](https://meta.discourse.org/t/reputation-plugin-version-0-2/54758/7 "2016-12-25T17:36:28Z")

</div>

how can I use these in my plugin?  
Should I use helper or using just handlebars are enough

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [December 25, 2016, 6:15pm UTC](https://meta.discourse.org/t/reputation-plugin-version-0-2/54758/8 "2016-12-25T18:15:32Z")

</div>

I used the helper file to read the DOM. I guess it could do AJAX as well, but if a site required being logged in you would need to pass that along somehow.

Offhand I know of three plugins that work with he database. Each has SQL stuff in its the top level plugin.rb file in heredoc syntax.

[https://github.com/discourse/discourse-data-explorer](https://github.com/discourse/discourse-data-explorer)

[https://github.com/discourse/discourse-tagging](https://github.com/discourse/discourse-tagging)  
(Tagging has since been moved into the Core)

[https://github.com/discourse/discourse-moderator-attention](https://github.com/discourse/discourse-moderator-attention)

---

<div class="post-metadata">

### Author: ![Alavi1412](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alavi1412/32/67721_2.png) [@Alavi1412](https://meta.discourse.org/u/Alavi1412)
#### Post date: [December 25, 2016, 6:46pm UTC](https://meta.discourse.org/t/reputation-plugin-version-0-2/54758/9 "2016-12-25T18:46:39Z")

</div>

how can I handle the conflict in showing results?  
the texts are unreadable

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [December 25, 2016, 7:08pm UTC](https://meta.discourse.org/t/reputation-plugin-version-0-2/54758/10 "2016-12-25T19:08:21Z")

</div>

Sorry, I’ve had too much nog or not enough I guess, but you’ve lost me.

What conflict of what results? What text is unreadable? The links to the GitHub repos aren’t working for you?

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [December 27, 2016, 7:31pm UTC](https://meta.discourse.org/t/reputation-plugin-version-0-2/54758/11 "2016-12-27T19:31:59Z")

</div>

> [@Alavi1412](#):
>
> how can I handle the conflict in showing results?the texts are unreadable

I was hoping it might be a simple CSS fix like adding `style="clear: both"` or something.

![](https://global.discourse-cdn.com/meta/original/3X/4/3/439488bb2262833de93e845ad99c37a07e332851.png)

But after looking closely there seems to be an issue with the Core HTML eg.

```plaintext
<div class="names">
  <span>
    <h1 class=" username">
      <a href="/users/adminguy1" data-ember-action="" data-ember-action-1163="1163">
      AdminGuy1 
        <i class="fa fa-shield" aria-hidden="true"></i>
        <span class="sr-only">[en. is a moderator]</span>
      </a>
    </h1>
    <!---->
    <h2>good guy</h2>
    <span id="ember1164" class="ember-view">
      <div id="ember1166" class="user-card-post-names-outlet mitt-show-user-card-post-names ember-view">
      <!---->
      </div>
      <div id="ember1168" class="user-card-post-names-outlet Score ember-view">
      Your reputation: -1
      </div>
    </span>
  </span>
</div>

```

[https://github.com/discourse/discourse/blob/master/app/assets/javascripts/discourse/templates/components/user-card-contents.hbs#L15-L35](https://github.com/discourse/discourse/blob/master/app/assets/javascripts/discourse/templates/components/user-card-contents.hbs#L15-L35)

Having h tags inside of span tags is not valid HTML so it seems senseless to try and apply CSS fixes to it. Though perhaps changing the plugin template divs to spans might improve the display as div tags inside of span tags is not valid HTML either.

I know work is being done with how plugin-outlets will work so probably best to wait until that settles down and concentrate on other areas of your plugin for the time being.

> [@Important changes to Plugin Outlets for Ember 2.10](https://meta.discourse.org/t/important-changes-to-plugin-outlets-for-ember-2-10/54136):
>
> Shortly I will be merging a branch of Discourse into master that updates us to the latest stable version of Ember, which is 2.10. This is exciting because we’ve been behind Ember’s stable branch for a while and we’ve finally caught up! It also contains the Glimmer 2 template engine which is quite a bit faster so the application should be more responsive, and it also cuts down on our template file sizes so the app should be quicker to download. However, there is a downside, and that I wasn’t abl…

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [December 27, 2016, 11:36pm UTC](https://meta.discourse.org/t/reputation-plugin-version-0-2/54758/12 "2016-12-27T23:36:11Z")

</div>

> [@Mittineague](#):
>
> it seems senseless to try and apply CSS fixes to it

At times senseless is my middle name. 😊

If you have your template output an element with a class value, you can use CSS in your assets/stylesheets folder to get it to the far right side of the card.

Not the best solution and it will likely break at some time in the future, but you should be able to see at least some of it without it being obscured or needing to look in view-source.

```plaintext
.your-class {
  text-align: right;
}

```

---

<div class="post-metadata">

### Author: ![Alavi1412](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alavi1412/32/67721_2.png) [@Alavi1412](https://meta.discourse.org/u/Alavi1412)
#### Post date: [December 29, 2016, 11:31am UTC](https://meta.discourse.org/t/reputation-plugin-version-0-2/54758/13 "2016-12-29T11:31:46Z")

</div>

CSS problem solved and some changes took effect in version 0.2

---

<div class="post-metadata">

### Author: ![shaco](https://avatars.discourse-cdn.com/v4/letter/s/6bbea6/32.png) [@shaco](https://meta.discourse.org/u/shaco)
#### Post date: [January 30, 2019, 8:28am UTC](https://meta.discourse.org/t/reputation-plugin-version-0-2/54758/14 "2019-01-30T08:28:55Z")

</div>

Hello , Is there a demo?

---

<div class="post-metadata">

### Author: ![Bathinda](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bathinda/32/135888_2.png) [@Bathinda](https://meta.discourse.org/u/Bathinda)
#### Post date: [February 18, 2020, 3:31am UTC](https://meta.discourse.org/t/reputation-plugin-version-0-2/54758/15 "2020-02-18T03:31:58Z")

</div>

I think this plugin has stopped working/been deprecated in Disco’s recent/current version (2.4.0 Beta11)

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [June 18, 2024, 3:43pm UTC](https://meta.discourse.org/t/reputation-plugin-version-0-2/54758/16 "2024-06-18T15:43:26Z")

</div>


