Sauter la navigation

[Résolu] Error debugging

This support ticket is created Il y a 3 années et 4 mois. 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)

Ce sujet contient 14 réponses, a 3 voix.

Dernière mise à jour par jesusM-6 Il y a 3 années et 4 mois.

Assisté par: Shane.

Auteur
Publications
#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

Les langues: Anglais (English )

Fuseau horaire: 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

Les langues: Anglais (English )

Fuseau horaire: 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

Les langues: Anglais (English )

Fuseau horaire: 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

lien caché

form url:
lien caché

#2145691

lien caché

form url:
lien caché

#2145777

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: 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:
lien caché

#2145853

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: 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:
lien caché

admin url:
lien caché

#2145941

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: 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

Les langues: Anglais (English )

Fuseau horaire: 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!