AI Assistant
Notifications
Clear all

Query wp_wpforo_profiles.fields with MYSQL

5 Posts
2 Users
0 Reactions
2,066 Views
Posts: 31
Customer
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@tim40)
Member
Joined: 9 years ago
[#6178]

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: 6645
Admin
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@astgh)
Illustrious Member
Joined: 8 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
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@tim40)
Member
Joined: 9 years ago

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


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

Illustrious Member
Posts: 6645
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian

@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
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@tim40)
Member
Joined: 9 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