# User page with custom data from external DB

**URL:** https://meta.discourse.org/t/user-page-with-custom-data-from-external-db/56351
**Category:** Development
**Created:** [1월 25, 2017, 8:33오후 UTC](https://meta.discourse.org/t/user-page-with-custom-data-from-external-db/56351 "2017-01-25T20:33:07Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![LeoMcA](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/leomca/32/87233_2.png) [@LeoMcA](https://meta.discourse.org/u/LeoMcA)
#### Post date: [1월 25, 2017, 9:15오후 UTC](https://meta.discourse.org/t/user-page-with-custom-data-from-external-db/56351/2 "2017-01-25T21:15:08Z")

</div>

> [@Rojoss](#):
>
> And in general I’d like to know if this is even possible or if it’s too ambitious.

Totally possible, if you’re willing to persevere a little bit.

> [@Rojoss](#):
>
> Is it possible to fetch user data from our MySQL DB?

It _is_, but connecting Discourse to two databases makes me wince a bit.

It might help if you understood how all the bits of Discourse link together. You basically have to think of Discourse as two seperate applications - the frontend, running an Ember app, and the backend, running a Rails app.

The frontend and the backend talk through an API, but otherwise, they’re basically entirely self contained.

So whatever you end up doing, you’re going to have to write a REST API to get the data from the backend to the frontend **\***. So now the question becomes, are you going to want to do anything on the backend with this data? (Such as assigning people to groups, or awarding badges, based on it.) Or is it just stuff you want to show on the frontend?

If you do want to to do stuff on the backend with it, you’ll have to have that data in some form on the backend (so this is where you’d connect to your MySQL db from ruby) and then write your API in ruby to actually get the data to the frontend.

If you don’t, then you might as well write your API in whatever language you feel most comfortable, and then query that from the frontend.

**\*** Unless its very simple data, in which case it’s easiest to pass it to the frontend by adding it as a `user.custom_fields`, which you can then access through the `user` object in your plugin outlet.

> [@Rojoss](#):
>
> I couldn’t find any handle to add a new user page is there support for this?

There should be, soon:

> [@Add plugin-outlet for user main navigation](https://meta.discourse.org/t/add-plugin-outlet-for-user-main-navigation/56075):
>
> I’m working on a couple plugins where I’d like to add a menu item on the user level. To me it makes sense to have a way to add to this here: Any time we have something that is tied to the user, we could create a menu item on the user level. I’m specifically trying to find a way to show a user their license keys and subscriptions on the site. And to make things easier wink

> [@Rojoss](#):
>
> Also, is it really necessary to exit and start the bundle for each change?

Only server-side changes (so generally those done in Ruby). Generally anything changed client side just needs a refresh of the page (although sometimes you need to kill your rails server and do a `rm -rf tmp/`).

> [@Rojoss](#):
>
> Finally, in general I’d like to know if there is any documentation I might have missed because it’s quite hard to get started on this even though I have quite a lot of experience as developer.

Yes, almost certainly. I’m always stumbling across topics on here which I realised would’ve helped me out massively when I was trying to figure out how to do something (both at the beginning, and more recently).

The [Rails](http://guides.rubyonrails.org/v4.2/) and [Ember](https://guides.emberjs.com/v2.10.0/) guides have a wealth of general information, especially with the latter when it comes to this:

> [@Rojoss](#):
>
> Topics such as controllers, widgets, database, custom locale, models, services, views etc.I see a lot of plugins with folder structures with things mentioned above but nowhere is really explained what it’s all about.

And there’s this wonderful topic:

> [@Learn how to start building stuff for Discourse if you're newbie (like myself)](https://meta.discourse.org/t/how-to-start-building-stuff-for-discourse-if-youre-newbie-like-myself/45954):
>
> There are a few ‘how to start’ guides for working with Discourse already and a wealth of useful info on meta, but I thought it might help to give an insight to the mental processes of starting from little, if any, prior coding experience to building substantial Discourse plugins. Discourse is written by experienced developers and has a large codebase. This can feel intimidating. This intimidation factor can be a significant barrier for novice developers. This is a kind of ‘psychological primer’…

Good luck, have fun, and I’ve found there’s nothing that can replace a good ol’ bit of messing about just to see what happens! 😄

---

_[View the full topic](https://meta.discourse.org/t/user-page-with-custom-data-from-external-db/56351)._
