Skip to content

Commit

Permalink
New profile_get_name() function
Browse files Browse the repository at this point in the history
Returns the "profile name" i.e. concatenation of Platform, OS and Build.

Fixes #27258
  • Loading branch information
dregad committed Sep 18, 2020
1 parent 2fc662f commit ef8640c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
3 changes: 1 addition & 2 deletions core/filter_form_api.php
Original file line number Diff line number Diff line change
Expand Up @@ -1051,8 +1051,7 @@ function print_filter_values_show_profile( array $p_filter ) {
if( filter_field_is_any( $t_current ) ) {
$t_any_found = true;
} else {
$t_profile = profile_get_row_direct( $t_current );
$t_this_string = $t_profile['platform'] . ' ' . $t_profile['os'] . ' ' . $t_profile['os_build'];
$t_this_string = profile_get_name( $t_current );
}
if( $t_first_flag != true ) {
$t_output = $t_output . '<br />';
Expand Down
16 changes: 16 additions & 0 deletions core/profile_api.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,22 @@ function profile_get_row_direct( $p_profile_id ) {
return $t_row;
}

/**
* Return the profile's name as concatenation of platform, os and build.
* @param int $p_profile_id
* @return string
*/
function profile_get_name( $p_profile_id ) {
$t_profile = profile_get_row_direct( $p_profile_id );
/**
* @var string $v_platform
* @var string $v_os
* @var string $v_os_build
*/
extract( $t_profile, EXTR_PREFIX_ALL, 'v' );
return "$v_platform $v_os $v_os_build";
}

/**
* Return an array containing all rows for a given user
* @param integer $p_user_id A valid user identifier.
Expand Down

0 comments on commit ef8640c

Please sign in to comment.