gde_profile_name_exists

Check for duplicate profile name.

Description

(int) gde_profile_name_exists( (string) $name ); 

Returns (int)

Profile id of name or -1 if no match

Parameters (1)

0. $name (string)
The name.

Usage

  1. if ( !function_exists( 'gde_profile_name_exists' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'google-doc-embedder/functions-admin.php'; 
  3.  
  4. // The name. 
  5. $name = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = gde_profile_name_exists($name); 
  9.  

Defined (1)

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

/functions-admin.php  
  1. function gde_profile_name_exists( $name ) { 
  2. global $wpdb; 
  3. $table = $wpdb->prefix . 'gde_profiles'; 
  4.  
  5. if ( $id = $wpdb->get_row( $wpdb->prepare( "SELECT profile_id FROM $table WHERE profile_name = %s", $name ), ARRAY_A ) ) { 
  6. return (int) $id['profile_id']; 
  7. } else { 
  8. return -1;