Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Add User Profile Data in AppCommunity
<?php
// add this code to a custom plugin
add_filter('appcommunity_prepare_user', function( $data, $request ) {
// $data['id'] is the user_id. With that, you can look up user meta like this
// $data['appp']['below_content'] = '<p>Welcome back ' . get_user_meta( $data['id'], 'nickname', 1 ) . '!</p>';
// you can also show xprofile fields like this
$data['appp']['user_actions'] = '<div class="custom-profile-fields"><p><strong>' . xprofile_get_field( 1, $data['id'] )->name . '</strong><br/>' . xprofile_get_field_data( 1, $data['id'] ) . '</p><p><strong>' . xprofile_get_field( 2, $data['id'] )->name . '</strong><br/>' . xprofile_get_field_data( 2, $data['id'] ) . '</p></div>';
return $data;
}, 10, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment