User Blogs

The Site Tracking components comes, on WordPress Multisite configurations, with a directory page listing all public user Blogs of your network of sites. Thanks to the BP Blogs REST Endpoint, you can fetch these public blogs into your Application.

Note: The User Blogs component is an optional one. This means the User Blogs endpoint will only be available if the component is active on the community site.

Schema

The schema defines all the fields that exist for a Blog object.

id

integer
Unique identifier for the Blog.
Read only
Context: viewedit
user_id

integer
A unique numeric ID for the Blog’s administrator.
Read only
Context: viewedit
name

string
The Blog’s name.
Read only
Context: view, edit
permalink

string,
uri
The Blog’s permalink.
Read only
Context: viewedit
description

string
The Blog’s description.
Read only
Context: viewedit
path

string
The Blog’s relative path to the network’s domain (when Multisite is using sub-directories for blogs)
Read only
Context: viewedit
domain

string
The Blog’s domain (or the network’s domain when Multisite is using sub-directories for blogs).
Read only
Context: viewedit
last_activity

string or null
The last activity date from the Blog, in the network’s timezone.
Read only
Context: view, edit
last_activity_gmt

string or null
The last activity date from the Blog, as GMT.
Read only
Context: view, edit
avatar_urls (1)

object
Avatar URLs for the Blog (Full & Thumb sizes). It uses the WordPress site icon feature if supported, and falls back on the Administrator’s avatars.
Read only
Context: viewedit

(1) Only if the WordPress discussion settings allow avatars.

Top ↑

List Blogs

Top ↑

Arguments

NameTypeDescription
contextstringScope under which the request is made; determines fields present in response.
Default: view
One of: view, edit
pageintegerCurrent page of the collection.
Default: 1
per_pageintegerMaximum number of members to be returned in result set.
Default: 10
searchstringLimit results to site titles, domains, descriptions matching the searched terms.
user_idintegerThe unique numeric identifier of the user having publishing capabilities on the Blog.
includearrayEnsure result set include specific Blog IDs.
Default: []
typestringShorthand for certain orderby/order combinations.
Default: active
One of: active, newest, alphabetical, random

Top ↑

Definition

GET /buddypress/v1/blogs

Top ↑

Example of use

Alert: To use the bp.apiRequest function, you need to enqueue the bp-api-request JavaScript or use it as a dependency of your script. Refer to this page to know more about loading JavaScript files in WordPress.

bp.apiRequest( {
  path: 'buddypress/v1/blogs',
  type: 'GET',
  data: {
    context: 'view'
  }
} ).done( function( data ) {
  return data;
} ).fail( function( error ) {
  return error;
} );

Top ↑

Create a Blog

Note: This route requires the Blogs signup option to be active into the WordPress Network Administration settings.

Top ↑

Arguments

NameTypeDescription
namestringThe new site’s name (used for the site URL).
Required
titlestringThe new site’s title.
Required
site_idintegerThe new site’s network ID. (Only relevant on multi-network installations).
Default: 1
user_idintegerThe user ID of the new site’s admin.
Default: the logged in user ID.
metaarraySet initial Blog options.
Default: []

Top ↑

Definition

POST /buddypress/v1/blogs

Top ↑

Example of use

Alert: To use the bp.apiRequest function, you need to enqueue the bp-api-request JavaScript or use it as a dependency of your script. Refer to this page to know more about loading JavaScript files in WordPress.

bp.apiRequest( {
  path: 'buddypress/v1/blogs',
  type: 'POST',
  data: {
    context: 'edit',
    name: 'buddypress',
    title: 'BuddyPress',
  }
} ).done( function( data ) {
  return data;
} ).fail( function( error ) {
  return error;
} );

Top ↑

Retrieve a specific Blog

Top ↑

Arguments

NameTypeDescription
idintegerUnique identifier for the Blog.
contextstringScope under which the request is made; determines fields present in response.
Default: view
One of: view, edit

Top ↑

Definition

GET /buddypress/v1/blogs/<id>

Top ↑

Example of use

Alert: To use the bp.apiRequest function, you need to enqueue the bp-api-request JavaScript or use it as a dependency of your script. Refer to this page to know more about loading JavaScript files in WordPress.

bp.apiRequest( {
  path: 'buddypress/v1/blogs/2',
  type: 'GET',
  data: {
    context: 'view'
  }
} ).done( function( data ) {
  return data;
} ).fail( function( error ) {
  return error;
} );