bp_groupblog_sanitize_blog_name

Sanitizes a group name into a blog address, based on site settings.

Description

bp_groupblog_sanitize_blog_name( (string) $group_name = '' ); 

Parameters (1)

0. $group_name — Optional. (string) => ''
The group name.

Usage

  1. if ( !function_exists( 'bp_groupblog_sanitize_blog_name' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bp-groupblog/bp-groupblog.php'; 
  3.  
  4. // The group name. 
  5. $group_name = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bp_groupblog_sanitize_blog_name($group_name); 
  9.  

Defined (1)

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

/bp-groupblog.php  
  1. function bp_groupblog_sanitize_blog_name( $group_name = '' ) { 
  2. $checks = get_site_option('bp_groupblog_blog_defaults_options'); 
  3.  
  4. $baddies = array (); 
  5. if ( $checks['allowdashes'] != '1' ) 
  6. $baddies[] = '-'; 
  7. if ( $checks['allowunderscores'] != '1' ) 
  8. $baddies[] = '_'; 
  9.  
  10. $blog_address = str_replace ( $baddies, '', $group_name ); 
  11.  
  12. return $blog_address;