• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
WPForms Views

WPForms Views

Display WPForms entries on your website

  • Features
  • Pricing
  • Demo
  • Blog
  • Account
Contact Us

Views for WPForms Documentation

Documentation and Tutorials for WPForms Views

Code Examples

# Add custom class name to View Table

<?php 

add_filter( 'wpforms_view_table_classes',  'wpf_add_custom_table_classname', 10, 3 );


function wpf_add_custom_table_classname ( $classnames, $view_id, $view_settings ) {

if( $view_id == 'VIEW-ID'){  //  Update VIEW-ID with your View ID
   $classnames .= ' custom-classname';   //  Update your Classname here
}

return $classnames;

}

# Hide characters from field value in View

<?php
//  Update FIELD-TYPE with your field type e.g name, email, phone etc

add_filter( "wpf-views/FIELD-TYPE-value", 'wh_update_field_display_value', 8, 5 );


function wh_update_field_display_value( $field_value, $_view_field_id, $entry, $_view_settings, $view_Obj ) {
	$view_id = $view_Obj->view_id;
	$_view_field = $_view_settings->fields->{$_view_field_id};
	$form_field_id = $_view_field->formFieldId;


//  Update VIEW-ID with your View ID
//  Update FORM-FIELD-ID with your Field ID

	if ( $view_id == 'VIEW-ID' && $form_field_id == 'FORM-FIELD-ID' ) { 

		if ( ! empty( $field_value ) ) {
           // This adds xxxxx after first 3 characters in field value
			$field_value = substr( $field_value, 0, 3 ) . 'xxxxx';
		}
	}

	return $field_value;
}

# Prefill search Field in View

<?php
add_filter( 'wpf_views_search_field_value', 'wh_views_search_field_value', 10, 4 );

function wh_views_search_field_value(  $value, $search_field, $_view_settings, $view_Obj ) {
	$view_id = $view_Obj->view_id;
	$field_id = $search_field->fieldId;

    //  Update VIEW-ID with your View ID
    //  Update FIELD-ID with your Field ID

	if ( $view_id  === 'VIEW-ID' && $field_id === 'FIELD-ID' ) {

		$value = get_user_meta(get_current_user_id(), 'gender', true);
	}
	return $value;
}

Primary Sidebar

Topics

  • Getting Started
  • Filter & Sort
  • Edit Entries
  • Inline Edit
  • Approve Entries
  • Single Entry
  • Delete Entries
  • Hooks & Filters

Footer

Views for WPForms

Drag & Drop View builder for WPForms.

We build scalable, intelligent and professional web apps to simplify lives of different businesses and people since 2010.

Sitemap

  • Home
  • Features
  • Pricing
  • Blog
  • Documentation
  • Changelog

Company

  • Login
  • FAQs
  • Terms & Conditions
  • Contact Us

Newsletter

Get the latest news, events and announcements straight to your inbox.

  • Facebook
  • Twitter
  • YouTube

Copyright © 2023 WPForms Views. All rights reserved. Return to top