Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

247
Visualizações
Prevent new WordPress users from logging in until manually "activated"?

I'm developing a plugin for WordPress which has 3 groups of users. I need to disable some users and prevent them from login. what I mean isn't preventing them to access the backend. I want to prevent them from is log in. For example, when they want to login they should see a message like this account isn't active yet. thank you guys.

about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

after some search and see similar problems I solved this problam like this : first add a user meta for user status so we can checking if user is active or not then we can disable or enable users.

add_filter( 'authenticate', 'chk_active_user',100,2);
function chk_active_user ($user,$username) 
   {
     $user_data = $user->data;
     $user_id = $user_data->ID;
     $user_sts = get_user_meta($user_id,"user_active_status",true);
     if ($user_sts==="no")
     {
        return new WP_Error( 'disabled_account','this account is disabled');

      }
      else
      {
       return $user;
      }
        return $user;
     }
about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda