Skip Navigation

[Closed] Undefined Constant

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 1 reply, has 2 voices.

Last updated by Waqar 1 year, 4 months ago.

Assisted by: Waqar.

Author
Posts
#2504111

I am trying to: Save a user profile in the back-end.

Link to a page where the issue can be seen:

I expected to see: save confirmation message

Instead, I got: an error message in the debug log, see below

----
PHP Fatal error: Uncaught Error: Undefined constant "OTGS\Toolset\Access\Controllers\Filters\IS_PROFILE_PAGE" in /public/wp-content/plugins/types-access/application/controllers/filters/backend_filters.php:271
----

Using undefined constants is now a fatal error since PHP8.

The problematic line is:
if ( ! IS_PROFILE_PAGE && ! is_network_admin() && current_user_can( 'promote_user', $user_id ) ) {

elsewhere in the code existence of the constant is checked before using such as here:

if ( defined( 'IS_PROFILE_PAGE' )
&& ! IS_PROFILE_PAGE
&& ! is_network_admin()
&& current_user_can( 'promote_user', $profileuser->ID )
) {

#2505307

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting us and I'd be happy to assist.

While it does seem like a good practice to include a 'defined' check for a constant, I couldn't reproduce this error on my test website, with PHP8 and the Access plugin.

To report this, I'll need to know the exact steps to reproduce this error. Are you using any third-party plugin or custom code to change the user roles or user profile functionality in the admin area?

regards,
Waqar

The topic ‘[Closed] Undefined Constant’ is closed to new replies.