Ends in
00Days
00Hours
00Mins
00Secs
Save up to 50%

PrivateContent Plugin

API Documentation

Hooks - Actions

pc_addons_menu_ready

action#

Fired in main_includes/admin_menu.php

Fires once the "PvtCont Add-ons" admin menu has been created: use it to add add-on submenus.

Parameters

ParameterDescription
1(string) $menu_slugparent menu slug (pc_addons)

Example

add_action('pc_addons_menu_ready', function($menu_slug) {
	add_submenu_page($menu_slug, 'My Add-on', 'My Add-on', 'manage_options', 'my_addon', 'my_addon_page_code');
});

pc_bulk_cat_assign_done

action#

Fired in main_includes/admin_ajax.php

Fires when categories have been assigned to multiple users through the users list bulk action.

Parameters

ParameterDescription
1(array) $usersinvolved user IDs

Example

// clear a custom cache for involved users
add_action('pc_bulk_cat_assign_done', function($users) {
	foreach((array)$users as $user_id) {
		delete_transient('my_user_cache_'. (int)$user_id);
	}
});

pc_csv_export_form

action#

Fired in users_import_export/csv_export.php

Adds fields into the CSV/Excel export form. Code must comply with the existing table structure. Validate added fields through pc_csv_export_form_validation.

Parameters

ParameterDescription
1(array) $fdatasubmitted form data

Example

add_action('pc_csv_export_form', function($fdata) {
	$val = (isset($fdata['my_exp_field'])) ? $fdata['my_exp_field'] : '';
	?>
	<tr>
		<td class="pc_label_td">Field label</td>
		<td class="pc_field_td">
			<input type="text" name="my_exp_field" value="<?php echo esc_attr($val) ?>" autocomplete="off" />
		</td>
	</tr>
	<?php
});

pc_csv_import_form_fields

action#

Fired in users_import_export/csv_import.php

Adds fields into the CSV import form. Code must comply with the existing table structure. Submitted values can be read from $_POST in the import hooks.

Parameters

No parameters

Example

add_action('pc_csv_import_form_fields', function() {
	?>
	<tr>
		<td class="pc_label_td">Imported users source</td>
		<td class="pc_field_td">
			<input type="text" name="my_import_source" value="" autocomplete="off" />
		</td>
	</tr>
	<?php
});

// then read it in import hooks: sanitize_text_field(wp_unslash($_POST['my_import_source']))

pc_csv_import_new_user

action#

Fired in classes/users_import_export.php

Fires for each user created through a CSV import.

Parameters

ParameterDescription
1(int) $user_idnew user ID
2(string) $pswuser password in plain text (eventually auto-generated): useful to send credentials, never store or log it
3(object) $classpvtcont_users_import_export class instance. Import form data can be read from $_POST

Example

// send credentials to imported users
add_action('pc_csv_import_new_user', function($user_id, $psw, $class) {
	global $pc_users;
	$user = $pc_users->get_user($user_id, array('to_get' => array('username', 'email')));

	if(!empty($user['email'])) {
		wp_mail($user['email'], 'Your account', 'Username: '. $user['username'] ."\nPassword: ". $psw);
	}
}, 10, 3);

pc_csv_update_overridden_user

action#

Fired in classes/users_import_export.php

Fires for each existing user updated through a CSV update.

Parameters

ParameterDescription
1(int) $user_idupdated user ID
2(array) $dataupdated data (field ID => value)
3(object) $classpvtcont_users_import_export class instance. Form data can be read from $_POST

Example

// log updated fields
add_action('pc_csv_update_overridden_user', function($user_id, $data, $class) {
	error_log('User '. (int)$user_id .' updated through CSV: '. implode(', ', array_keys($data)));
}, 10, 3);

pc_custom_style_css

action#

Fired in main_includes/custom_style.php

Prints CSS code into the custom style file, created when settings are saved.

Parameters

No parameters

Example

// force forms to have a thick border
add_action('pc_custom_style_css', function() {
	?>
	.pc_registration_form,
	.pc_login_form {
		border: 7px solid #aaa !important;
	}
	<?php
});

The file is regenerated only when settings are saved. Add-ons can force its regeneration on version change through the pc_dynamic_css_versioning filter (associative array: add-on slug => version).

pc_deleted_user

action#

Fired in classes/users_manag.php

Fires after the user record has been deleted. Its meta data and private page are deleted right after this action: they can still be read through direct queries, but the user can't be retrieved through the class methods anymore.

