# Dreamfactory for Wordpress

**URL:** https://community.dreamfactory.com/t/dreamfactory-for-wordpress/136
**Category:** Users & Roles
**Created:** [July 7, 2014, 2:25pm UTC](https://community.dreamfactory.com/t/dreamfactory-for-wordpress/136 "2014-07-07T14:25:53Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![tiptronic](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/tiptronic/32/1202_2.png) [@tiptronic](https://community.dreamfactory.com/u/tiptronic)
#### Post date: [July 7, 2014, 2:25pm UTC](https://community.dreamfactory.com/t/dreamfactory-for-wordpress/136/1 "2014-07-07T14:25:53Z")

</div>

I want to allow registered users of my Wordpress site to access data in my [dreamfactory.com](https://dreamfactory.com) platform.

That means, a _registered_ user has the ability to access more data (which resides on the DF-backend). There are different user-types (roles) on my Wordpress site.

How would I register a user on the DF-backend, when he/she registers on the Wordpress site?  
How would I login from WordPress into the correct user on the DF-backend.

I could create complementary user-roles in DF and then access data using a user with that role (e.g. user: user\_author or user\_guest). But then I lose the ability to track, which individual user accesses data.

Did anybody try that already or has some ideas how to accomplish this?

---

<div class="post-metadata">

### Author: ![benbusse](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/benbusse/32/4_2.png) [@benbusse](https://community.dreamfactory.com/u/benbusse)
#### Post date: [July 7, 2014, 4:33pm UTC](https://community.dreamfactory.com/t/dreamfactory-for-wordpress/136/2 "2014-07-07T16:33:01Z")

</div>

You can do this. Here’s an overview of the approach.

My suggestion would be to duplicate the roles from your WordPress system into DreamFactory, and use the DreamFactory /user api to operate on users.

For example, when a user logs in to WordPress, check if the user is also in DreamFactory. If not, then create the user in DreamFactory and return a session token. If the user is already in DreamFactory, just return a session token.

Ideally, you want a plugin that hooks into the WordPress register/login/logout mechanism. You can store the session obtained from DreamFactory in the user metadata and when a user encounters a page that uses data from DreamFactory you can access that session ID and allow the page/app to make API calls to DreamFactory.

You could also have a UI component in the Wordpress plugin that allows manipulation of the mapping of roles. It’s OK to not have this UI if you’re dealing with just a few roles but mapping roles manually will be tedious and error prone for lots of roles.
