LLMS_Helper_Betas::handle_form_submit()
Handle channel subscription saves
Return Return
(null|string) Returns null when nonce errors or invalid data are submitted, otherwise returns an array of addon subscription data.
Source Source
File: libraries/lifterlms-helper/includes/class-llms-helper-betas.php
public function handle_form_submit() { if ( ! llms_verify_nonce( '_llms_beta_sub_nonce', 'llms_save_channel_subscriptions' ) ) { return; } $subs = llms_filter_input( INPUT_POST, 'llms_channel_subscriptions', FILTER_UNSAFE_RAW, FILTER_REQUIRE_ARRAY ); if ( ! $subs || ! is_array( $subs ) ) { return; } $new_subscription = false; foreach ( $subs as $id => $channel ) { $addon = llms_get_add_on( $id ); if ( 'channel' !== $addon->get_channel_subscription() ) { $addon->subscribe_to_channel( sanitize_text_field( $channel ) ); $new_subscription = true; } } // When a channel subscription changes also flush caches so we'll get the most recent add-on data immediately and allow upgrading immediately from wp core update screens. if ( $new_subscription ) { llms_helper_flush_cache(); } return $subs; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.2.1 | Flush transient caches when a subscription changes. |
3.2.0 | Don't access $_POST directly. |
3.0.0 | Introduced. |