Parameters

ParameterDescription
1(int) $user_iddeleted user ID

Example

// remove data stored by your add-on in its own table
add_action('pc_deleted_user', function($user_id) {
	global $wpdb;
	$wpdb->delete($wpdb->prefix .'my_addon_data', array('user_id' => (int)$user_id), array('%d'));
});

pc_pre_self_user_del

action#

Fired in main_includes/front_ajax.php

Fires right before a user deletes its own account, through the user deletion box.

Parameters

ParameterDescription
1(int) $user_iduser ID

Example

// notify the site owner when a user deletes its account
add_action('pc_pre_self_user_del', function($user_id) {
	global $pc_users;
	$username = $pc_users->get_user_field($user_id, 'username');

	wp_mail(get_option('admin_email'), 'Account deleted', 'User "'. $username .'" deleted its account');
});

pc_pre_user_delete

action#

Fired in classes/users_manag.php

Fires before a user is deleted through delete_user(). Data, meta and synced WordPress user are still reachable.

Parameters

ParameterDescription
1(int) $user_idID of the user being deleted

Example

// goodbye e-mail
add_action('pc_pre_user_delete', function($user_id) {
	global $pc_users;
	$email = $pc_users->get_user_field($user_id, 'email');

	if(!empty($email)) {
		wp_mail($email, 'Goodbye', 'Your account has been deleted');
	}
});

pc_pre_user_login_checks

action#

Fired in main_includes/public_api.php

Fires at the beginning of pc_login(), before credentials are checked.

Parameters

ParameterDescription
1(string) $usernamesubmitted username (or e-mail)
2(string) $pswsubmitted password, in plain text: never store or log it

Example

// log login attempts (never the password)
add_action('pc_pre_user_login_checks', function($username, $psw) {
	error_log('PrivateContent login attempt for: '. sanitize_user($username));
}, 10, 2);

pc_pre_user_session_check

action#

Fired in main_includes/user_auth.php

Fires right before PrivateContent checks the user session/cookies and sets $GLOBALS['pc_user_id'].

Parameters

No parameters

Example

// force a custom cookie domain before the session check
add_action('pc_pre_user_session_check', function() {
	if(!defined('MY_SESSION_CHECK_STARTED')) {
		define('MY_SESSION_CHECK_STARTED', microtime(true));
	}
});

pc_pre_user_update

action#

Fired in classes/users_manag.php

Fires right before user fixed data is updated in the database through update_user(). Not triggered if only meta data is updated.

Parameters

ParameterDescription
1(int) $user_iduser ID
2(array) $query_arrdata being saved (column => value). The password is already hashed

Example

// keep a copy of the previous e-mail when it is going to change
add_action('pc_pre_user_update', function($user_id, $query_arr) {
	if(!isset($query_arr['email'])) {
		return;
	}

	global $pc_users, $pc_meta;
	$old_email = $pc_users->get_user_field($user_id, 'email');

	if($old_email != $query_arr['email']) {
		$pc_meta->update_meta($user_id, 'my_previous_email', $old_email);
	}
}, 10, 2);

pc_pvt_page_comments_template

action#

Fired in main_includes/user_pvt_page.php

Gives the opportunity to override the comments template used in users private pages (when comments are enabled for WP-synced users). The callback must return the template file path.

Parameters

No parameters

Return values

TypeDescription
(string)comments template file path

Example

add_filter('pc_pvt_page_comments_template', function() {
	return get_stylesheet_directory() .'/pvt-page-comments.php';
});

The returned path is used only by PrivateContent versions firing this hook through apply_filters(): older versions fire it through do_action(), ignoring returned values.

pc_pvt_page_display

action#

Fired in main_includes/user_pvt_page.php

Fires when a user private page is being displayed (triggered in the the_content filter).

Parameters

No parameters

Example

// count private page visits
add_action('pc_pvt_page_display', function() {
	$user_id = pc_user_logged('id');

	if($user_id) {
		global $pc_meta;
		$pc_meta->update_meta($user_id, 'my_pvt_page_visits', (int)$pc_meta->get_meta($user_id, 'my_pvt_page_visits') + 1);
	}
});

pc_pvtc_export_form

action#

Fired in users_import_export/pvtc_export.php

Adds fields into the PrivateContent-to-PrivateContent (JSON) export form. Code must comply with the existing table structure. Validate added fields through pc_pvtc_export_form_validation.

