• Resolved rpone

    (@rpone)


    Hello,
    i have added some filters for my personal project:
    FILE: CLASS.TWO-FACTOR-CORE.PHP > FUNCTION get_enabled_providers_for_user
    after this line:
    $enabled_providers = array_intersect( $enabled_providers, array_keys( $providers ) );
    i have added this:
    $enabled_providers = apply_filters( 'two_factor_enabled_providers_for_user', $enabled_providers, $user );

    FILE: CLASS.TWO-FACTOR-CORE.PHP > FUNCTION get_primary_provider_for_user
    after this line:
    $available_providers = self::get_available_providers_for_user( get_userdata( $user_id ) );
    i have added this:
    $available_providers = apply_filters( 'two_factor_available_providers_for_user', $available_providers, $user_id );

    FILE: PROVIDERS/CLASS.TWO-FACTOR-TOTP.PHP > FUNCTION is_available_for_user
    after this line:
    $key = $this->get_user_totp_key( $user->ID );
    i have added this:
    return apply_filters( 'two_factor_is_available_for_user', !empty($key), $user );

    With these filters it was more easy for me to customize the login system because i had to add a filter based on user IP / Roles that bypass the TwoFactor System.

    Maybe these filter can be useful to other people if you add them to your plugin ??

    • This topic was modified 4 years, 11 months ago by rpone.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Filters suggestion’ is closed to new replies.