May 2017
Beginner to intermediate
536 pages
14h 25m
English
We have implemented the subscribe process for topics. However, we also need the unsubscribe functionality and we need to highlight whether a given topic is subscribed or not. So, let's update the process_bulk_action function for adding another action for unsubscribe, as shown in the following code:
function process_bulk_action() { global $wpdb; // Subscription code if ('unsubscribe' === $this->current_action()) { $subscribed_topics = $_POST['topic']; $user_id = get_current_user_id(); $topic_subscriptions_table = $wpdb->prefix.'topic_subscriptions'; foreach ($subscribed_topics as $subscribed_topic) { $wpdb->delete( $topic_subscriptions_table, array( 'topic_id' => $subscribed_topic, 'user_id' ...Read now
Unlock full access