Parameters

No parameters

Example

add_action('pc_pvtc_export_form', function() {
	?>
	<tr>
		<td class="pc_label_td">Export my add-on data?</td>
		<td class="pc_field_td">
			<input type="checkbox" name="my_addon_export" value="1" />
		</td>
	</tr>
	<?php
});

pc_pvtc_import_form_fields

action#

Fired in users_import_export/pvtc_import.php

Adds fields into the PrivateContent-to-PrivateContent (JSON) import form. Code must comply with the existing table structure.

Parameters

No parameters

Example

add_action('pc_pvtc_import_form_fields', function() {
	?>
	<tr>
		<td class="pc_label_td">Import my add-on data?</td>
		<td class="pc_field_td">
			<input type="checkbox" name="my_addon_import" value="1" />
		</td>
	</tr>
	<?php
});

pc_pvtc_import_new_user

action#

Fired in classes/users_import_export.php

Fires for each user created through a PrivateContent-to-PrivateContent (JSON) import.

Parameters

ParameterDescription
1(int) $user_idnew user ID
2(array) $udataimported user data, as stored in the JSON file (meta included)
3(array) $new_catsuser category IDs assigned to the user (categories of this website, as mapped in the import form)
4(object) $classpvtcont_users_import_export class instance. Form data can be read from $_POST

Example

// restore add-on data stored in the JSON file
add_action('pc_pvtc_import_new_user', function($user_id, $udata, $new_cats, $class) {
	if(!empty($_POST['my_addon_import']) && isset($udata['metas']['my_plan'])) {
		global $pc_meta;
		$pc_meta->update_meta($user_id, 'my_plan', sanitize_text_field($udata['metas']['my_plan']));
	}
}, 10, 4);

pc_pvtc_import_overridden_user

action#

Fired in classes/users_import_export.php

Fires for each existing user overridden through a PrivateContent-to-PrivateContent (JSON) import.

Parameters

ParameterDescription
1(int) $user_idexisting user ID
2(array) $udataimported user data, as stored in the JSON file
3(array) $new_catsuser category IDs assigned to the user (categories of this website, as mapped in the import form)
4(array) $fdataimport form data
5(object) $classpvtcont_users_import_export class instance

Example

add_action('pc_pvtc_import_overridden_user', function($user_id, $udata, $new_cats, $fdata, $class) {
	global $pc_meta;
	$pc_meta->update_meta($user_id, 'my_last_import', current_time('mysql'));
}, 10, 5);

pc_qe_restr_wiz_in_list_updated

action#

Fired in classes/restrictions_wizard.php

Fires when a post or term restrictions are saved (restrictions wizard or quick editor in lists).

Parameters

ParameterDescription
1(string) $subj_typepost or term
2(int) $subj_idpost or term ID
3(array) $restrictionssaved restrictions

Example

// clear a page cache when restrictions change
add_action('pc_qe_restr_wiz_in_list_updated', function($subj_type, $subj_id, $restrictions) {
	if($subj_type == 'post') {
		clean_post_cache($subj_id);
	}
}, 10, 3);

pc_registered_user

action#

Fired in main_includes/front_ajax.php

Fires when a user successfully registers through a registration form, before the eventual auto-login.

Parameters

ParameterDescription
1(int) $user_idnew user ID
2(int) $statusnew user status (1 = enabled, 3 = pending)
3(int) $form_idregistration form ID
4(array) $fdatavalidated form data (field ID => value), as returned by the form framework. It contains the plain password (psw index): never store or log it

Example

// add a meta value to users registered through form #150
add_action('pc_registered_user', function($user_id, $status, $form_id, $fdata) {
	if($form_id == 150) {
		global $pc_meta;
		$pc_meta->add_meta($user_id, 'registered_through', 'landing page');
	}
}, 10, 4);

To abort the registration with an error message, use the pc_after_user_registr_error filter.

pc_restricted_comment_is_shown

action#

Fired in restrictions/comments_restriction.php

Fires when the restricted comments block is shown to a user.

Parameters

No parameters

Example

// enqueue a script only when the restricted comments block is shown
add_action('pc_restricted_comment_is_shown', function() {
	wp_enqueue_script('my-comments-lock', get_stylesheet_directory_uri() .'/js/comments-lock.js', array(), '1.0', true);
});

pc_session_token_created

action#

Fired in classes/pc_sessions_token.php

