Skip Navigation

[Gelöst] Al crear un registro de usuario que tambien se cree una entrada

This support ticket is created vor 2 Jahre, 7 Monate. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+01:00)

This topic contains 4 Antworten, has 2 Stimmen.

Last updated by Rafael Corts vor 2 Jahre, 7 Monate.

Assisted by: Nigel.

Author
Artikel
#2158229

Hola Nigel, como puedo hacer una vez el usuario se registra en el portal, se cree una entrada con su nombre de usuario ?
Tengo una entrada con el nombre de "usuarios" y una vez el usuario se registra al portal, con la funcion "Cread_save_data" quiero que se cree a la vez.
tengo este codigo:

add_action( 'cred_save_data', 'tssupp_author_term', 10, 2 );
function tssupp_author_term( $post_id, $form_data ){
  
    if ( in_array( $form_data['id'], array( 4427 ) ) ) {   // el numero 4427 es el ID del formulario para el registro del usuario
        
        $post = get_post( $post_id );
        $author_id = $post->post_author;   
        $author = get_the_author_meta( 'display_name', $author_id );
 
        wp_set_object_terms( $post_id, $author );
     }
}  

Pero no se donde indicar el nombre de la entrada "usuarios"
Haber si me puedes indicar como hacelo.
Saludos.
Rafa Corts

#2158487

Nigel
Supporter

Languages: Englisch (English ) Spanisch (Español )

Timezone: Europe/London (GMT+01:00)

A ver si te entiendo...

Al registrar con un formulario CRED, quieres que se crea automáticamente una entrada de perfíl (tipo "usuario"), y que el título de la entrada es el nombre del usuario, ¿correcto?

#2158531

Hola Nigel, si es correcto lo que dices, entonces con esto puedo tener una URL personalizada de cada usuario y en la plantilla poner un iframe de un streaming, entonces podre obtener la información de cada alumno del tiempo que ha estado conectado en su pagina.
Saludos.
Rafa Corts

#2159339

Nigel
Supporter

Languages: Englisch (English ) Spanisch (Español )

Timezone: Europe/London (GMT+01:00)

Entonces lo que necesitas es algo así:

/**
 * Automatically create profile post after registering user
 */
add_action('cred_save_data', 'ts_create_profile', 10, 2);
function ts_create_profile($post_id, $form_data)
{
    if (in_array($form_data['id'], array( 123 ))) { // Edit register user form ID

        if ( isset( $_POST['user_email'] ) ) {

            $user = get_user_by( 'email', $_POST['user_email'] );

            $args = array(
                'post_title' => $user->display_name,
                'post_author' => $user->ID,
                'post_status' => 'publish',
                'post_type' => 'usuario' // Edit post type slug
            );
            wp_insert_post( $args );
        } 
    }
}

Sea necesario editar el ID del formulario, y confirmar que el slug del tipo de entrada es correcto.

#2161807

Muchas gracias Nigel.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.