Reputation::display_name( string $name, array $args )

Description #

Append user reputations in display name.

Parameters #

  • $name
    string (Required) User display name.
  • $args
    array (Required) Arguments.

Source #

File: addons/reputation/reputation.php

	public function display_name( $name, $args ) {
		if ( $args['user_id'] > 0 ) {
			if ( $args['html'] ) {
				$reputation = ap_get_user_reputation_meta( $args['user_id'] );

				if ( ap_is_addon_active( 'buddypress.php' ) && function_exists( 'bp_core_get_userlink' ) ) {
					return $name . '<a href="' . ap_user_link( $args['user_id'] ) . 'reputations/" class="ap-user-reputation" title="' . __( 'Reputation', 'anspress-question-answer' ) . '">' . $reputation . '</a>';
				} else { // phpcs:ignore Universal.ControlStructures.DisallowLonelyIf.Found
					if ( ap_is_addon_active( 'profile.php' ) ) {
						return $name . '<a href="' . ap_user_link( $args['user_id'] ) . 'reputations/" class="ap-user-reputation" title="' . __( 'Reputation', 'anspress-question-answer' ) . '">' . $reputation . '</a>';
					} else {
						return $name . '<span class="ap-user-reputation" title="' . __( 'Reputation', 'anspress-question-answer' ) . '">' . $reputation . '</span>';
					}
				}
			}
		}

		return $name;
	}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment