Automator_Utilities::recipe_number_times_completed( null $recipe_id = null, $completed_times )
Contents
Parameters Parameters
- $recipe_id
-
(Optional)
Default value: null
- $completed_times
-
(Required)
Return Return
(bool)
Source Source
File: src/core/lib/utilities/class-automator-utilities.php
public function recipe_number_times_completed( $recipe_id = null, $completed_times = 0 ) { if ( is_null( $recipe_id ) ) { return false; } $post_meta = get_post_meta( $recipe_id, 'recipe_completions_allowed', true ); if ( empty( $post_meta ) ) { $completions_allowed = 1; // Make sure that the recipe has recipe_completions_allowed saved. @version 2.9 update_post_meta( $recipe_id, 'recipe_completions_allowed', 1 ); } else { $completions_allowed = $post_meta; } $return = false; if ( intval( '-1' ) === intval( $completions_allowed ) ) { $return = false; } elseif ( (int) $completed_times >= (int) $completions_allowed ) { $return = true; } return $return; }
Expand full source code Collapse full source code View on Github