Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

SQL query for Buddypress Group Extension API Fields WordPress

  • SOLVED

Hello

I have a buddypress install with additional fields added using the Group Extension API, I would like you to write an sql query that returns a list of the groups, along with the values in specified fields

Groups to be listed horizontally, with the specified fields alongside in columns

Group Field1 Field2 Field3
Gr1 Ll1value Fl2value Fl3value
Gr2 Ll1value1 Fl2value2 Fl3value2

Answers (2)

2013-06-03

Hariprasad Vijayan answers:

Hello,

Please provide me the database via my email.. [email protected]


npeplow comments:

sent


Hariprasad Vijayan comments:

Do you want the result in the same structure displayed in the site that you provided in mail?


Hariprasad Vijayan comments:

Can you please show me the current query that you are using.


npeplow comments:

Hi

I'm not using a query at the moment, please can you take a look at the wp_bp_groups_groupmeta and wp_bp_groups table.

I would like the group name to be in the first column (from wp_bp_groups), with this joined with meta keys (from wp_bp_groups_groupmeta, use bpgf_overview bpgf_jobroles bpgf_keyskills as column headers as an example)


Group bpgf_overview bpgf_jobroles bpgf_keyskills
Investment Banking sdfsdf tryurtyurt fgthjyututryu
Engineering kkhjkghjk gfhjgfhj wghjghehrwer


Hariprasad Vijayan comments:

Hello,

Check this query,


SELECT name,(select meta_value from wp_bp_groups_groupmeta where wp_bp_groups_groupmeta.meta_key="bpgf_overview" and wp_bp_groups.id=wp_bp_groups_groupmeta.group_id) as Field1,(select meta_value from wp_bp_groups_groupmeta where wp_bp_groups_groupmeta.meta_key="bpgf_jobroles" and wp_bp_groups.id=wp_bp_groups_groupmeta.group_id) as Field2,(select meta_value from wp_bp_groups_groupmeta where wp_bp_groups_groupmeta.meta_key="bpgf_keyskills" and wp_bp_groups.id=wp_bp_groups_groupmeta.group_id) as Field3 FROM `wp_bp_groups` LIMIT 0 , 30


Good Luck...


npeplow comments:

Hariprasad, thats perfect - thanks!


Hariprasad Vijayan comments:

Happy to help... good luck..

2013-06-03

Arnav Joy answers:

which plugin you are using?


npeplow comments:

Hi Arnav

I'm using my own custom plugin based off the group extension API, data is stored in the buddypress meta. Can provide you with database access if needed

Thanks
Nick