It looks like nothing was found at this location. Maybe try one of the links below or a search?
try( bool $user_can, $caps, $id ): bool { if ( $caps === 'edit_entries_form_single' && wpforms_is_form_template( $id ) ) { $user_can = false; } return $user_can; } /** * Display admin notice for the entries page. * * @since 1.8.8 */ public function get_template_entries_notice() { if ( ! wpforms_is_admin_page( 'entries', 'list' ) ) { return; } // phpcs:ignore WordPress.Security.NonceVerification.Recommended $form_id = ! empty( $_REQUEST['form_id'] ) ? absint( $_REQUEST['form_id'] ) : 0; // The notice should be displayed only for form templates. if ( ! wpforms_is_form_template( $form_id ) ) { return; } // If there are no entries, we don't need to display the notice on the empty state page. $entries = wpforms()->obj( 'entry' )->get_entries( [ 'form_id' => $form_id, 'limit' => 1, ] ); if ( empty( $entries ) ) { return; } /** This filter is documented in wpforms/src/Pro/Tasks/Actions/PurgeTemplateEntryTask.php */ $delay = (int) apply_filters( 'wpforms_pro_tasks_actions_purge_template_entry_task_delay', DAY_IN_SECONDS ); // phpcs:ignore WPForms.PHP.ValidateHooks.InvalidHookName Notice::warning( sprintf( /* translators: %s - delay in formatted time. */ esc_html__( 'Form template entries are for testing purposes and will be automatically deleted after %s.', 'wpforms-lite' ), // The `- 1` hack is to avoid the "1 day" message in favor of "24 hours". human_time_diff( time(), time() + $delay - 1 ) ) ); } /** * Display admin notice for the entry page. * * @since 1.8.8 */ public function get_template_entry_notice() { if ( ! wpforms_is_admin_page( 'entries', 'details' ) ) { return; } // phpcs:ignore WordPress.Security.NonceVerification.Recommended $entry_id = ! empty( $_REQUEST['entry_id'] ) ? absint( $_REQUEST['entry_id'] ) : 0; $entry = wpforms()->obj( 'entry' )->get( $entry_id ); // If entry does not exist, we don't need to display the notice on the empty state page. if ( empty( $entry ) ) { return; } // The notice should be displayed only for form template entry. if ( ! wpforms_is_form_template( $entry->form_id ) ) { return; } $meta = wpforms()->obj( 'entry_meta' )->get_meta( [ 'entry_id' => absint( $entry_id ), 'type' => 'purge_template_entry_task', 'number' => 1, ] ); if ( empty( $meta ) ) { return; } $task = wpforms_json_decode( $meta[0]->data,true ); if ( empty( $task['timestamp'] ) ) { return; } Notice::warning( sprintf( /* translators: %s - delay in formatted time. */ esc_html__( 'Form template entries are for testing purposes. This entry will be automatically deleted in %s.', 'wpforms-lite' ), human_time_diff( time(), $task['timestamp'] ) ) ); } /** * Get the Show Templates user option. * * If the user has not set the Show Templates screen option, it will default to showing templates. * In this case, we want to show templates by default. * * @since 1.8.8 * * @return bool Whether to show templates by default. */ public function get_forms_overview_show_form_templates_option(): bool { $screen_options = get_user_option( 'wpforms_forms_overview_options' ); $result = $screen_options['wpforms_forms_overview_show_form_templates'] ?? true; return $result !== '0'; // phpcs:ignore WPForms.Formatting.EmptyLineBeforeReturn.RemoveEmptyLineBeforeReturnStatement } /** * Add `wpforms-template` post type to the form args. * * @since 1.8.8 * * @param array $args Form arguments. * * @return array */ public function add_template_post_type( array $args ): array { // Only add the post type to the form args on the overview page. if ( ! wpforms_is_admin_page( 'overview' ) ) { return $args; } // Only add the template post type if the Show Templates screen option is enabled // and `post_type` is not already set. if ( ! isset( $args['post_type'] ) && wpforms()->obj( 'forms_overview' )->overview_show_form_templates() ) { $args['post_type'] = wpforms()->obj( 'form' )::POST_TYPES; } return $args; } /** * Add user templates to the form templates list. * * @since 1.8.8 * * @param array $templates Form templates. * * @return array Form templates. */ public function add_form_templates( array $templates ): array { $user_templates = wpforms()->obj( 'form' )->get( '', [ 'post_type' => 'wpforms-template' ] ); if ( empty( $user_templates ) ) { return $templates; } foreach ( $user_templates as $template ) { $template_data = wpforms_decode( $template->post_content ); $edit_url = add_query_arg( [ 'page' => 'wpforms-builder', 'form_id' => $template->ID, ], admin_url( 'admin.php' ) ); $create_url = add_query_arg( [ 'page' => 'wpforms-builder', 'form_id' => $template->ID, 'action' => 'template_to_form', '_wpnonce' => wp_create_nonce( 'wpforms_template_to_form_form_nonce' ), ], admin_url( 'admin.php' ) ); $templates[] = [ 'name' => $template->post_title, 'slug' => 'wpforms-user-template-' . $template->ID, 'action_text' => wpforms_is_admin_page( 'builder' ) || wp_doing_ajax() ? esc_html__( 'Use Template', 'wpforms-lite' ) : esc_html__( 'Create Form', 'wpforms-lite' ), 'edit_action_text' => esc_html__( 'Edit Template', 'wpforms-lite' ), 'description' => ! empty( $template_data['settings']['template_description'] ) ? $template_data['settings']['template_description'] : '', 'source' => 'wpforms-user-template', 'create_url' => $create_url, 'edit_url' => $edit_url, 'categories' => [ 'user' ], 'has_access' => true, 'data' => $template_data, 'post_id' => $template->ID, ]; } return $templates; } /** * AJAX handler for removing user templates. * * @since 1.8.8 */ public function ajax_remove_user_template() { if ( ! check_ajax_referer( 'wpforms-form-templates', 'nonce', false ) ) { wp_send_json_error(); } if ( ! isset( $_POST['template'] ) ) { wp_send_json_error(); } wp_delete_post( absint( $_POST['template'] ), true ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended wp_send_json_success(); } /** * Add purge entry task. * * @since 1.8.8 * * @param array $tasks Task class list. */ public function add_purge_entry_task( $tasks ) { $tasks[] = PurgeTemplateEntryTask::class; return $tasks; } /** * Modify the form data before it is processed to disable payment processing. * * @since 1.8.8 * * @param array $form_data Form data. * * @return array */ public function process_before_form_data( $form_data ) { if ( ! isset( $form_data['id'] ) ) { return $form_data; } if ( wpforms_is_form_template( $form_data['id'] ) ) { $form_data['payments'] = []; } return $form_data; } /** * Disable Lite Connect integration for user templates while processing submission. * * @since 1.8.8 * * @param array $fields Form fields. * @param array $entry Form entry. * @param array $form_data Form data. */ public function process_entry( array $fields, array $entry, array $form_data ) { // phpcs:ignore WPForms.PHP.HooksMethod.InvalidPlaceForAddingHooks if ( ! wpforms_is_form_template( $form_data['id'] ) ) { return; } add_filter( 'wpforms_integrations_lite_connect_is_allowed', '__return_false' ); } }
It looks like nothing was found at this location. Maybe try one of the links below or a search?