AnsPress_Profile_Hooks::ap_user_link( string $link, integer $user_id, array|string $sub )

Description #

Filter ap_user_link function.

Parameters #

  • $link
    string (Required) Link.
  • $user_id
    integer (Required) User id.
  • $sub
    array | string (Required) Sub page.

Source #

File: addons/free/profile.php

	public static function ap_user_link( $link, $user_id, $sub ) {
		$user = get_user_by( 'id', $user_id );

		// If permalink is enabled.
		if ( $user_id > 0 && get_option( 'permalink_structure' ) !== '' ) {
			if ( false === $sub ) {
				$sub = array( 'ap_page' => 'user', 'ap_user' => $user->user_login );
			} elseif ( is_array( $sub ) ) {
				$sub['ap_page']  = 'user';
				$sub['ap_user']  = $user->user_login;
			} elseif ( ! is_array( $sub ) ) {
				$sub = array( 'ap_page' => 'user', 'ap_user' => $user->user_login, 'user_page' => $sub );
			}

			$link = ap_get_link_to( $sub );
		}

		return $link;
	}

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