Forum Replies Created

Viewing 15 replies - 16 through 30 (of 140 total)
  • Excellent! Do you know if there is a way to permanently change the path for debug.log, so that I can direct it to a directory that has no public permissions? Altho I know this is outside the scope of WF, any tips would be appreciated.)

    Thread Starter FeralReason

    (@feralreason)

    Thanks much for the quick response! Just sent it to you.

    FYI – for those reading this – this is not a bug or problem. It is just a request for clarification.

    Thread Starter FeralReason

    (@feralreason)

    That worked. Thanks much.

    Thread Starter FeralReason

    (@feralreason)

    1) Now works for read/insert/update of MySQL record – if programmers remember to convert dates:
    PHP programmers who are building the form and form handler need to remember: MySQL requires a Y-m-d date format for DATE fields (the most common date format in MySQL.) So when filling in a date for the first time, before doing an INSERT in the database, the date should be converted: “$date1 = date(“Y-m-d”, strtotime($date1)). The same conversion has to be used before an UPDATE.
    Additionally, after retrieving a record from MySQL, before the date can be displayed correctly, it has to be converted to the m/d/y format used by the datepicker, like this: $date1 = date(“m/d/Y”, strtotime($date1));

    2) Could Display of dates happen automatically? :
    Currently the dates don’t display in the fields until the cursor moves out of the address bar and into the body — or if the cursor is already in the body, until it moves at all. This means that when the form first comes up, the date fields may be shown as blanks. Is there a way to display the dates before the cursor moves?

    (Fahad — I extended my shortcode function to test inserting, reading and updating records in a mysql DB. If you want that, send me an email address.)

    Thread Starter FeralReason

    (@feralreason)

    Sounds good!

    Thread Starter FeralReason

    (@feralreason)

    Oh – obviously you will have to add $date3 = $_POST['date3']; in the form handler. Copied it before I added that…

    Thread Starter FeralReason

    (@feralreason)

    That helped. I can display dates when we ‘mouseover body’ now. There still seems to be a “1st Field Duplication” issue. I created a shortcode that shows that and allows a little experimenting (without going to a database). If you like, just add the function somewhere (functions.php?), create a test post, and try it for a few minutes. (Just substitute your wp datepicker class for “my-datepicker”.) You should see that the date in the first field incorrectly duplicates in the 2nd and 3rd field. This must be happening in javascript because developer tools shows dates correctly.

    Editing each field populates the $_POST array properly here. Altho I thought I saw a possible mySql conversion issue that we can’t duplicate in the shortcode without adding database access. However — that issue may have been a side-effect of the duplication issue or my own code.

     
    /*  Use:  [test_datepicker]  */
    
    function test_datepicker_shortcode($atts, $content=null){
    	if($_POST){
    		$date1 = $_POST['date1'];
    		$date2 = $_POST['date2'];
    		if (empty($date1)) {
    			echo "date1 is empty<br>";
    		} else {
    			echo "date1 is: ".$date1."<br>";
    		}
    		if (empty($date2)) {
    			echo "date2 is empty<br>";
    		} else {
    			echo "date2 is: ".$date2."<br>";
    		}
    		if (empty($date3)) {
    			echo "date3 is empty<br>";
    		} else {
    			echo "date3 is: ".$date3."<br>";
    		}
        }
    	else{
    		$date3 = "9/1/2021";
    		$output = "<form id='test_datepicker_form' action = '' method='post'>"; 
    		$output .= "<br>Date1: <input name='date1' type='text' data-default='06/18/2020' class='my-datepicker'>";
    		$output .= "<br>Date2: <input name='date2' type='text' data-default='07/15/2020' class='my-datepicker'>";
    		$output .= "<br>Date3: <input name='date3' type='text' data-default='".$date3."' class='my-datepicker'>";
    		$output .= "<br><br><input type='submit'>";
    		$output .= "</form>";
    		return($output);
    	}
    }
    add_shortcode('test_datepicker', 'test_datepicker_shortcode');
    • This reply was modified 4 years, 9 months ago by FeralReason.
    Thread Starter FeralReason

    (@feralreason)

    Fahad – thanks.
    Tried this without success. I tried 4 cases, using value, data-default, and data-default-val (from your code). (html below was copied from chrome dev tools, with minor edits):

    <input name="date1" type="text" id="date1" class="my-datepicker hasDatepicker" <strong>value="2020-06-01"</strong>>
    	Appears and then disappears on mouse move.
    <input name="date2" type="text" id="date2" class="my-datepicker hasDatepicker" <strong>data-default="2020-06-16"</strong> size="25">
    	Never Appears
    <input name="date3" type="text" id="date3" class="my-datepicker hasDatepicker" <strong>data-default-val="2020-07-01"</strong>>
    	Never Appears
    <input name="date4" type="text" id="date4" class="my-datepicker hasDatepicker" <strong>data-default-val="06/18/2020" value="2020-07-16"</strong>>
    	Appears and then disappears on mouse move.

    So neither data-default or data-default-val seems to display the value under any circumstances, except where there is an actual value assignment present also.

    • This reply was modified 4 years, 9 months ago by FeralReason. Reason: Added conclusion
    • This reply was modified 4 years, 9 months ago by FeralReason.
    • This reply was modified 4 years, 9 months ago by FeralReason. Reason: Fixed formatting mistake
    Thread Starter FeralReason

    (@feralreason)

    Thanks for the quick response — looking forward to anything you can find out!

    FeralReason

    (@feralreason)

    Just happened to me too as an administrator — this is NOT a minor issue.

    In my case, when I brought up the login screen, Chrome filled in the secondary administrator’s name. The password was filled to full-width with asterisks – probably not the correct password. This may have been some type of autofill error, since there are several accounts I access with his name.

    Not thinking, I submitted and immediately got the lockout message.

    Since I have FTP access, my solution was simple. Delete Captcha Bank and start looking for a new plugin.

    Thread Starter FeralReason

    (@feralreason)

    Thanks for getting back to me! That is the only feature I needed from the Highcharts install so I’ll try that out! Checked Highcharts subscription prices. $500/yr and up is w-a-y out of my range ??

    Thread Starter FeralReason

    (@feralreason)

    Got Highcharts working – so this is resolved.

    Thread Starter FeralReason

    (@feralreason)

    @wfdave Outstanding! Thanks much. We’re back in business.

    I installed this on two sites and https://observatory.mozilla.org is indicating that neither site has the headers.

    Since I don’t know what theme you are using or what your code does, I’ll assume twentythirteen and ignore potential issues with the loading order of WordPress. Depending on what _dropdowns.php does this loading order may make a difference.

    Method 1: Requires minimum familiarity with php but loads your php file pretty much at the last possible moment, which makes it vulnerable to any loading order issues. Try using the plugin: “PHP code snippets”. This provides a shortcode within which you can run php. It looks like you could put an insert or require statement for your php file within that shortcode.

    Assuming the plugin works as advertised:
    1) Install it
    2) Insert this code in your home page:

    [insert_php]include( get_stylesheet_directory() . '/_dropdowns.php');[/insert_php]

    Method 2: Requires a little more comfort with php. Detect the home page and load “_dropdowns.php” only if the current page is the home page.

    Put the following code inside the WordPress loop, so it is likely to be in a page or post template file or in the content.php file (in your child theme), which is a template part loaded within the loop:

    <?php
    ...
    $postID = get_the_ID();
    $postTitle = get_the_title( $postID );
    ...
    ?>
    ... 
    <?php if($postTitle == "Home"){ // Or whatever your home page title is...
    	include( get_stylesheet_directory() . '/_dropdowns.php');					
    <?php } ?>

    Method 3: Requires a little more PHP comfort. Encapsulate the code in method 2 in a function in functions.php and call it from either the page/post template file or the content.php file.

    Method 4: Requires the most PHP knowledge. If the php file simply contains a function you want to execute on the page, I would tend to rewrite /_dropdowns.php as a custom shortcode.

    • This reply was modified 6 years, 9 months ago by FeralReason.
    • This reply was modified 6 years, 9 months ago by FeralReason.
Viewing 15 replies - 16 through 30 (of 140 total)