Saltar navegación

[Resuelto] Error debugging

This support ticket is created hace 3 años, 4 meses. There's a good chance that you are reading advice that it now obsolete.

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 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Este tema contiene 14 respuestas, tiene 3 mensajes.

Última actualización por jesusM-6 hace 3 años, 4 meses.

Asistido por: Shane.

Autor
Mensajes
#2145645

Hello,

I have activated debug mode in wp-config:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );

I am trying to debug this snippet when submiting a form:

<?php
toolset_snippet_security_check() or die( 'Direct access is not allowed' );
add_action('cred_before_save_data', 'tj_set_seccion_sugerencia');
function tj_set_seccion_sugerencia ($form_data) {
error_log( ' Outside if ------------' );
if ($form_data['id']==1684){
error_log( 'Insidel if ------------' );
error_log( print_r( $_POST, true));
}
}

I submit the form whit id=1684. Then I open debug.log:

[18-Aug-2021 10:53:12 UTC] PHP Notice: Trying to get property 'base' of non-object in /home/giowvmpi/public_html/wp-content/plugins/folders/includes/folders.class.php on line 2819
[18-Aug-2021 10:53:31 UTC] PHP Notice: Trying to get property 'base' of non-object in /home/giowvmpi/public_html/wp-content/plugins/folders/includes/folders.class.php on line 2819

Debug log doesn't display any info about my snippet error_log

#2145653

Minesh
Supporter

Idiomas: Inglés (English )

Zona horaria: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

I see with the code snippet you added you did not set the hook priority. Can you please try to use the following code and see if that helps:

add_action('cred_before_save_data', 'tj_set_seccion_sugerencia',10,1);
function tj_set_seccion_sugerencia ($form_data) {
error_log( ' Outside if ------------' );
if ($form_data['id']==1684){
error_log( 'Insidel if ------------' );
error_log( print_r( $_POST, true));
}
}

More info:
- https://toolset.com/documentation/programmer-reference/cred-api/#cred_before_save_data

#2145655

This doesn't work, the same thing keeps happening

#2145657

Minesh
Supporter

Idiomas: Inglés (English )

Zona horaria: Asia/Kolkata (GMT+05:30)

That is strange. Can you please share problem URL where you added the form as well as admin access details.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2145675

Minesh
Supporter

Idiomas: Inglés (English )

Zona horaria: Asia/Kolkata (GMT+05:30)

When I try to access the wp-admin link you shared I get the following message:

¡Detectada petición de login incorrecta!

Do you have any firewall setup? Also, it seems you forget to send me problem URL where you added the form.

I have set the next reply to private which means only you and I have access to it.

#2145677

enlace oculto

form url:
enlace oculto

#2145691

enlace oculto

form url:
enlace oculto

#2145777

Minesh
Supporter

Idiomas: Inglés (English )

Zona horaria: Asia/Kolkata (GMT+05:30)

When I try to access the wp-admin link you shared I get the following message and I could not access the wp-admin:
- Detectada petición de login incorrecta!

Do you have any firewall setup?

#2145781

I haven't firewall... Can you try:
enlace oculto

#2145853

Shane
Supporter

Idiomas: Inglés (English )

Zona horaria: America/Jamaica (GMT-05:00)

Hi Jesus,

Minesh had passed this ticket to me since i'm able to access the login page.

I checked on the credentials that were sent in the private field but was unable to login due to incorrect details.

Can you check them on your end and let me know if they work for you.

Thanks,
Shane

#2145915

This is the form url:
enlace oculto

admin url:
enlace oculto

#2145941

Shane
Supporter

Idiomas: Inglés (English )

Zona horaria: America/Jamaica (GMT-05:00)

Hi Jesus,

This should now be working. The problem was there seemed to be an error in your code that prevented it from being activated.

Now the snippet has been activated and your debug log now shows the information from the code snippet.

Thanks,
Shane

#2145947

Thanks Shane. It´s working right now.

But I would like to know what the error was previously and what you have modified to make it work

#2145997

Shane
Supporter

Idiomas: Inglés (English )

Zona horaria: America/Jamaica (GMT-05:00)

Hi Jesus,

When you try to activate a snippet of code it usually does a check to see if the code syntax is correct.

Checking I found that it was reporting a syntax error regarding an unexpected "{" on line 12.

All I did was just went in and made the correction.

Thanks,
Shane

#2146123

My issue is resolved now. Thank you!