Hi @kgw203
1. Could you clarify what did you mean by “author slug”? What is the usermeta key or column from the wp_users table used for that?
2. Use user.id
placeholder inside JS template inside templates/members-grid.php
file for getting User ID (ID for the current user card).
As soon as you provide the data about the author slug, I can reply about the place where you may replace the data.
Let me know,
Best Regards!
Thread Starter
kgw203
(@kgw203)
(thanks for the speedy response!)
the column is user_nicename
Hi @kgw203
Thanks for the details,
1.Sorry for the formatting, I meant <code>user.id</code>
2. Use this code snippet for adding user_nicename inside JSON data:
You may insert it into the functions.php file in your theme/child-theme.
function um_my_custom_ajax_get_members_data( $data_array, $user_id, $directory_data ) {
$user_obj = get_userdata( $user_id );
if ( false === $user_obj ) {
return $data_array;
}
$data_array['nicename'] = $user_obj->user_nicename;
return $data_array;
}
add_filter( 'um_ajax_get_members_data', 'um_my_custom_ajax_get_members_data', 10, 3 );
Then edit your members-grid.php template file. https://www.screencast.com/t/2nvNyRXEp
3. As an alternative way if you want to use nicename
everywhere as display_name then please use this snippet inside your functions.php file.
function um_my_custom_user_display_name_filter( $name, $user_id, $html ) {
$user_obj = get_userdata( $user_id );
if ( false === $user_obj ) {
return $name;
}
$name = $user_obj->user_nicename;
return $name;
}
add_filter( 'um_user_display_name_filter', 'um_my_custom_user_display_name_filter', 10, 3 );
There is an article about templates overriding
https://docs.ultimatemember.com/article/1516-templates-map
Let me know if you have other questions,
Best Regards!
Thread Starter
kgw203
(@kgw203)
This worked perfectly, thanks!
I was also able to use hooks to add to the profile page.
Thank you so much!
Headache resolved.
Hi @kgw203
Thanks for confirmed resolving! Hope this helps the community.
Best Regards!