Working with Data in BricksMembers

You do not need direct SQL to work with BricksMembers. Use the public API and let the plugin handle caching, normalization, and rebuild logic.

Data Concepts

  • User levels live in brm_user_level_assignments
  • Post requirements live in brm_post_level_requirements
  • Direct completions live in brm_user_post_completions
  • Structure/access projection lives in brm_post_data
  • Aggregate progress lives in brm_user_progress

Read Through the API

$levels = brm_get_user_levels( $user_id );
$required_levels = brm_get_post_required_levels( $post_id );
$completed = \BaselMedia\BricksMembers\Modules\Progress\ProgressCompletionReadService::get_instance()->get_completed_post_ids_for_user( $user_id );
$post_data = \BaselMedia\BricksMembers\Services\PostDataService::get_instance()->get_post_data( $post_id );

Write Through the API

brm_add_user_level( $user_id, $level_id );
brm_remove_user_level( $user_id, $level_id );
brm_set_post_levels( $post_id, [ 1, 2 ] );
brm_mark_content_completed( $user_id, $post_id );

Do not write required_levels into brm_post_data. In 0.9.82+, that is no longer canonical storage.

Query Performance Schema Flags

Schema services may add non-destructive performance columns and indexes after the base tables already exist. These upgrades are idempotent and versioned by module-specific options so normal frontend requests can avoid strict metadata checks once the tables are known.

  • brm_events_query_perf_schema_version — event details/registration composite indexes for calendar, target, and viewer registration reads.
  • brm_billing_query_perf_schema_version — billing offer_key and is_demo query columns plus payment/subscription/event indexes.
  • brm_billing_payment_offer_key_backfill_state — background cursor state for copying legacy one-time payment data_json.offer_key into the indexed payment column.
  • brm_billing_tax_tables_version — tax table version and query-index repair owner.
  • brm_automation_schema_version — automation table schema version, currently including queue indexes for available, heartbeat, and failed-job reads.
  • brm_chat_query_perf_schema_version — chat last_activity_at column and room-list indexes.

Do not introduce generated JSON columns or make JSON payloads the canonical query truth for these hot paths. JSON may remain as compatibility payload, but runtime filters should move toward indexed scalar columns owned by the module schema service.

Get BricksMembers

Start Building Your Membership Site Today

Create, sell, and manage your content without limits. BricksMembers gives you everything you need to build membership and LMS sites with Bricks Builder.

Lifetime updates & bug fixes • Premium support • 0% transaction fees • 60-day money-back guarantee