AnsPress_Reputation_Hooks::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/free/reputation.php

	public static 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( 'free/buddypress.php' ) && function_exists( 'bp_core_get_userlink' ) ) {
					return $name . '<a href="' . ap_user_link( $args['user_id'] ) . 'qa/reputations" class="ap-user-reputation" title="' . __( 'Reputation', 'anspress-question-answer' ) . '">' . $reputation . '</a>';
				}
				else {
					return $name . '<a href="' . ap_user_link( $args['user_id'] ) . '?tab=reputations" class="ap-user-reputation" title="' . __( 'Reputation', 'anspress-question-answer' ) . '">' . $reputation . '</a>';
				}
			}
		}

		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