Skip Navigation

[Resuelto] How do I capture the user submitting a Toolset form?

Este hilo está resuelto. Aquí tiene una descripción del problema y la solución.

Problem:

How do I capture the username for the user that is submitting a form?

Solution:

If you are going to capture the username with PHP codes, you can try Form API action hook "cred_save_data":

https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data

The first argument is user's ID, then use user's ID to get username, for example:

https://toolset.com/forums/topic/how-do-i-capture-the-user-submitting-a-toolset-form/#post-1280569

Relevant Documentation:

This support ticket is created hace 5 años, 5 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.

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

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/Hong_Kong (GMT+08:00)

Etiquetado: ,

Este tema contiene 5 respuestas, tiene 2 mensajes.

Última actualización por Gerard hace 5 años, 5 meses.

Asistido por: Luo Yang.

Autor
Mensajes
#1280509

How do I capture the username for the user that is submitting a form?

#1280515

Having a chat about it on the facebook group at enlace oculto

#1280569

Hello,

Please elaborate the question with more details.
How do you setup the user form? is it a creating new user form? are you using option "Auto-generate Username"?
How and where do you want to capture the username?

If you are going to capture the username with PHP codes, you can try Form API action hook "cred_save_data":
https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data

The first argument is user's ID, then use user's ID to get username, for example:

add_action('cred_save_data', 'my_save_data_action',10,2);
function my_save_data_action($user_id, $form_data)
{
    // if a specific form
    if ($form_data['id']==123)
    {
        $user_obj = get_user_by('id', $user_id);
        $user_name = $user_obj->user_login;
    }
}

More help:
https://developer.wordpress.org/reference/functions/get_user_by/

#1282385

Hi,

Thank you, that seems very useful..

Let me share some more details, and maybe you can recommend the best way to go about things.

What I'm building is a site to manage the data on people who have received grants..
- There will be a profile for each grantee
- They will have logins to regularly come in and put in a status report
- The profile and accounts will be created by the website managers
- These status reports will display on their profile in a section, using Views probably.

I'm trying to figure out the best way to keep these all linked together properly.

I hope this makes more sense?

Los hilos nuevos creados por Luo Yang y vinculados a este se encuentran a continuación:

https://toolset.com/es/forums/topic/recommend-the-best-way-to-go-about-things/

#1282479

I assume the original question of this thread is resolved, for other new questions, please check the new thread here:
https://toolset.com/forums/topic/recommend-the-best-way-to-go-about-things/

#1282483

My issue is resolved now. Thank you!