Jump to content

Debug mode only for admins


Chill_user
 Share

Recommended Posts

Hello, 

Is it possible to create next rule: debug mode is switched on only for the admin users or customers.id?

I know that 

define('_PS_MODE_DEV_', false);

is configuration table and "false" or "true" is boolean values stored globally. 

My isssue about prestashop 1.7: I have some modules installed shows "dump" info only in debug mode; If debug = false, I have white page. 

I can't export it to the custom project because these are payment modules or something like this, so I need to debug online.

Example: saferpay module.

Any solutions, please?

Share this post


Link to post
Share on other sites

Instead for the admin only, You can enable the same for particular IP.  Update your IP in the below code to enable to debug for specific IP only.

if (!defined('_PS_MODE_DEV_')) {
if ($_SERVER["REMOTE_ADDR"] == '{YOUR-IP}') {
    define('_PS_MODE_DEV_', true);
} else {
    define('_PS_MODE_DEV_', false);
}

Share this post


Link to post
Share on other sites

1 hour ago, Knowband Plugins said:

Instead for the admin only, You can enable the same for particular IP.  Update your IP in the below code to enable to debug for specific IP only.

if (!defined('_PS_MODE_DEV_')) {
if ($_SERVER["REMOTE_ADDR"] == '{YOUR-IP}') {
    define('_PS_MODE_DEV_', true);
} else {
    define('_PS_MODE_DEV_', false);
}

just a question: remote_addr - what is this?

Thanks a lot for your help!

 

Share this post


Link to post
Share on other sites

15 hours ago, Knowband Plugins said:

$_SERVER["REMOTE_ADDR"] is find your current IP using the PHP.

Search in google for your current IP OR VISIT https://whatismyipaddress.com/

if (!defined('_PS_MODE_DEV_')) {
if ($_SERVER["REMOTE_ADDR"] == '45.33.33.211') {
    define('_PS_MODE_DEV_', true);
} else {
    define('_PS_MODE_DEV_', false);
}

 

Thanks a lot!

Share this post


Link to post
Share on other sites

  • 4 months later...

Thanks Knowband Plugins,

but due an error. .... lost the last }

The correct code :

if (!defined('_PS_MODE_DEV_')) {
    if ($_SERVER["REMOTE_ADDR"] == 'PUT HERE YOUR IP') {
       define('_PS_MODE_DEV_', true);
    } else {
       define('_PS_MODE_DEV_', false);
    }
}

 

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More