CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • civicrm_uf_profile_groups_get
Pages: [1]

Author Topic: civicrm_uf_profile_groups_get  (Read 1134 times)

FatherShawn

  • Ask me questions
  • ****
  • Posts: 372
  • Karma: 25
    • C3 Design
  • CiviCRM version: 4.2.11
  • CMS version: Drupal 7.23
  • MySQL version: 5.5.32
  • PHP version: 5.3.10
civicrm_uf_profile_groups_get
April 20, 2011, 09:13:26 am
At http://wiki.civicrm.org/confluence/display/CRMDOC40/Upgrading+api%27s+from+v1+to+v2+and+from+v2+to+v3 there is no v.3 entry for the v.2 API function civicrm_uf_profile_groups_get() Is that function to be deprecated or is it in need of migration?
Lead Developer, C3 Design.
Twitter: @FatherShawn

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: civicrm_uf_profile_groups_get
April 20, 2011, 09:44:55 am
Hi,

Not familiar with this function, what does it do & how do you use it?

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

FatherShawn

  • Ask me questions
  • ****
  • Posts: 372
  • Karma: 25
    • C3 Design
  • CiviCRM version: 4.2.11
  • CMS version: Drupal 7.23
  • MySQL version: 5.5.32
  • PHP version: 5.3.10
Re: civicrm_uf_profile_groups_get
April 20, 2011, 11:03:40 am
It returns a list of all defined profiles:
http://wiki.civicrm.org/confluence/display/CRMDOC40/Legacy+Profile+APIs#LegacyProfileAPIs-civicrmufprofilegroupsget%28%29

I use it to build a select list in CiviRelate of the profiles available on the configuration page.
Lead Developer, C3 Design.
Twitter: @FatherShawn

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: civicrm_uf_profile_groups_get
April 22, 2011, 01:33:07 am
So, with v3 api we have followed the BAO / civicrm tables much more closely. This one didn't come across because it wasn't obvious to me what it was as 'profile' isn't a BAO. However, from you comment I think it might be what we would call uf_group_get - does that sound right? - there isn't a get function in that api yet.

So, to put it clearly - is the function basically returning stuff form the uf_group table?
if so I would expect the function to work if it looked something like the below. Note that we aim for our 'get' functions in apiv3 to allow filtering which this doesn't based on the v2 version

/**               
 * Get all the user framework groups
 *
 * @access public                                         
 * @return array - array reference of all groups.
 * @static
 */
function &civicrm_uf_profile_groups_get( $params) {

    return civicrm_create_success(CRM_Core_PseudoConstant::ufGroup( ));
}
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

FatherShawn

  • Ask me questions
  • ****
  • Posts: 372
  • Karma: 25
    • C3 Design
  • CiviCRM version: 4.2.11
  • CMS version: Drupal 7.23
  • MySQL version: 5.5.32
  • PHP version: 5.3.10
Re: civicrm_uf_profile_groups_get
April 22, 2011, 04:28:11 am
Quote from: Eileen on April 22, 2011, 01:33:07 am
So, to put it clearly - is the function basically returning stuff form the uf_group table?

Yes.  In v.2 the function returns an array of all the values of uf_group_table.title where uf_group_table.id is the array key.

I think that filtering on uf_group_table.is_active and uf_group_table.group_type would be valuable additions and keep it consistent with your aim for get functions.

Thanks for looking at this!
« Last Edit: April 22, 2011, 04:29:43 am by FatherShawn »
Lead Developer, C3 Design.
Twitter: @FatherShawn

FatherShawn

  • Ask me questions
  • ****
  • Posts: 372
  • Karma: 25
    • C3 Design
  • CiviCRM version: 4.2.11
  • CMS version: Drupal 7.23
  • MySQL version: 5.5.32
  • PHP version: 5.3.10
Re: civicrm_uf_profile_groups_get
April 22, 2011, 04:55:37 am
Whoa!  :o  What about the new Constants.php in v.3?

Isn't this civicrm_api('Constant','Get',array('name' => 'ufGroup', 'version' =>3))
Lead Developer, C3 Design.
Twitter: @FatherShawn

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: civicrm_uf_profile_groups_get
April 25, 2011, 09:06:18 pm
I added UFGroup Get to v3 but as you point out the Constant api achieves a similar thing - although the output is slightly different & the UFGroup Get does filtering. Not sure what else differs
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

FatherShawn

  • Ask me questions
  • ****
  • Posts: 372
  • Karma: 25
    • C3 Design
  • CiviCRM version: 4.2.11
  • CMS version: Drupal 7.23
  • MySQL version: 5.5.32
  • PHP version: 5.3.10
Re: civicrm_uf_profile_groups_get
April 26, 2011, 12:02:43 pm
Nice work  8)

I'll update my code...  Filtering is a nice addition to simply pulling the pseudoconstant.  In my case it should allow me to only pull in profiles of the proper type.

Thanks, Eileen!  You are awesome.
Lead Developer, C3 Design.
Twitter: @FatherShawn

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • civicrm_uf_profile_groups_get

This forum was archived on 2017-11-26.