Note: This is part of the developer docs and is considered custom code.
Unfortunately, we cannot provide support for custom code at this time as we do not have the additional resources that would be necessary to provide support for custom code.
If you need assistance with this, please reach out to our list of consultants for further assistance:
Restrict Content Pro version 2.6 introduced a metadata API for membership levels. This allows developers to store metadata that is directly associated with particular membership 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 = '' );
Version 3.1 also introduced new helper functions. These functions are just a different way of doing the exact same thing as above:
// Add metadata rcp_add_membership_level_meta( $level_id, $meta_key, $meta_value, $unique = false ); // Update metadata rcp_update_membership_level_meta( $level_id, $meta_key, $meta_value, $prev_value = '' ); // Retrieve metadata rcp_get_membership_level_meta( $level_id, $key = '', $single = false ); // Delete metadata rcp_delete_membership_level_meta( $level_id, $meta_key, $meta_value = '' );
Please note: All of these examples serve as a guideline and are here for your convenience. We do not provide support for troubleshooting or modifying these and we do not provide support for any custom development. If you need help with any of these examples, consider hiring a developer.