bb_match_domains

The BuddyPress bb match domains function.

Description

bb_match_domains( (constant) $domain1 = false, (constant) $domain2 = false ); 

Parameters (2)

0. $domain1 — Optional. (constant) => false
The domain1.
1. $domain2 — Optional. (constant) => false
The domain2.

Usage

  1. if ( !function_exists( 'bb_match_domains' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-includes/functions.bb-core.php'; 
  3.  
  4. // The domain1. 
  5. $domain1 = false; 
  6.  
  7. // The domain2. 
  8. $domain2 = false; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = bb_match_domains($domain1, $domain2); 
  12.  

Defined (1)

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

/bp-forums/bbpress/bb-includes/functions.bb-core.php  
  1. function bb_match_domains($domain1 = false, $domain2 = false) { 
  2. if (!$domain1 || !$domain2) { 
  3. return false; 
  4.  
  5. $domain1 = strtolower( preg_replace( '@^https?://([^/]+).*$@i', '$1', $domain1 ) ); 
  6. $domain2 = strtolower( preg_replace( '@^https?://([^/]+).*$@i', '$1', $domain2 ) ); 
  7.  
  8. if ( (string) $domain1 === (string) $domain2 ) { 
  9. return true; 
  10.  
  11. return false;