Mackski Posted June 29, 2015 Share Posted June 29, 2015 For an up-coming site, I have requirements for many user account fields: - 2 types of user accounts, each account has a number of share fields, eg: facebook url, skype id etc- Each account type also has many specific fields. (around 50 each) In this instance, what would be considered "best practice"? 1. Keep user accounts minimal, then create the user types as pages with child pages for each user containing the set of specific and shared fields. Then link these pages to the user account: - User type 1 - User 1 - User 2- User type 2 - User 3 - User 4OR 2. List all fields required for all users on the user template, separated by field sets. The user accounts will also be used / linked in a number of other pages. Although the actual user data will not change often. eg: - Products - User 1 - User 4 Interested in how anyone else would approach this issue. Is there any performance issues having a large number of fiends within the user account template? Cheers. Link to comment Share on other sites More sharing options...
Raymond Geerts Posted June 29, 2015 Share Posted June 29, 2015 When the user specific data does'nt have to be queryable / searchable on database level, all you might need is a textarea field in which you put a JSON object with all the data. Then JSON encode the data that the user submitted, save it to the textarea, and when fetching the data JSON decode it to have it available in an Array or Object. When you want to be able to query / search / filter directly on database level or have huge amounts of data this aproach might not fit your needs. Although as soon you have a JSON decoded object retreived from the database you can search / filter using the API, but then it is all done in memory instead of the on database level. 2 Link to comment Share on other sites More sharing options...
Mackski Posted June 29, 2015 Author Share Posted June 29, 2015 Generally I would take this approach with fields that are only changed by a user on the front end and admin or editors have no need to view the data in a human readable format. In this instance the fields may be changed under review within Processwire. Link to comment Share on other sites More sharing options...
LostKobrakai Posted June 29, 2015 Share Posted June 29, 2015 You can create multiple user templates, since 2.5.14 (https://processwire.com/blog/posts/processwire-core-updates-2.5.14/). I'd use them. 5 Link to comment Share on other sites More sharing options...
Mackski Posted June 29, 2015 Author Share Posted June 29, 2015 Perfect thanks Lost, I must have missed that update. Checking change log now.... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now