BP_Notifications_Notification::populate()

Fetch data for an existing notification from the database.


Description Description


Source Source

File: bp-notifications/classes/class-bp-notifications-notification.php

	public function populate() {
		global $wpdb;

		$bp = buddypress();

		// Look for a notification.
		$notification = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->notifications->table_name} WHERE id = %d", $this->id ) );

		// Setup the notification data.
		if ( ! empty( $notification ) && ! is_wp_error( $notification ) ) {
			$this->item_id           = (int) $notification->item_id;
			$this->secondary_item_id = (int) $notification->secondary_item_id;
			$this->user_id           = (int) $notification->user_id;
			$this->component_name    = $notification->component_name;
			$this->component_action  = $notification->component_action;
			$this->date_notified     = $notification->date_notified;
			$this->is_new            = (int) $notification->is_new;
		}
	}

Top ↑

Changelog Changelog

Changelog
Version Description
1.9.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.