$group['ID'], 'name' => $group['name'] ]; } $group_data = array_merge( $group_data, $default_groups ); return $group_data; } /** * add new group **/ public static function add_group( $group_name ) { $data = array( 'name' => $group_name, 'created_at' => date( 'Y-m-d H:i:s' ), ); $result = BWFAN_Model_Field_Groups::insert( $data ); $group_id = BWFAN_Model_Field_Groups::insert_id(); return self::get_groupby_id( $group_id ); } /** * function to return default custom group **/ public static function get_default_groups() { return apply_filters( 'bwfcrm_get_custom_groups', self::$default_groups ); } /** * function to get the group details by group name */ public static function get_groupby_name( $group_name ) { $query = "select * from {table_name} where name='" . $group_name . "'"; $group_data = BWFAN_Model_Field_Groups::get_results( $query ); return $group_data; } /** * function to get the group details by group id */ public static function get_groupby_id( $group_id ) { $query = "select ID as id,name,created_at from {table_name} where id='" . $group_id . "'"; $group_data = BWFAN_Model_Field_Groups::get_results( $query ); return $group_data; } /** * function to get group slug */ public static function generate_group_slug( $group_name ) { $group_slug = strtolower( $group_name ); $group_slug = str_replace( ' ', '_', $group_slug ); return $group_slug; } } BWFCRM_Group::get_instance(); }