Extending yii-user module (or any module)

What I’m wanting to do is extend the yii-user module to include the ability for LDAP authentication using the adLDAP library. I have already created this functionality with PHP’s built-in LDAP functions simply by directly editing the yii-user module, but I think this is really poor practice.

I’m wondering, is the best way to somehow extend the entire yii-user module and just override the applicable controllers, or can I gracefully extend the specific controllers within the module somehow? Or should I be creating a module with the yii-user module as a sub-module?

I searched around and found similar threads with no responses. I suspect there are more people wanting to know about extending modules out there.

Past threads on this topic:




Any thoughts on this? Has anyone ever extended a module?

I’ve wondered about the same thing. Not enough to actually do anything about it though. :) If a module is written so that classes for particular functionality are configurable (e.g. ‘payprovider’=>array (class=>‘application.components.MyCustom’) ), then it’s pretty easy. A module design would have a core set of functionality and then everything else provided as a configuration array to make it easy to extend. What constitutes “core” would still be a judgement call. Anyway, that’s the dream world.

A couple of wild thoughts:

  1. If it is possible to route calls intended for the original controllers to your extended controllers (possible through custom urlmanager?), you could leave the original module code untouched. I have no clue if this is even possible or wise.

  2. There is a getParentModule() call which suggests that a submodule can reference its parent code. I don’t know if that is enough to do what you need or again if it is even wise or worth the effort.

Good luck.