Using the Subscription Level Meta API

Restrict Content Pro version 2.6 introduced a metadata API for subscription levels. This allows developers to store metadata that is directly associated with particular subscription levels.

This API works nearly identical to the standard  WordPress metadata API.

global $rcp_levels_db;

// Add metadata
$rcp_levels_db->add_meta( $level_id = 0, $key = '', $value = '', $unique = true );

// Update metadata
$rcp_levels_db->update_meta( $level_id = 0, $key = '', $value = '', $previous_value = '' );

// Retrieve metadata
$rcp_levels_db->get_meta( $level_id = 0, $key = '', $single = true );

// Delete metadata
$rcp_levels_db->delete_meta( $level_id = 0, $key = '', $value = '' );