return $queryParts;
});
+/**
+ * Filter for returning the memberDb custom fields.
+ *
+ * This can be given UID for members or contacts.
+ *
+ * @param $content Should be false
+ * @param $uid glm-member-db or glm-member-db-contacts
+ *
+ * @return Array of the id,field_name for custom fields that are for UID.
+ */
+add_filter(
+ 'glm-member-db-fields-get-members-fields',
+ function( $content, $uid ){
+ $fields = $this->wpdb->get_results(
+ $this->wpdb->prepare(
+ "SELECT id,field_name
+ FROM " . GLM_MEMBERS_FIELDS_PLUGIN_DB_PREFIX . "custom_fields
+ WHERE uid = %s",
+ $uid
+ ),
+ ARRAY_A
+ );
+ return $fields;
+ },
+ 10,
+ 2
+);
+
/**
* Save the data for the Member Info Custom Fields
* Returns true if successful
1,
2
);
+
+add_filter(
+ 'glm_custom_fields_by_entity_id',
+ function( $attribute, $id = 0 ) {
+ global $wpdb;
+ $query = "SELECT D.field_data, F.field_type FROM " . GLM_MEMBERS_FIELDS_PLUGIN_DB_PREFIX . "custom_field_data D, " . GLM_MEMBERS_FIELDS_PLUGIN_DB_PREFIX . "custom_fields F "
+ . "WHERE D.entity_id = $id "
+ . "AND D.field_id IN (SELECT id FROM " . GLM_MEMBERS_FIELDS_PLUGIN_DB_PREFIX . "custom_fields WHERE field_name LIKE '$attribute' ) "
+ . "AND F.field_name LIKE '$attribute'";
+
+ $result = $this->wpdb->get_row( $query, ARRAY_A );
+ if ( $result['field_type'] == 'textarea' ) {
+ $result['field_data'] = wpautop( $result['field_data'] );
+ }
+ return $result['field_data'];
+ },
+ 10,
+ 2
+);