Description
Filters the User List profile rows before they are put together as the user profile.
Parameters
$rows
(array) (required) An array of the forms row elements. Each row is keyed as the meta_value and is an array containing the following:
- div_before – the opening div tag, if any
- span_before – the opening span tag, if any
- field -the field content/value
- span_after – the closing span tag, if any
- div_after – the closing div tag, if any
Changelog
Introduced in extension version 1.4
Source
wpmem_ul_profile_rows is located in user-profile.php
Usage
add_filter( 'wpmem_ul_profile_rows', 'my_profile_rows_filter' );
function my_profile_rows_filter( $rows ) {
/*
* If you want to see what is in the array, uncomment the line
* below. Some of it is HTML, and gets rendered in the browser so
* it's best to view source in your browser to see the array.
*/
// echo '<pre>';print_r($rows);echo '</pre>';
/*
* Each row in the array will be keyed as the field's meta_key.
* Each of these will be an array with the following:
* * div_before (the opening div tag, if any)
* * span_before (the opening span tag, if any)
* * field (the field content/value)
* * span_after (the closing span tag, if any)
* * div_after (the closing div tag, if any)
*
* These can be changed or filtered directly as follows:
* $rows['meta_key']['field'] = "something";
*
* OR, you can define the array for a custom field like this:
* $rows['meta_key] = array(
* 'div_before' => '<div class="meta_key">',
* 'span_before' => '',
* 'field' => 'Field Value',
* 'span_after' => '',
* 'div_after' => '</div>',
* );
*/
// This example makes the email field a "mailto" link.
$clickable_email = make_clickable( $rows['user_email']['field'] );
$rows['user_email']['field'] = $clickable_email;
// This example puts a special span wrapper around the user's url.
$rows['user_url']['span_before'] = '<span class="web-link">';
$rows['user_url']['span_after'] = '</span>';
/*
* This example just displays the user ID (to show how to get
* the user ID to use for retreiving any custom data).
*
* The wpmem_get() API function can be used to 'get' the
* user ID from the query string variable 'uid'.
*/
$user_id = wpmem_get( 'uid', false, 'get' );
$meta = 'custom_row';
$rows[ $meta ] = array(
'div_before' => '<div class="' . $meta. '">',
'span_before' => '',
'label' => '',
'field' => $user_id,
'span_after' => '',
'div_after' => '</div>',
);
// At the end, be sure to return the array!
return $rows;
}Code Snippet Library [Subscriber Content]
See a list of all filter and action hooks