Search code examples
phpcodeignitertankauthprivate-messaging

Private messages between users in CodeIgniter


I am using Tank auth library for handling sites registration. I chose it over other options at the beginning of site building because it looked well documented and easy to use.

I need to add private messages between users. However, there is not such a functionality implemented in library.

I found CodeIgniter-Aauth library that has private messages build in. So now I see three options:

  1. Add functionality to Tank auth by myself
  2. Copy and adjust code from Aauth library into Tank auth
  3. Switch from Tank auth to Aauth

I have my website build on Tank auth so I rather avoided the last option. I have spent a couple of hour on working on every single option listed with some minor success. But it feel like I am working in million directions while actually not moving forward. I simply do not have the knowledge to decide on best course of action and the uncertainty holds me back.

So I would really appreciate if someone more experienced then myself could guide my to right direction on how to best handle private messages on my site.


Solution

  • Personally, I like to keep my libraries and models 'pure' in that they do a single task. It seems to me that authorization is one task, authentication is another (I know these are usually combined as you cannot do one without the other) and private messaging is quite a separate task. I have no idea why anyone would bundle those into the same library.

    So I would definitely write a whole new library for private messaging between users. In that way it will work the way you want it to work, not how some half-baked generalized authentication library has decided to implement it as a bonus feature.

    Edit: Just to be clear, you should pick your authentication library based on how well it does authentication, not any bonus features. You have done that so don't go back over that again, just because of additional functionality you want to add.