Title: Block user with a script
Last modified: April 9, 2023

---

# Block user with a script

 *  Resolved [gingerbooch](https://wordpress.org/support/users/gingerbooch/)
 * (@gingerbooch)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/block-users-using-a-script/)
 * Hi [@gioni](https://wordpress.org/support/users/gioni/),
 * I need to use the function “cerber_block_user()” within a script.
   For this purpose,
   I use the “require_once()” function to call “cerber-users.php”.
 * Is it right or is there a safer way to call the “cerber_block_user()” function
   please ?
    -  This topic was modified 3 years, 1 month ago by [gingerbooch](https://wordpress.org/support/users/gingerbooch/).
      Reason: Unable to delete the topic
    -  This topic was modified 3 years, 1 month ago by [gingerbooch](https://wordpress.org/support/users/gingerbooch/).
      Reason: Remaining question

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [gioni](https://wordpress.org/support/users/gioni/)
 * (@gioni)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/block-users-using-a-script/#post-16632066)
 * That is the correct way. At the same time, the recommended, in terms of compatibility
   with features releases of WP Cerber, way is:
 *     ```wp-block-code
       include_once( 'set here your plugins directory path' . '/wp-cerber/cerber-load.php' );
   
       if ( function_exists( 'cerber_load_admin_code' ) ) {
       	cerber_load_admin_code();
       	cerber_block_user( $user_id, $msg, $note );
       }
   
       /*
   
       Parameters are:
   
       $user_id = User ID
       $msg = An optional message to be displayed on the login page when the user tries to log in
       $note = An optional note visible to website admins
   
       */
       ```
   
 *  Thread Starter [gingerbooch](https://wordpress.org/support/users/gingerbooch/)
 * (@gingerbooch)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/block-users-using-a-script/#post-16632666)
 * Many thanks for your answer 👍
 * Have a nice day,
 * GB

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Block user with a script’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-cerber_77a9bf.svg)
 * [WP Cerber Security, Anti-spam & Malware Scan](https://wordpress.org/plugins/wp-cerber/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-cerber/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-cerber/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-cerber/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-cerber/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-cerber/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [gingerbooch](https://wordpress.org/support/users/gingerbooch/)
 * Last activity: [3 years, 1 month ago](https://wordpress.org/support/topic/block-users-using-a-script/#post-16632666)
 * Status: resolved