Database Schema

Get Started

Database Schema

BuddyPress Member Reviews uses WordPress custom post types, taxonomies, and meta fields to store review data.

Custom Post Type

Post Type: review

Reviews are stored as a custom post type with these properties:

FieldDescription
post_typeAlways review
post_authorReviewer user ID
post_contentReview text content
post_statuspublish, pending, draft
post_dateReview submission date
post_titleAuto-generated or empty

Query Example:

$reviews = get_posts( array(
    'post_type'      => 'review',
    'post_status'    => 'publish',
    'posts_per_page' => 10,
    'meta_key'       => 'linked_bp_member',
    'meta_value'     => 123, // Member ID
) );

Taxonomy

Taxonomy: review_category

Review categories for filtering and organization.

Note: The review_category taxonomy is registered but not currently exposed in the admin UI. It is available for developers to use programmatically.

Query Example:

$terms = get_terms( array(
    'taxonomy'   => 'review_category',
    'hide_empty' => false,
) );

Post Meta Keys

All meta keys are stored in the wppostmeta table with postid referencing the review post.

Core Meta

linkedbpmember

Type: int Description: The reviewed member’s user ID Example:

$member_id = get_post_meta( $review_id, 'linked_bp_member', true );
// Returns: 123

profilestarrating

Type: array (serialized) Description: Rating values for each criteria Format:

array(
    'quality'        => 4,
    'communication'  => 5,
    'professionalism'=> 4,
    'recommendation' => 5
)

Example:

$ratings = get_post_meta( $review_id, 'profile_star_rating', true );
$quality_rating = isset( $ratings['quality'] ) ? $ratings['quality'] : 0;

bupranonymousreview_post

Type: string ('yes' or 'no') Description: Whether review is anonymous Example:

$is_anonymous = get_post_meta( $review_id, 'bupr_anonymous_review_post', true );
if ( $is_anonymous === 'yes' ) {
    // Hide reviewer identity
}

Owner Reply Meta

buprownerreply

Type: string Description: Member’s reply to the review Example:

$reply = get_post_meta( $review_id, 'bupr_owner_reply', true );
// Returns: "Thank you for your feedback!"

buprownerreply_date

Type: int (Unix timestamp) Description: When owner replied Example:

$reply_date = get_post_meta( $review_id, 'bupr_owner_reply_date', true );
echo date( 'F j, Y', $reply_date );
// Returns: "January 15, 2026"

Flagging & Moderation Meta

bupr_flags

Type: array (serialized) Description: Array of user IDs who flagged this review Format:

array( 45, 67, 89 )

Example:

$flags = get_post_meta( $review_id, 'bupr_flags', true );
$flag_count = is_array( $flags ) ? count( $flags ) : 0;

buprflagstatus

Type: string ('none', 'flagged', 'resolved', 'dismissed') Description: Current flag status Example:

$status = get_post_meta( $review_id, 'bupr_flag_status', true );
if ( $status === 'flagged' ) {
    // Show admin notice
}

buprflagcount

Type: int Description: Total times review was flagged Example:

$count = get_post_meta( $review_id, 'bupr_flag_count', true );
// Returns: 3

buprautohidden

Type: boolean Description: Whether review was auto-hidden by threshold Example:

$auto_hidden = get_post_meta( $review_id, 'bupr_auto_hidden', true );

buprautohidden_date

Type: int (Unix timestamp) Description: When review was auto-hidden Example:

$hidden_date = get_post_meta( $review_id, 'bupr_auto_hidden_date', true );

User Meta Keys

Stored in wpusermeta table with userid referencing the reviewed member.

Core User Meta

buprreviewcount

Type: int Description: Total published reviews for member Example:

$review_count = get_user_meta( $user_id, 'bupr_review_count', true );
// Returns: 15

bupraggregaterating

Type: float Description: Member’s overall aggregate rating Calculation: Average of all criteria ratings across all published reviews Example:

$aggregate = get_user_meta( $user_id, 'bupr_aggregate_rating', true );
// Returns: 4.6

Calculation Logic:

// For each review:
// 1. Calculate review average: sum(all criteria) / count(criteria)
// 2. Calculate member aggregate: sum(all review averages) / total reviews

// Example with 2 reviews:
// Review 1: quality=5, communication=4, avg=4.5
// Review 2: quality=4, communication=5, avg=4.5
// Aggregate: (4.5 + 4.5) / 2 = 4.5

Pro-Specific Meta

Available only with BuddyPress Member Reviews Pro.

Verification Meta

bupr_verified

Type: string ('yes' or 'no') Description: Whether review is verified Example:

