Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined class constant 'STATUS_INACTIVE' #179

Open
larry-tx opened this issue Dec 27, 2016 · 13 comments
Open

Undefined class constant 'STATUS_INACTIVE' #179

larry-tx opened this issue Dec 27, 2016 · 13 comments

Comments

@larry-tx
Copy link

I just installed your module and attempted to log in with the neo/neo credentials. It returned a Fatal PHP error: Undefined class constant 'STATUS_INACTIVE'. See attached image of the complete error message.
status_inactive

I could probably figure out how to make it work, but I thought you might want to fix it so someone else doesn't run into the same error. If I've done anything wrong, please don't hesitate to let me know.

@larry-tx
Copy link
Author

Actually, it gets worse. When I try to go to /user/admin or /use/account, I get an Object not found message:
image

My common/config/main.php looks like this:

<?php

    use kartik\datecontrol\Module;

    return [
        'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',
        'components' => [
            'user'  => [
                'class' => 'amnah\yii2\user\components\User',
            ],
            'cache' => [
                'class' => 'yii\caching\FileCache',
            ],
        ],
        'modules'    => [
            'user'        => [
                'class' => 'amnah\yii2\user\Module',
                // set custom module properties here ...
            ],
            'datecontrol' => [
                'class'              => 'kartik\datecontrol\Module',

                // format settings for displaying each date attribute (ICU format example)
                'displaySettings'    => [
                    Module::FORMAT_DATE     => 'php:m/d/Y',
                    Module::FORMAT_TIME     => 'php:h:i A',

As you can see, I haven't tried to do anything other than simply copy your directions. Any help you can give on this would be most appreciated.

@amnah
Copy link
Owner

amnah commented Dec 27, 2016

Did you update the configuration for the frontend and the backend? These two config files will overwrite what you have in the common config.

Edit: wrong

@amnah
Copy link
Owner

amnah commented Dec 27, 2016

Woops I think that previous comment is wrong. What you probably need to do is update the common/models/User.php file completely.

It would need to extend my User class, like so:

<?php

namespace common\models;

use Yii;
use amnah\yii2\user\models\User as BaseUser;

class User extends BaseUser
{
}

@larry-tx
Copy link
Author

larry-tx commented Dec 27, 2016 via email

@amnah
Copy link
Owner

amnah commented Dec 27, 2016

Wait, how did you log in the first time - what was the url?

Did you set up pretty urls?

@larry-tx
Copy link
Author

larry-tx commented Dec 27, 2016 via email

@amnah
Copy link
Owner

amnah commented Dec 27, 2016

i dont think your pretty urls is working. did you set up pretty urls properly?

http://www.yiiframework.com/doc-2.0/guide-start-installation.html#recommended-apache-configuration

your error is an apache error, it's not even getting into php yet so it has nothing to do with yii2 or my module

@larry-tx
Copy link
Author

larry-tx commented Dec 27, 2016 via email

@amnah
Copy link
Owner

amnah commented Dec 27, 2016

Hmmm ok that's weird then. Ok, assuming that your pretty urls are working, let's take a step back.

Did you update your nav links to point to the new urls?

It should look something like this

$menuItems[] = ['label' => 'Signup', 'url' => ['/user/register']];
$menuItems[] = ['label' => 'Login', 'url' => ['/user/login']];

After that's done, go to your site and check the urls. What's the exact url that it generated? Copy/paste that here please.

Then click the link and try to go to the page. Does the page load successfully?

@larry-tx
Copy link
Author

larry-tx commented Dec 27, 2016 via email

@parvvee
Copy link

parvvee commented May 13, 2018

@Larrytx fix for the issue in yii2-advanced is in your config/main.php you need to remove "user" array item from component from backend / frontend and you shall have this workling.Thank you

@mydesign
Copy link

User's module may be connected on /common
comment it in backend and frontend

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants
@larry-tx @mydesign @amnah @parvvee and others