Last active
January 27, 2021 18:45
-
-
Save scottopolis/be6670978bf8c2e94de2d35206b66bc9 to your computer and use it in GitHub Desktop.
Add User Profile Data in AppCommunity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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