Notifications
Clear all

Query wp_wpforo_profiles.fields with MYSQL

5 Posts
2 Users
0 Likes
891 Views
Posts: 31
Customer
Topic starter
(@tim40)
Member
Joined: 7 years ago

Do you have any tips on how to extract information out of wp_wpforo_profiles.fields with MYSQL?

Let's say I want to extract the values for a particular custom field. Or maybe I want to find all records where a custom field value equals a particular value.

I really like wpForo, but I don't like how custom fields are stored. I wish they were stored in the wp_usermeta table.

 

4 Replies
Astghik
Posts: 5912
Admin
(@astgh)
Illustrious Member
Joined: 6 years ago

Hi @tim40,

there is no special SQL that allows you to get the value of the field. You'll need to get the date form wp_wpforo_profiles table's "fields" column, then decode the JSON and use the values of the specific keys.

Reply
Posts: 31
Customer
Topic starter
(@tim40)
Member
Joined: 7 years ago

Do you have any PHP code that you can share showing how to do this?

Reply
1 Reply
Astghik
Admin
(@astgh)
Joined: 6 years ago

Illustrious Member
Posts: 5912

@tim40,

No necessary to use custom codes, you can use wpforo_member(1, 'field_key'); function:

1 - the first value is the User ID,

2 - field_key can be found as shown in the screenshot

field key
Reply
Posts: 31
Customer
Topic starter
(@tim40)
Member
Joined: 7 years ago

Actually, that's not too bad. I like it! I can loop through the SQL results and add the data to a table. Thanks!

Reply
Share:
Scroll to top