Fires when a new session token is created for a user (session tokens are used if the "single session" option is enabled in settings).

Parameters

ParameterDescription
1(int) $user_iduser ID
2(string) $tokennew session token. Treat it as a secret: never print or log it

Example

// keep track of how many sessions a user started
add_action('pc_session_token_created', function($user_id, $token) {
	global $pc_meta;
	$count = (int)$pc_meta->get_meta($user_id, 'my_sessions_count');

	$pc_meta->update_meta($user_id, 'my_sessions_count', $count + 1);
}, 10, 2);

pc_settings_extra_code

action#

Fired in settings/view.php

Prints extra code (eg. javascript or CSS) at the bottom of the settings page.

Parameters

No parameters

Example

add_action('pc_settings_extra_code', function() {
	?>
	<script type="text/javascript">
	(function() {
		// custom settings page behaviors
	})();
	</script>
	<?php
});

pc_user_activated

action#

Fired in classes/users_manag.php

Fires when a pending user is enabled through change_status(). Triggered right before the database change.

Parameters

ParameterDescription
1(int) $user_idactivated user ID

Example

add_action('pc_user_activated', function($user_id) {
	global $pc_users;
	$email = $pc_users->get_user_field($user_id, 'email');

	if(!empty($email)) {
		wp_mail($email, 'Account activated', 'You can now log in');
	}
});

pc_user_added

action#

Fired in classes/users_manag.php

Fires whenever a user is added to the database (registration, admin panel, import, API), through insert_user(). Data and meta are already saved.

Parameters

ParameterDescription
1(int) $user_idnew user ID

Example

// welcome e-mail
add_action('pc_user_added', function($user_id) {
	global $pc_users;
	$email = $pc_users->get_user_field($user_id, 'email');

	if(!empty($email)) {
		wp_mail($email, 'Welcome!', 'Thanks for joining us');
	}
});

pc_user_added_by_admin

action#

Fired in user_dashboard/ajax.php

Fires when a user has been successfully added through the admin panel (user dashboard).

Parameters

ParameterDescription
1(int) $user_idnew user ID

Example

// notify the site owner
add_action('pc_user_added_by_admin', function($user_id) {
	global $pc_users;
	$username = $pc_users->get_user_field($user_id, 'username');

	wp_mail(get_option('admin_email'), 'New user created', 'User "'. $username .'" has been created by '. wp_get_current_user()->user_login);
});

pc_user_created_from_wp

action#

Fired in classes/wp_user_sync.php

Fires when a user is created starting from an existing WordPress user (admin side sync, bulk WP-to-PrivateContent sync, pc_user_from_wp() method).

Parameters

ParameterDescription
1(int) $user_idnew PrivateContent user ID
2(int) $wp_user_idWordPress user ID

Example

// copy a WP user meta into the new PrivateContent user
add_action('pc_user_created_from_wp', function($user_id, $wp_user_id) {
	global $pc_meta;
	$pc_meta->update_meta($user_id, 'my_company', get_user_meta($wp_user_id, 'billing_company', true));
}, 10, 2);

pc_user_created_from_wp_register

action#

Fired in main_includes/wp_user_tricks.php

Fires when a user is automatically created from a WordPress user registered on the website frontend (option set in settings). During the action, $GLOBALS['pc_user_id'] contains the new user ID.

Parameters

ParameterDescription
1(int) $user_idnew PrivateContent user ID
2(int) $wp_user_idWordPress user ID

Example

// mark users coming from the WP registration
add_action('pc_user_created_from_wp_register', function($user_id, $wp_user_id) {
	global $pc_meta;
	$pc_meta->add_meta($user_id, 'registered_through', 'wp_registration');
}, 10, 2);

pc_user_dashboard_extra_code

action#

Fired in user_dashboard/view.php

Prints extra code (eg. javascript or CSS) at the bottom of the user dashboard page.

Parameters

No parameters

Example

add_action('pc_user_dashboard_extra_code', function() {
	?>
	<style type="text/css">
	.my_addon_dashboard_section textarea {
		min-height: 120px;
	}
	</style>
	<?php
});

pc_user_dashboard_save

action#

Fired in user_dashboard/ajax.php

Fires when the user dashboard form is submitted in the admin panel, once the user has been saved. Use it to save custom dashboard data: registered PrivateContent fields are already saved.

Parameters

ParameterDescription
1(array) $fdatavalidated form data (only registered fields). Other fields can be read from $_POST
2(int) $user_iduser ID
3(bool) $is_new_usertrue if the user has just been created

