AppCommunity Template Hook Example
<?php | |
// this code goes in a plugin | |
// Add a member profile field to the app | |
add_filter( 'appcommunity_prepare_user', function( $response, $request ) { | |
$response['appp']['user_actions'] = '<div padding><p class="custom-profile-field"><strong>' . xprofile_get_field( 1, $request['id'] )->name . '</strong><br/>' . xprofile_get_field_data( 1, $request['id'] ) . '</p><p class="custom-profile-field"><strong>' . xprofile_get_field( 2, $request['id'] )->name . '</strong><br/>' . xprofile_get_field_data( 2, $request['id'] ) . '</p></div>'; | |
return $response; | |
}, 10, 2 ); | |
// Add a field to the group detail page | |
add_filter( 'appcommunity_prepare_group', function( $response, $request ) { | |
$response['appp']['above_content'] = '<p>Member count: ' . groups_get_groupmeta( $response['id'], 'total_member_count', 1 ) . '</p>'; | |
$response['appp']['below_content'] = 'Thanks for visiting my group!'; | |
return $response; | |
}, 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment