gde_get_profiles
Get profile data.
Description
(array) gde_get_profiles( (string) $ident = '', (constant) $include_id = true, (bool) $include_desc = false );
Returns (array)
Array of profiles with their data, or a specific profile
Parameters (3)
- 0. $ident — Optional. (string) =>
''
- The ident.
- 1. $include_id — Optional. (constant) =>
true
- The include id.
- 2. $include_desc — Optional. (bool) =>
false
- The include desc.
Usage
if ( !function_exists( 'gde_get_profiles' ) ) { require_once ABSPATH . PLUGINDIR . 'google-doc-embedder/functions.php'; } // The ident. $ident = ''; // The include id. $include_id = true; // The include desc. $include_desc = false; // NOTICE! Understand what this does before running. $result = gde_get_profiles($ident, $include_id, $include_desc);
Defined (1)
The function is defined in the following location(s).
- /functions.php
- function gde_get_profiles( $ident = '', $include_id = true, $include_desc = false ) {
- global $wpdb;
- $table = $wpdb->prefix . 'gde_profiles';
- if ( empty( $ident ) ) {
- $where = "WHERE 1 = 1 ORDER BY profile_id ASC";
- } elseif ( ! is_numeric( $ident ) ) {
- $where = "WHERE profile_name = '$ident'";
- } else {
- $where = "WHERE profile_id = $ident";
- }
- $profiles = $wpdb->get_results( "SELECT * FROM $table $where", ARRAY_A );
- if ( ! is_array( $profiles ) ) {
- gde_dx_log("Requested profile $ident not found");
- return false;
- } elseif ( ! empty( $ident ) ) {
- // return specific profile data
- if ( isset( $profiles[0] ) ) {
- $data = unserialize($profiles[0]['profile_data']);
- if ( $include_id ) {
- $data['profile_id'] = $profiles[0]['profile_id'];
- }
- if ( $include_desc ) {
- $data['profile_desc'] = $profiles[0]['profile_desc'];
- }
- $profiles = $data;
- } else {
- gde_dx_log("Requested profile $ident doesn't exist");
- return false;
- }
- }
- return $profiles;
- }