Example

add_action('pc_user_dashboard_save', function($fdata, $user_id, $is_new_user) {
	if(isset($_POST['my_admin_note'])) {
		global $pc_meta;
		$pc_meta->update_meta($user_id, 'my_admin_note', sanitize_textarea_field(wp_unslash($_POST['my_admin_note'])));
	}
}, 10, 3);

The dashboard request has already been checked by PrivateContent (nonce and capabilities). Always sanitize extra values read from $_POST.

pc_user_detached_from_wp

action#

Fired in classes/wp_user_sync.php

Fires when a user is detached from its WordPress mirror. Triggered right before the WordPress user deletion.

Parameters

ParameterDescription
1(int) $user_idPrivateContent user ID
2(int) $wp_user_idWordPress user ID

Example

// move WP posts of the user to the admin before its WP mirror is deleted
add_action('pc_user_detached_from_wp', function($user_id, $wp_user_id) {
	global $wpdb;
	$wpdb->update($wpdb->posts, array('post_author' => 1), array('post_author' => (int)$wp_user_id), array('%d'), array('%d'));
}, 10, 2);

pc_user_login

action#

Fired in main_includes/public_api.php, main_includes/wp_user_tricks.php

Fires when a user logs in, through PrivateContent or through the WordPress login of its synced user.

Parameters

ParameterDescription
1(int) $user_iduser ID
2(bool) $remember_mewhether the "remember me" option has been used

Example

add_action('pc_user_login', function($user_id, $remember_me) {
	global $pc_meta;
	$pc_meta->update_meta($user_id, 'my_logins_count', (int)$pc_meta->get_meta($user_id, 'my_logins_count') + 1);
}, 10, 2);

pc_user_logout

action#

Fired in main_includes/public_api.php

Fires when a user logs out.

Parameters

ParameterDescription
1(int) $user_iduser ID

Example

// store the last logout date
add_action('pc_user_logout', function($user_id) {
	global $pc_meta;
	$pc_meta->update_meta($user_id, 'my_last_logout', current_time('mysql'));
});

pc_user_made_woo_order

action#

Fired in main_includes/wp_user_tricks.php

Fires when a WooCommerce order made by a WP-synced user gets the "completed" status.

Parameters

ParameterDescription
1(array) $product_idspurchased product IDs
2(WC_Order) $orderthe order object
3(int) $user_idPrivateContent user ID

Example

// assign category #4 to users buying product #120
add_action('pc_user_made_woo_order', function($product_ids, $order, $user_id) {
	if(!in_array(120, $product_ids)) {
		return;
	}

	global $pc_users;
	$cats = (array)$pc_users->get_user_field($user_id, 'categories');

	if(!in_array(4, $cats)) {
		$cats[] = 4;
		$pc_users->update_user($user_id, array('categories' => $cats));
	}
}, 10, 3);

pc_user_meta_added

action#

Fired in classes/meta_manag.php

Fires whenever a user meta is added to the database.

Parameters

ParameterDescription
1(int) $user_iduser ID
2(string) $meta_keymeta key
3(string) $meta_valsaved value (serialized, for arrays and objects)

Example

// log when a specific meta is created
add_action('pc_user_meta_added', function($user_id, $meta_key, $meta_val) {
	if($meta_key == 'my_plan') {
		error_log('User '. (int)$user_id .' got a plan: '. maybe_unserialize($meta_val));
	}
}, 10, 3);

pc_user_meta_deleted

action#

Fired in classes/meta_manag.php

Fires whenever a user meta is deleted from the database.

Parameters

ParameterDescription
1(int) $user_iduser ID
2(string) $meta_keymeta key

Example

// clear a custom cache when a meta is removed
add_action('pc_user_meta_deleted', function($user_id, $meta_key) {
	if($meta_key == 'my_plan') {
		delete_transient('my_plan_cache_'. (int)$user_id);
	}
}, 10, 2);

pc_user_meta_updated

action#

Fired in classes/meta_manag.php

Fires whenever a user meta value is changed in the database. Not triggered if the new value equals the existing one.

Parameters

ParameterDescription
1(int) $user_iduser ID
2(string) $meta_keymeta key
3(string) $meta_valsaved value (serialized, for arrays and objects)

Example

