$title, 'message' => $message, ); if ( $url ) { $payload['url'] = $url; $payload['actions'] = array( array( 'type' => 'view', 'label' => __( 'View', '4wp-notifications' ), 'url' => $url, ), ); } foreach ( $user_ids as $user_id ) { if ( $user_id > 0 ) { ForWP_Notifications_Queue::push( $user_id, 'custom', 'admin', $payload, null, true ); } } wp_safe_redirect( add_query_arg( array( 'page' => '4wp-notifications', 'tab' => 'direct', 'sent' => count( $user_ids ), ), admin_url( 'admin.php' ) ) ); exit; } public function handle_settings() { if ( ! current_user_can( 'manage_options' ) || ! wp_verify_nonce( isset( $_POST['_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_POST['_wpnonce'] ) ) : '', 'forwp_notifications_settings' ) ) { wp_die( esc_html__( 'Invalid request.', '4wp-notifications' ) ); } ForWP_Notifications_Plugin_Settings::set_page_id( isset( $_POST['page_id'] ) ? (int) $_POST['page_id'] : 0 ); $page_id = ForWP_Notifications_Plugin_Settings::get_page_id(); if ( $page_id > 0 ) { ForWP_Notifications_Page_Display::ensure_page_has_list_block( $page_id ); } wp_safe_redirect( add_query_arg( array( 'page' => '4wp-notifications', 'tab' => 'display', 'saved' => '1', ), admin_url( 'admin.php' ) ) ); exit; } public function handle_types() { if ( ! current_user_can( 'manage_options' ) || ! wp_verify_nonce( isset( $_POST['_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_POST['_wpnonce'] ) ) : '', 'forwp_notifications_types' ) ) { wp_die( esc_html__( 'Invalid request.', '4wp-notifications' ) ); } if ( ForWP_Notifications_Plugin_Settings::is_woocommerce_active() ) { ForWP_Notifications_Plugin_Settings::set_woo_order_created_enabled( ! empty( $_POST['woo_order_created'] ) ); ForWP_Notifications_Plugin_Settings::set_woo_status_changed_enabled( ! empty( $_POST['woo_status_changed'] ) ); } wp_safe_redirect( add_query_arg( array( 'page' => '4wp-notifications', 'tab' => 'types', 'types_saved' => '1', ), admin_url( 'admin.php' ) ) ); exit; } /** * @return string */ public static function get_all_notifications_page_url() { return ForWP_Notifications_Plugin_Settings::get_all_notifications_page_url(); } }