• Resolved pao2

    (@pao2)


    I’m using flush_rewrite_rules() after every new user registration and deletion on the user_register and deleted_user hooks at the latest possible priority with no problem.

    However when using Social registration, it seems these hooks aren’t being called. Are there special hooks to use with the social registration and deletion flows (and possibly for unlinking email also)?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Laszlo

    (@laszloszalvak)

    Hi @pao2

    As for the registration:
    By default Nextend Social Login registers the users with the wp_insert_user() function, which fires the “user_register” action at one point meaning that your hooked functions should run when your register with Nextend Social Login, too.

    I have just checked it with a basic code like this:

    add_action('user_register', function ($id, $data) {
        echo "reg:" . $id;
        exit;
    }, 10, 2);

    And when I registered with social login it wrote out the $id just fine, meaning that we got to this point. If it still doesn’t work for you, then maybe you have your hooks hooked into another hook, that is specific for your register flow only, so when the “user_register” action is fired outside of that flow, then your codes won’t run.

    Anyways we also have our own action that we fire when a new user is registered with social login:

    • nsl_register_new_user

    In our developer documentation you can learn more about it and you can also find examples for the usage if you search for this action in the developer documentation:

    As for the user deletion:
    The user deletion is not handled by Nextend Social Login at all, but by WordPress ( just when you delete a WordPress account in WordPress, we will also delete the stored social media data automatically ). I have just deleted an account ( registered with Social Login ) in the WordPress default users table, while this code was added:

    add_action('deleted_user', function ($id, $reassign, $user) {
        echo "del:" . $id;
        exit;
    }, 10, 3);

    and it worked fine.

    You should check if you even get to the point where your hooked functions get executed. ( It is a common problem that if you have other codes hooked to an action and it triggers a redirect then the remaining functions ( which were hooked to that particular action ) won’t be executed. )

    As for the unlinking:
    We have an unlink specific action:

    • nsl_unlink_user

    that is fired when a user unlinks a social media account from a WordPress account. In the Developer documentation you can find this action, too.

    Best regards,
    Laszlo.

    Thread Starter pao2

    (@pao2)

    Thank you, turns out i have to lower the priority before it takes effect.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Trying to flush rewrite after user registration’ is closed to new replies.