You want to export options? or user meta? I can’t quite tell from your question, but it sounds like you want to export user meta.
For an optionable field like select, multiple select, etc, the combination of values is:
User displayed value|database saved value
When you pull the value for a user, it’s going to be the database saved value, so keep that in mind when setting up your fields. If you want to pull “apple”, then don’t make “fruit01” the saved value for “apple”. Just make it “apple” (i.e. apple|apple,).
Thread Starter
c3web
(@c3web)
Hi Chad,thanks your reply.
User displayed value|database saved value
I want to get User displayed value.
My select fields is “Japanese|English”.
(i.e. リンゴ|apple,)
So,I want to export User displayed value.
Is it possible by using wpmem_user_export_row?
Thread Starter
c3web
(@c3web)
The display of the management screen could be changed.
https://qiita.com/Kazuya_Murakami/items/b7f8f647e7f518ab2dc6
And i want to export this.
thanks.
Yes, if it’s a single value field (like “select” or radio), I think you could do something like the following:
add_filter( 'wpmem_user_export_row', function( $row, $user_id ) {
$meta = "fruits"; // the field's meta key
$fields = wpmem_fields();
$row[ $meta ] = $fields[ $meta ]['options'][ $row[ $meta ] ];
return $row;
}, 10, 2 );
Thread Starter
c3web
(@c3web)
Hi Chad,thanks your reply.
Your answer is what I wanted!
$row[ $meta ] = $fields[ $meta ][‘options’][ $row[ $meta ] ];
I didn’t understand here. So thank you for your answer.
Thank you for your help.