Restrict Content Pro
rcp_edit_subscription_form
Coming soon: Restrict Content Pro is becoming Kadence Memberships. You may see both names used while we update the product, documentation, and customer experience.
Note: This content is provided as a resource within our developer documentation. Because custom code requires highly specific implementation, we encourage you to work with a qualified developer if you need guidance. You can find our recommended consultants here: https://codeable.io/developers/restrict-content-pro/
Used to inject content into the Edit Membership Level table. Go to Restrict → Membership Levels and edit a level. This can be used to add a new field to that form.
To save the custom value, use the rcp_edit_subscription_level action.
Parameters
$level (Membership_Level) – Membership level object being edited.
Example
This example adds a Group Seats number field and prefills it from the saved value for that level.
/**
* Add a Group Seats field to the Edit Membership Level form.
*
* @param Membership_Level $level Membership level being edited.
*
* @return void
*/
function rcpga_edit_groups_checkbox_subscription_form( $level ) {
$level_id = $level->get_id();
$seat_count = empty( $level_id ) ? 0 : rcpga_get_level_group_seats_allowed( $level_id );
?>
<tr class="form-field">
<th scope="row" valign="top">
<label for="rcpga-group-seats"><?php esc_html_e( 'Group Seats', 'rcp-group-accounts' ); ?></label>
</th>
<td>
<input id="rcpga-group-seats" type="number" name="rcpga-group-seats" value="<?php echo absint( $seat_count ); ?>" min="0" style="width: 100px;" />
<p class="description"><?php esc_html_e( 'The number of group seats available to this level including the group owner.', 'rcp-group-accounts' ); ?></p>
</td>
</tr>
<?php
}
add_action( 'rcp_edit_subscription_form', 'rcpga_edit_groups_checkbox_subscription_form' );