# Benutzer-Custom\_Field für Composer Connector verfügbar machen?

**URL:** https://meta.discourse.org/t/making-user-custom-field-available-to-composer-connector/81601
**Category:** Development
**Created:** [26. Februar 2018 um 22:05 UTC](https://meta.discourse.org/t/making-user-custom-field-available-to-composer-connector/81601 "2018-02-26T22:05:31Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![ChrisBeach](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/chrisbeach/32/214628_2.png) [@ChrisBeach](https://meta.discourse.org/u/ChrisBeach)
#### Post date: [26. Februar 2018 um 22:05 UTC](https://meta.discourse.org/t/making-user-custom-field-available-to-composer-connector/81601/1 "2018-02-26T22:05:31Z")

</div>

I’m very close to finishing a new plugin that allows members to pay to pin their own topics.

 ![image](https://global.discourse-cdn.com/meta/original/3X/6/b/6b59f6e1c46eb251fbb8b6ccfee73ca3cda89bb5.png)

 ![image](https://global.discourse-cdn.com/meta/original/3X/6/c/6c0d7f8afb52e2f0c255ab5a09f34874c4099f78.png)

 ![image](https://global.discourse-cdn.com/meta/original/3X/e/9/e9aeaab858414032705bd1de0e73a16ec0405d05.png)

Just one little thing is eluding me. I store the user’s balance in a user custom\_field, updating the balance when a payment is made. When a user creates a pinned topic, the balance is reduced. All works fine.

What I’d like to do is to hide the “Pinned” checkbox on the Composer if the user’s balance is zero or insufficient.

However, I can’t find an easy way to access the user custom\_field from within the composer connector `.js.es6` file

Current code (not working):

```plaintext
import { showTxns } from 'discourse/plugins/stripe/discourse-plugin-stripe/lib/txns';
import { getOwner } from 'discourse-common/lib/get-owner';

export default {
    shouldRender(args, component) {
        // FIXME not working
        const balance = component.currentUser.custom_fields["stripe_txn_balance"];
        const fee = component.siteSettings.stripe_plugin_fee;
        return balance >= fee;
    }
};

```

Do I need to make a call to the “store” (i.e. the backend) to query the custom\_field?

Would appreciate your help.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [27. Februar 2018 um 07:58 UTC](https://meta.discourse.org/t/making-user-custom-field-available-to-composer-connector/81601/2 "2018-02-27T07:58:29Z")

</div>

In your plugin, I would add the current balance in the user serializer. That way, you’ll be able to do `component.currentUser.get('balance')`.

---

<div class="post-metadata">

### Author: ![ChrisBeach](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/chrisbeach/32/214628_2.png) [@ChrisBeach](https://meta.discourse.org/u/ChrisBeach)
#### Post date: [27. Februar 2018 um 08:18 UTC](https://meta.discourse.org/t/making-user-custom-field-available-to-composer-connector/81601/3 "2018-02-27T08:18:53Z")

</div>

Thanks @zogstrip, I’ll give that a go. Sounds like an elegant solution.
