forked from ultimatemember/ultimatemember
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathum-filters-commenting.php
More file actions
32 lines (20 loc) · 1.08 KB
/
Copy pathum-filters-commenting.php
File metadata and controls
32 lines (20 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
/***
*** @Control comment author display
***/
add_filter('get_comment_author_link', 'um_comment_link_to_profile', 10000, 3 );
function um_comment_link_to_profile( $return, $author, $comment_ID ) {
global $ultimatemember;
$comment = get_comment( $comment_ID );
if( isset( $comment->user_id ) && ! empty( $comment->user_id ) ){
if ( isset( $ultimatemember->user->cached_user[ $comment->user_id ] ) && $ultimatemember->user->cached_user[ $comment->user_id ] ) {
$return = '<a href="'. $ultimatemember->user->cached_user[$comment->user_id]['url'] . '">' . $ultimatemember->user->cached_user[$comment->user_id]['name'] . '</a>';
} else {
um_fetch_user( $comment->user_id );
$ultimatemember->user->cached_user[ $comment->user_id ] = array('url' => um_user_profile_url(), 'name' => um_user('display_name') );
$return = '<a href="'. $ultimatemember->user->cached_user[$comment->user_id]['url'] . '">' . $ultimatemember->user->cached_user[$comment->user_id]['name'] . '</a>';
um_reset_user();
}
}
return $return;
}