GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
Public Member Functions | Protected Attributes | Private Attributes
GravityView_Edit_Entry_User_Registration Class Reference

GravityView Edit Entry - Sync User Registration (when using the GF User Registration Add-on) More...

Public Member Functions

 __construct (GravityView_Edit_Entry $loader)
 
 add_hooks ()
 Add hooks to trigger updating the user. More...
 
 generate_display_names ( $profileuser)
 Generate an array of all the user display names possibilities. More...
 
 get_feed_configuration ( $entry, $form)
 Get the User Registration feed configuration for the entry & form. More...
 
 load ()
 
 match_current_display_name ( $user_id)
 Calculate the user display name format. More...
 
 restore_display_name ( $user_id=0, $config=array(), $entry=array(), $password='')
 Restore the Display Name and roles of a user after being updated by Gravity Forms User Registration Addon. More...
 
 update_user ( $form=array(), $entry_id=0)
 Update the WordPress user profile based on the GF User Registration create feed. More...
 

Protected Attributes

 $loader
 

Private Attributes

 $_user_before_update = null
 

Detailed Description

GravityView Edit Entry - Sync User Registration (when using the GF User Registration Add-on)

Definition at line 20 of file class-edit-entry-user-registration.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( GravityView_Edit_Entry  $loader)

Definition at line 32 of file class-edit-entry-user-registration.php.

References $loader.

Member Function Documentation

◆ add_hooks()

add_hooks ( )

Add hooks to trigger updating the user.

Since
1.18
Runs Filter:
gravityview/edit_entry/user_registration/trigger_update Choose whether to update user information via User Registration add-on when an entry is updated?
Since
1.11
Parameters
boolean$booleanWhether to trigger update on user registration (default: true)

Definition at line 48 of file class-edit-entry-user-registration.php.

◆ generate_display_names()

generate_display_names (   $profileuser)

Generate an array of all the user display names possibilities.

Since
1.15
Parameters
object$profileuserWP_User object
Returns
array List all the possible display names for a certain User object

Definition at line 229 of file class-edit-entry-user-registration.php.

Referenced by match_current_display_name().

◆ get_feed_configuration()

get_feed_configuration (   $entry,
  $form 
)

Get the User Registration feed configuration for the entry & form.

GF_User_Registration::get_single_submission_feed GravityView_Edit_Entry_User_Registration::match_current_display_name

Since
1.20
Parameters
$entry
$form
Returns
array
Runs Filter:
gravityview/edit_entry/user_registration/preserve_role Keep the current user role or override with the role defined in the Create feed
Since
1.15
Parameters
boolean$preserve_rolePreserve current user role Default: true
array$configGravity Forms User Registration feed configuration for the form
array$formGravity Forms form array
array$entryGravity Forms entry being edited

Make sure the current display name is not changed with the update user method.

Since
1.15
Runs Filter:
gravityview/edit_entry/user_registration/config Modify the User Registration Addon feed configuration
Since
1.14
Parameters
array$configGravity Forms User Registration feed configuration for the form
array$formGravity Forms form array
array$entryGravity Forms entry being edited

Definition at line 149 of file class-edit-entry-user-registration.php.

References $entry, GV\$form, and match_current_display_name().

Referenced by update_user().

◆ load()

load ( )
Since
1.11

Definition at line 39 of file class-edit-entry-user-registration.php.

◆ match_current_display_name()

match_current_display_name (   $user_id)

Calculate the user display name format.

Since
1.15
1.20 Returns false if user not found at $user_id
Parameters
int$user_idWP User ID
Returns
false|string Display name format as used inside Gravity Forms User Registration. Returns false if user not found.

In case we can't find the current display name format, trigger last resort method at the 'gform_user_updated' hook

See also
restore_display_name

Definition at line 198 of file class-edit-entry-user-registration.php.

References $format, $user, and generate_display_names().

Referenced by get_feed_configuration().

◆ restore_display_name()

restore_display_name (   $user_id = 0,
  $config = array(),
  $entry = array(),
  $password = '' 
)

Restore the Display Name and roles of a user after being updated by Gravity Forms User Registration Addon.

See also
GFUser::update_user()
Parameters
int$user_idWP User ID that was updated by Gravity Forms User Registration Addon
array$configGravity Forms User Registration Addon form feed configuration
array$entryThe Gravity Forms entry that was just updated
string$passwordUser password
Returns
int|false|WP_Error|null True: User updated; False: $user_id not a valid User ID; WP_Error: User update error; Null: Method didn't process
Runs Filter:
gravityview/edit_entry/restore_display_name Whether display names should be restored to before updating an entry. Otherwise, display names will be reset to the format specified in Gravity Forms User Registration "Update" feed
Since
1.14.4
Parameters
boolean$restore_display_nameRestore Display Name? Default: true

Don't restore display name:

  • either disabled,
  • or it is an Update feed (we only care about Create feed)
  • or we don't need as we found the correct format before updating user.
    Since
    1.14.4
    Modify the user data after updated by Gravity Forms User Registration but before restored by GravityView
    Since
    1.14
    Parameters
    WP_User$restored_userThe user with restored details about to be updated by wp_update_user()
    WP_User$user_before_updateThe user before being updated by Gravity Forms User Registration
    WP_User$user_after_updateThe user after being updated by Gravity Forms User Registration
    array$entryThe Gravity Forms entry that was just updated

Definition at line 265 of file class-edit-entry-user-registration.php.

References $entry, Utils\get(), and gravityview().

◆ update_user()

update_user (   $form = array(),
  $entry_id = 0 
)

Update the WordPress user profile based on the GF User Registration create feed.

Since
1.11
Parameters
array$formGravity Forms form array
string$entry_idGravity Forms entry ID
Returns
void
Runs Filter:
gravityview/edit_entry/user_registration/entry Modify entry details before updating the user via User Registration add-on
Since
1.11
Parameters
array$entryGravity Forms entry
array$formGravity Forms form

Definition at line 73 of file class-edit-entry-user-registration.php.

References $entry, GV\$form, Utils\get(), get_feed_configuration(), and gravityview().

Field Documentation

◆ $_user_before_update

$_user_before_update = null
private

Definition at line 30 of file class-edit-entry-user-registration.php.

◆ $loader

GravityView_Edit_Entry $loader
protected

Definition at line 25 of file class-edit-entry-user-registration.php.

Referenced by __construct().


The documentation for this class was generated from the following file: