function frontier_can_clone($tmp_post_type = "NONE") { global $fps_access_check_msg; $tmp_can_do = true; // first check if user can add if (!frontier_can_add($tmp_post_type)) { $tmp_can_do = false; $fps_access_check_msg .= __("You are not allowed to add new posts", "frontier-post") . "<br>"; } if (!current_user_can('frontier_post_can_clone')) { $tmp_can_do = false; $fps_access_check_msg .= __("You are not allowed to clone posts", "frontier-post") . "<br>"; } // Always allow the boss if (current_user_can('administrator')) { $tmp_can_do = true; $fps_access_check_msg = ""; } // check if it is an allowed posttype if (!fp_check_post_type($tmp_post_type)) { $tmp_can_do = false; $fps_access_check_msg .= __("You are not allowed to clone post type", "frontier-post") . ": " . $tmp_post_type; $fps_access_check_msg .= " - Allowed: (" . implode(", ", fp_default_post_type_list()) . ")<br>"; } // check if posttype exists if (!post_type_exists($tmp_post_type)) { $tmp_can_do = false; $fps_access_check_msg .= __("Post type does not exists", "frontier-post") . ": " . $tmp_post_type . "<br>"; } //echo "<hr>add validation msg: ".$fps_access_check_msg."<br>"; return $tmp_can_do; }
function fp_check_post_type($tmp_post_type) { if (in_array($tmp_post_type, fp_default_post_type_list())) { return true; } else { return false; } }
function fp_check_post_type($tmp_post_type) { if (array_search($tmp_post_type, fp_default_post_type_list()) !== false) { return true; } else { return false; } }