Plugin error: add_user and remove_user not working

Hi, whenever I call the 2 functions, add_user_to_discourse_group and remove_user_from_discourse_group :

$user = get_user_by('id', $data["member_id"]);
error_log("Call add_user_to_discourse");
$result = DiscourseUtilities::add_user_to_discourse_group($user->ID, $discourse_group);
error_log(print_r($result, true));

I get these error messages :

[02-May-2020 17:32:23 UTC] Call remove_user_from_discourse_group
[02-May-2020 17:32:24 UTC] WP_Error Object

(
    [errors] => Array
        (
            [wpdc_response_error] => Array
                (
                    [0] => An error was returned from Discourse while trying to sync the sso record.
                )

        )

    [error_data] => Array
        (
        )

)

Could you help me please ? :slight_smile:

1 Like

It seems likely that this is an authentication error. On the WP Discourse Connection Options tab, make sure that you are using an All Users Discourse API Key and your site’s system user for the Publishing Username (this defaults to system.)

2 Likes

Thank you Simon, it worked perfectly !

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.