Advertisement
verygoodplugins

Untitled

Feb 24th, 2025 (edited)
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.71 KB | None | 0 0
  1. <?php
  2.  
  3. function restrict_aga_cd_test_login($user, $username, $password) {
  4.  
  5.     if ( is_wp_error( $user ) ) {
  6.         return $user;
  7.     }
  8.  
  9.     if ( ! function_exists( 'wpf_has_tag' ) ) {
  10.         return new WP_Error( 'error', __( 'WP Fusion does not exist.' ) );
  11.     }
  12.  
  13.     if ( ! wpf_get_contact_id( $user->ID ) ) {
  14.         return new WP_Error( 'authentication_failed', __( 'No Dynamics contact record for the user.' ) );
  15.     }
  16.  
  17.     if ( ! wpf_has_tag( 'Aga CD Test', $user->ID ) ) {
  18.         return new WP_Error( 'authentication_failed', __( 'Your account is restricted. Please contact support.' ) );
  19.     }
  20.  
  21.     return $user;
  22. }
  23.  
  24. add_filter( 'wp_authenticate_user', 'restrict_aga_cd_test_login', 10, 3 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement