20 var
$icon =
'dashicons-admin-users';
23 $this->label = esc_html__(
'Created By (User)',
'gk-gravityview' );
24 $this->
description = __(
'Details of the logged-in user who created the entry (if any).',
'gk-gravityview');
25 $this->default_search_label = __(
'Submitted by:',
'gk-gravityview' );
26 parent::__construct();
43 'label' => __(
'Entry Creator: Display Name',
'gk-gravityview'),
44 'tag' =>
'{created_by:display_name}' 47 'label' => __(
'Entry Creator: Email',
'gk-gravityview'),
48 'tag' =>
'{created_by:user_email}' 51 'label' => __(
'Entry Creator: Username',
'gk-gravityview'),
52 'tag' =>
'{created_by:user_login}' 55 'label' => __(
'Entry Creator: User ID',
'gk-gravityview'),
56 'tag' =>
'{created_by:ID}' 59 'label' => __(
'Entry Creator: Roles',
'gk-gravityview'),
60 'tag' =>
'{created_by:roles}' 87 if( empty( $matches ) || empty(
$entry[
'created_by'] ) ) {
92 $entry_creator =
new WP_User(
$entry[
'created_by'] );
94 foreach ( $matches as $match ) {
96 $full_tag = $match[0];
97 $property = $match[1];
101 $value = $entry_creator->ID;
105 $value = implode(
', ', $entry_creator->roles );
108 $value = $entry_creator->get( $property );
115 $text = str_replace( $full_tag,
$value, $text );
118 unset( $entry_creator );
125 if(
'edit' === $context ) {
126 return $field_options;
129 $field_options[
'name_display'] = array(
131 'label' => __(
'User Format',
'gk-gravityview' ),
132 'desc' => __(
'How should the User information be displayed?',
'gk-gravityview' ),
135 'ID' => __(
'User ID # (Example: 426)',
'gk-gravityview' ),
136 'user_login' => __(
'Username (Example: "nostromo")',
'gk-gravityview' ),
137 'display_name' => __(
'Display Name (Example: "Ellen Ripley")',
'gk-gravityview' ),
138 'user_email' => __(
'User Email (Example: "[email protected]")',
'gk-gravityview' ),
139 'user_registered' => __(
'User Registered (Example: "2019-10-18 08:30:11")',
'gk-gravityview' ),
142 'nickname' => ucwords( __(
'User nickname',
'gk-gravityview' ) ),
143 'description' => __(
'Description',
'gk-gravityview' ),
144 'first_name' => __(
'First Name',
'gk-gravityview' ),
145 'last_name' => __(
'Last Name',
'gk-gravityview' ),
148 'first_last_name' => __(
'First and Last Name',
'gk-gravityview' ),
149 'last_first_name' => __(
'Last and First Name',
'gk-gravityview' ),
151 'value' =>
'display_name' 154 return $field_options;
Modify field settings by extending this class.
replace_merge_tag( $matches=array(), $text='', $form=array(), $entry=array(), $url_encode=false, $esc_html=false)
Exactly like Gravity Forms' User Meta functionality, but instead shows information on the user who cr...
field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id)
if(gravityview() ->plugin->is_GF_25()) $form
new GravityView_Field_Created_By
scale description p description
custom_merge_tags( $form=array(), $fields=array())
Add custom merge tags to merge tag options.
if(empty( $created_by)) $form_id
if(false !==strpos( $value, '00:00')) $field_id
string $field_id ID of the field being displayed