• Welcome to Tux Reports: Where Penguins Fly. We hope you find the topics varied, interesting, and worthy of your time. Please become a member and join in the discussions.

Checkbox Option For Thread Creation

This entry is part of a series of entries "February 2017 - XenWord Development Log"
Early versions of XenWord automatically created a thread. Some customers asked for the allow comments to be used as a conditional for creating the thread. If unchecked then XenWord would not create the thread.

This created confusion for some people who simply wanted an option available to check. After two weeks of headaches, I found my error and the option now works as expected.

Here is a short video on how the option looks in XenWord 3.3.3.


The problem was a simple conditional to check if the option existed.

PHP:
// Make sure that it is set.
if ( ! isset( $_POST['xenword_checkbox'] ) ) {
   return;
}

I wasn't aware that if a checkbox is unchecked then nothing is sent. This meant the value was not set, the code executed a return, and the update_post_meta never happened. Removing these lines fixed the issue.
Next entry in series Comments Ranked by Likes

Blog entry information

Author
LPH
Views
1,898
Comments
1
Last update

More entries in General

More entries from LPH

Top