Añadir usuario a grupo mediante webhook con correo electrónico

If I’m understanding you correctly, you’re doing this

  1. Using DiscourseConnect with Wordpress as the provider and Discourse as the client.
  2. Using a Webhook in Wordpress to put users in groups in Discourse (.e. PUT to /g/:group_name/members (api ref)) as a result of a form action.

if that’s right you can find the Discourse username in Wordpress in the discourse_username user meta field, so

get_user_meta($user_id, 'discourse_username', true);

Use that to get the username to use in the PUT request following the form action.

You can ensure that discourse_username is filled for your users using the user webhooks in the WP Discourse plugin (note we’re talking about different webhooks from the ones you’re currently using in your form).

2 Me gusta