bp_core_current_user_ip

Get the current user's IP address.

Description

(string) bp_core_current_user_ip(); 

Returns (string)

IP address.


Usage

  1. if ( !function_exists( 'bp_core_current_user_ip' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-core/bp-core-moderation.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bp_core_current_user_ip(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/bp-core/bp-core-moderation.php  
  1. function bp_core_current_user_ip() { 
  2. $retval = preg_replace( '/[^0-9a-fA-F:., ]/', '', $_SERVER['REMOTE_ADDR'] ); 
  3.  
  4. /** 
  5. * Filters the current user's IP address. 
  6. * @since 1.6.0 
  7. * @param string $retval Current user's IP Address. 
  8. */