forked from TheMacLab/game-on
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgo_comments.php
executable file
·60 lines (58 loc) · 1.33 KB
/
go_comments.php
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
function go_display_comment_author() {
global $comment;
$author_id = $comment->user_id;
$author = $comment->comment_author;
$author_obj = get_userdata( $author_id );
$author_roles = $author_obj->roles;
$is_admin = false;
if ( is_array( $author_roles ) ) {
foreach ( $author_roles as $role ) {
if ( $role == "administrator" ) {
$is_admin = true;
break;
}
}
} else {
if ( $author_roles == 'administrator' ) {
$is_admin = true;
}
}
if ( $is_admin ) {
return $author;
} else {
$points = get_user_meta( $author_id, 'go_rank', true );
$focus = get_user_meta( $author_id, 'go_focus', true );
if ( ! empty( $focus ) ) {
if ( is_array( $focus ) ) {
for ( $i = 0; $i < count( $focus ); $i++ ) {
if ( ! empty( $focus[ $i ] ) ) {
$careers .= $focus[ $i ];
if ( ( $i + 1 ) < count( $focus ) ) {
$careers .= '/';
}
}
}
} else {
$no_focus_str = 'No '.get_option( 'go_focus_name', 'Profession' );
if ( $focus != $no_focus_str ) {
$careers = $focus;
}
}
}
if ( ! empty( $careers ) ) {
if ( ! empty( $points ) ) {
return $author.'<br/>'.'('.$careers.', '.$points[0][0].')';
} else {
return $author;
}
} else {
if ( ! empty( $points ) ) {
return $author.'<br/>'.'('.$points[0][0].')';
} else {
return $author;
}
}
}
}
?>