get_weekstartend

Definition:
function get_weekstartend( $mysqlstring, $start_of_week = '' ) {}

Get the week start and end from the datetime or date string from mysql.

Parameters

  • string $mysqlstring: Date or datetime field type from mysql.
  • int $start_of_week: Optional. Start of the week as an integer.

Return values

returns:Keys are ‘start’ and ‘end’.

Source code

function get_weekstartend( $mysqlstring, $start_of_week = '' ) {

	$my = substr( $mysqlstring, 0, 4 ); // Mysql string Year

	$mm = substr( $mysqlstring, 8, 2 ); // Mysql string Month

	$md = substr( $mysqlstring, 5, 2 ); // Mysql string day

	$day = mktime( 0, 0, 0, $md, $mm, $my ); // The timestamp for mysqlstring day.

	$weekday = date( 'w', $day ); // The day of the week from the timestamp

	if ( !is_numeric($start_of_week) )

		$start_of_week = get_option( 'start_of_week' );



	if ( $weekday < $start_of_week )

		$weekday += 7;



	$start = $day - 86400 * ( $weekday - $start_of_week ); // The most recent week start day on or before $day

	$end = $start + 604799; // $start + 7 days - 1 second

	return compact( 'start', 'end' );

}

1909

get_user_to_edit

Definition:
function get_user_to_edit( $user_id ) {}

Retrieve user data and filter it.

Parameters

  • int $user_id: User ID.

Return values

returns:object with user data.

Source code

function get_user_to_edit( $user_id ) {

	$user = new WP_User( $user_id );



	$user_contactmethods = _wp_get_user_contactmethods( $user );

	foreach ($user_contactmethods as $method => $name) {

		if ( empty( $user->{$method} ) )

			$user->{$method} = '';

	}



	if ( empty($user->description) )

		$user->description = '';



	$user = sanitize_user_object($user, 'edit');



	return $user;

}

1907

get_user_setting

Definition:
function get_user_setting( $name, $default = false ) {}

Retrieve user interface setting value based on setting name.

Parameters

  • string $name: The name of the setting.
  • string $default: Optional default value to return when $name is not set.

Return values

returns:the last saved user setting or the default value/false if it doesn’t exist.

Source code

function get_user_setting( $name, $default = false ) {



	$all = get_all_user_settings();



	return isset($all[$name]) ? $all[$name] : $default;

}

1905

get_user_option

Definition:
function get_user_option( $option, $user = 0, $deprecated = '' ) {}

Retrieve user option that can be either per Site or per Network.
If the user ID is not given, then the current user will be used instead. If the user ID is given, then the user data will be retrieved. The filter for the result, will also pass the original option name and finally the user data object as the third parameter.

Parameters

  • string $option: User option name.
  • int $user: Optional. User ID.
  • bool $deprecated: Use get_option() to check for an option in the options table.

Defined filters

  • get_user_option_{$option}
    apply_filters("get_user_option_{$option}", $result, $option, $user)

Source code

function get_user_option( $option, $user = 0, $deprecated = '' ) {

	global $wpdb;



	if ( !empty( $deprecated ) )

		_deprecated_argument( __FUNCTION__, '3.0' );



	if ( empty( $user ) )

		$user = wp_get_current_user();

	else

		$user = new WP_User( $user );



	if ( ! isset( $user->ID ) )

		return false;



	if ( $user->has_prop( $wpdb->prefix . $option ) ) // Blog specific

		$result = $user->get( $wpdb->prefix . $option );

	elseif ( $user->has_prop( $option ) ) // User specific and cross-blog

		$result = $user->get( $option );

	else

		$result = false;



	return apply_filters("get_user_option_{$option}", $result, $option, $user);

1903

get_user_metavalues

Definition:
function get_user_metavalues($ids) {}

Perform the query to get the $metavalues array(s) needed by _fill_user and _fill_many_users

Parameters

  • array $ids: User ID numbers list.

Return values

returns:of arrays. The array is indexed by user_id, containing $metavalues object arrays.

Source code

function get_user_metavalues($ids) {

	$objects = array();



	$ids = array_map('intval', $ids);

	foreach ( $ids as $id )

		$objects[$id] = array();



	$metas = update_meta_cache('user', $ids);



	foreach ( $metas as $id => $meta ) {

		foreach ( $meta as $key => $metavalues ) {

			foreach ( $metavalues as $value ) {

				$objects[$id][] = (object)array( 'user_id' => $id, 'meta_key' => $key, 'meta_value' => $value);

			}

		}

	}



	return $objects;

}

1901