I’m wondering if someone did this before or if this is actually a wrong approach. Suggestions are welcome or design implementations.
I usually store users’ data with my own PHP code on its own database and tables.
I’m planning on integrating Expression Engine members to read and manipulate some of that data. Hence, I was wondering why not use channels to store little pieces of data for each user and let EE manage the rest.
Does someone do this already?
Note in my setup, I have a particular form that of course makes all checks first to see if that account can retrieve and edit that data. I also create the specific MySQL fields on each table depending on which data is stored like numbers, or small text, etc. And I also do all the regex on the forms to make sure the data is validated and sanitized before insertion. I know EE is not designed for this and mostly for websites but maybe some people are doing this already and completely using EE channels for this. As you can see its quite complex to have all that in separated PHP files, I could just integrate that code into templates and keep it separated but then EE would be of little usage here in terms of functionality.
Example is a user that has some unique records, for example his purchases, or invoices. Each record is unique per member, and they can edit only their own data.
I know some people actually designed quite complex softwares or GUI around EE and or other CMS systems in the past. I don’t plan to fully migrate my database yet but just specific users data related to an account which would make life easier rather than having to read different systems for an account.
As of today, my existing system of course has a completely different authentication user system and databases but I already created a bridge that lets those users automatically create an account with EE and log in. My idea is to slowly phase that old systems out and migrate them to EE members. The problem is how to have them access the same data transparently.
I’m just curious maybe I should just stick to using PHP code inside EE templates to read and manipulate that data externally or integrate that data completely into EE which would allow me to use specific EE functions like the Query module, or the XSS form protection and other stuff. If suggestions are to integrate it to EE, would be best to keep it to them on a separated table inside the main EE database or just use channels directly? Assuming channels can create the required MySQL fields for each data, like numbers, or digits, etc. For performance reasons it’s always better to use the proper fields related to each data like int, or tinyint, etc.
It would certainly make integration and maintenance easier as well in the future, but maybe this is wrong, and I should not fill the EE database with things that are not content? I know you can say here that anything can be content, even if you just store 1 word in a channel but maybe this is overkill for EE, having that many channels for every little piece of data?
I have never done this, so I’m curious if others actually use EE this way and not just for basic websites, but database content related to each account or user. Sure I could use a module here, add-ons and more, but eventually I will need unique data per member.
Ideas are appreciated.
If I understand correctly you basically want to connect a channel entry to a member so that you can have all kinds of custom fields associated with that member. If that’s correct then, yes there have been instances of this in the wild. However, to accomplish this you’ll need to write the add-on that connects the actual member with their respective channel entry. If you want to see that in action EE Harbor’s Visitor Add-on does a great job of that.
In my mind, the benefit is the same as most reasons for developers to use a CMS or a framework. You get a wealth of classes, methods, objects to extend and use out of the gate that have hopefully been refined over time for performance, security, and better functionality. You don’t have to re-invent the wheel. You also won’t be able to take advantage of other add-ons that might extend what you’re doing with members.
Aside from those reasons, I don’t think there’s any harm in doing it separate from EE’s tables. If you want to roll your own and do stuff that just isn’t possible in EE, then you could certainly do that.