add_action('pc_user_meta_updated', function($user_id, $meta_key, $meta_val) {
	if($meta_key == 'my_plan') {
		$plan = maybe_unserialize($meta_val);
		// ...
	}
}, 10, 3);

pc_user_session_checked

action#

Fired in main_includes/user_auth.php

Fires right after the user session/cookies check: the safest moment to perform operations involving the logged user.

Parameters

ParameterDescription
1(int|false) $user_idlogged user ID or false

Example

add_action('pc_user_session_checked', function($user_id) {
	if($user_id) {
		// a user is logged
	}
});

pc_user_staus_changed

action#

Fired in classes/users_manag.php

Fires when a user status is changed through change_status(). The hook name contains a typo, kept for backward compatibility.

Parameters

ParameterDescription
1(int) $user_iduser ID
2(int) $new_statusnew status: 1 = enabled, 2 = disabled

Example

// e-mail disabled users
add_action('pc_user_staus_changed', function($user_id, $new_status) {
	if($new_status != 2) {
		return;
	}

	global $pc_users;
	$email = $pc_users->get_user_field($user_id, 'email');

	if(!empty($email)) {
		wp_mail($email, 'Account disabled', 'Your account has been disabled');
	}
}, 10, 2);

pc_user_synced_with_wp

action#

Fired in classes/wp_user_sync.php

Fires when a user is synced with a new WordPress mirror user.

Parameters

ParameterDescription
1(string) $usernameuser username (not the ID)
2(int) $wp_user_idWordPress user ID

Example

add_action('pc_user_synced_with_wp', function($username, $wp_user_id) {
	global $pc_users;
	$user_id = $pc_users->username_to_id($username);
	// ...
}, 10, 2);

pc_user_updated

action#

Fired in classes/users_manag.php

Fires when a user is updated (any field, meta or status change).

Parameters

ParameterDescription
1(int) $user_iduser ID

Example

// notify the user when data is changed by someone else
add_action('pc_user_updated', function($user_id) {
	if(pc_user_logged('id') == $user_id) {
		return;
	}

	global $pc_users;
	$email = $pc_users->get_user_field($user_id, 'email');

	if(!empty($email)) {
		wp_mail($email, 'Account updated', 'Your account data has been updated');
	}
});

pc_user_updated_by_admin

action#

Fired in user_dashboard/ajax.php

Fires when a user has been successfully updated through the admin panel (user dashboard).

Parameters

ParameterDescription
1(int) $user_iduser ID

Example

// store who edited the user last
add_action('pc_user_updated_by_admin', function($user_id) {
	global $pc_meta;
	$pc_meta->update_meta($user_id, 'my_last_admin_editor', get_current_user_id());
});

pvtcont_init

action#

Fired in private_content.php, main_includes/public_api.php

Fires once PrivateContent elements are loaded (on wp_loaded, priority 1, or earlier if needed). Use it instead of init or wp_loaded to write code involving PrivateContent elements.

At its priority 1 the logged user is identified: use a higher priority to have $GLOBALS['pc_user_id'] available.

Parameters

No parameters

Example

add_action('pvtcont_init', function() {
	if(pc_user_logged(false)) {
		// ...
	}
}, 10);

wp_to_pc_bulk_sync_form_fields

action#

Fired in users_import_export/wp_import.php

Adds fields to the WordPress-to-PrivateContent bulk sync form. Code must comply with the existing table structure.

Parameters

No parameters

Example

add_action('wp_to_pc_bulk_sync_form_fields', function() {
	?>
	<tr>
		<td class="pc_label_td">Note for synced users</td>
		<td class="pc_field_td">
			<input type="text" name="my_bulk_note" value="" autocomplete="off" />
		</td>
	</tr>
	<?php
});

wp_to_pc_bulk_synced_user

action#

Fired in main_includes/admin_ajax.php

Fires for each user created through the WordPress-to-PrivateContent bulk sync tool. Extra fields added through wp_to_pc_bulk_sync_form_fields can be read from $_POST.

Parameters

ParameterDescription
1(int) $user_idnew PrivateContent user ID

Example

// save the extra field added through wp_to_pc_bulk_sync_form_fields
add_action('wp_to_pc_bulk_synced_user', function($user_id) {
	if(isset($_POST['my_bulk_note'])) {
		global $pc_meta;
		$pc_meta->add_meta($user_id, 'my_bulk_note', sanitize_text_field(wp_unslash($_POST['my_bulk_note'])));
	}
});

Let's get in touch!

Features list