$is_verified = get_post_meta( $review_id, 'bupr_verified', true );

buprverifiedtype

Type: string Description: Verification method Values: 'purchase', 'connection', 'admin', 'custom' Example:

$type = get_post_meta( $review_id, 'bupr_verified_type', true );
// Returns: "purchase"

buprverifieddate

Type: int (Unix timestamp) Description: When review was verified Example:

$verified_date = get_post_meta( $review_id, 'bupr_verified_date', true );

Endorsement Meta

buprendorsedskills

Type: array (serialized) Description: Skills endorsed in review Format:

array( 'WordPress', 'PHP', 'JavaScript' )

Example:

$skills = get_post_meta( $review_id, 'bupr_endorsed_skills', true );
if ( is_array( $skills ) ) {
    foreach ( $skills as $skill ) {
        echo '<span class="skill-tag">' . esc_html( $skill ) . '</span>';
    }
}

buprendorsementstatus

Type: string ('accepted', 'pending', 'rejected') Description: Endorsement acceptance status Example:

$status = get_post_meta( $review_id, 'bupr_endorsement_status', true );

buprrequestmessage

Type: string Description: Message from review requester Example:

$message = get_post_meta( $review_id, 'bupr_request_message', true );
// Returns: "Please review our collaboration on Project X"

Data Format Examples

Complete Review Post

// Post data
$review = array(
    'ID'           => 456,
    'post_type'    => 'review',
    'post_author'  => 123,  // Reviewer
    'post_content' => 'Excellent work on the project...',
    'post_status'  => 'publish',
    'post_date'    => '2026-01-15 10:30:00'
);

// Post meta
$meta = array(
    'linked_bp_member' => 789,  // Reviewed member
    'profile_star_rating' => array(
        'quality'         => 5,
        'communication'   => 4,
        'professionalism' => 5,
        'recommendation'  => 5
    ),
    'bupr_anonymous_review_post' => 'no',
    'bupr_owner_reply'           => 'Thank you!',
    'bupr_owner_reply_date'      => 1705320000,
    'bupr_flags'                 => array(),
    'bupr_flag_count'            => 0,
    'bupr_flag_status'           => '',

    // Pro fields
    'bupr_verified'              => 'yes',
    'bupr_verified_type'         => 'connection',
    'bupr_verified_date'         => 1705320000,
    'bupr_endorsed_skills'       => array( 'WordPress', 'PHP' ),
    'bupr_endorsement_status'    => 'accepted'
);

Database Queries

Get All Reviews for Member

global $wpdb;

$member_id = 123;
$reviews = $wpdb->get_results( $wpdb->prepare(
    "SELECT p.* FROM {$wpdb->posts} p
    INNER JOIN {$wpdb->postmeta} pm ON p.ID = pm.post_id
    WHERE p.post_type = 'review'
    AND p.post_status = 'publish'
    AND pm.meta_key = 'linked_bp_member'
    AND pm.meta_value = %d
    ORDER BY p.post_date DESC",
    $member_id
) );

Calculate Aggregate Rating

function calculate_aggregate_rating( $member_id ) {
    $reviews = get_posts( array(
        'post_type'      => 'review',
        'post_status'    => 'publish',
        'posts_per_page' => -1,
        'meta_key'       => 'linked_bp_member',
        'meta_value'     => $member_id,
    ) );

    if ( empty( $reviews ) ) {
        return 0;
    }

    $total = 0;
    foreach ( $reviews as $review ) {
        $ratings = get_post_meta( $review->ID, 'profile_star_rating', true );
        if ( is_array( $ratings ) && ! empty( $ratings ) ) {
            $review_avg = array_sum( $ratings ) / count( $ratings );
            $total += $review_avg;
        }
    }

    $aggregate = $total / count( $reviews );

    // Update user meta
    update_user_meta( $member_id, 'bupr_aggregate_rating', $aggregate );
    update_user_meta( $member_id, 'bupr_review_count', count( $reviews ) );

    return $aggregate;
}

Get Flagged Reviews

$flagged_reviews = get_posts( array(
    'post_type'      => 'review',
    'posts_per_page' => -1,
    'meta_query'     => array(
        array(
            'key'     => 'bupr_flag_status',
            'value'   => 'flagged',
            'compare' => '='
        )
    )
) );

Data Retention

When a review is deleted:

  • Post and all post meta are removed
  • User meta (buprreviewcount, bupraggregaterating) is recalculated
  • Associated activities (if enabled) are deleted
  • Notifications are removed

Related Documentation

Last updated: February 13, 2026