Skip to content

Instantly share code, notes, and snippets.

@scottopolis
Last active January 27, 2021 18:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scottopolis/be6670978bf8c2e94de2d35206b66bc9 to your computer and use it in GitHub Desktop.
Save scottopolis/be6670978bf8c2e94de2d35206b66bc9 to your computer and use it in GitHub Desktop.
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