WP_Community_Events::__construct() WordPress Method

The WP_Community_Events::__construct() method is used to initialize the community events feature. It sets up the data structures needed to track community events and provides the necessary hooks to integrate with the rest of the WordPress ecosystem.

WP_Community_Events::__construct( int $user_id, false|array $user_location = false ) #

Constructor for WP_Community_Events.


Parameters

$user_id

(int)(Required)WP user ID.

$user_location

(false|array)(Optional)Stored location data for the user. false to pass no location.

  • 'description'
    (string) The name of the location
  • 'latitude'
    (string) The latitude in decimal degrees notation, without the degree symbol. e.g.: 47.615200.
  • 'longitude'
    (string) The longitude in decimal degrees notation, without the degree symbol. e.g.: -122.341100.
  • 'country'
    (string) The ISO 3166-1 alpha-2 country code. e.g.: BR

Default value: false


Top ↑

Source

File: wp-admin/includes/class-wp-community-events.php

	public function __construct( $user_id, $user_location = false ) {
		$this->user_id       = absint( $user_id );
		$this->user_location = $user_location;
	}


Top ↑

Changelog

Changelog
VersionDescription
4.8.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.