I'm building a system which should have two parts CMS using craft cms 2.6.x. and Yii2 for logical modules and administration. I want to login to CMS directly once the user has logged into yii2 system. How can I do that? I can pass uid which in craft_user table. I need to build an API function but where shall I start? Plus is this a good practice or there is something else I can do.


1 Answer 1


You are going to have a hard time if you want to use Yii2 with Craft 2 since they are totally incompatible. Craft 2 uses yii and Craft 3 uses Yii2. You can't mix them. Furthermore you'll need multiple custom changes when you want to drop the native Craft user registration and replace it with Yii2 (less powerful) user registration. (what's wrong about Crafts one?)

Do you have certain reasons why you are not going to use existing ways? I can't think of a "fast and easy" way to achieve your goal, especially if you are new to Craft because it's a lot of work to drop existing login/registration mechanisms.

Here is an example how to register users with Craft methods https://docs.craftcms.com/v3/templating/examples/user-registration-form.html you can include the permission to give them CP access and redirect them there

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.