PrivateContent

API Documentation

Hooks - Actions

pc_custom_style_css

Add CSS code into custom CSS file

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

Perform actions after user deletion.
Its data and meta have alredy been deleted.

Parameters
  1. (int) user ID deleted
pc_import_form

Add fields into import form. Must comply with existing table code.

Usage
<?php
// add a dropdown 
function foo() {
	?>
	<tr>
	   <td class='pc_label_td'>Field label </td>
	   <td class='pc_field_td'>
		 
	   </td>
	   <td>Field description </td>
	</tr>
	<?php
}
add_action('pc_import_form', 'foo');
?>
pc_imported_users

Perform actions with imported users

Parameters
  1. (array) associative array (user_id => imported_data)
Usage
<?php
// send mail to imported users 
function foo($users) {
	foreach($users as $user_id => $data) {
		if(!empty($data['email'])) {
			
			wp_mail( ... ) // simplified code
		}
	}
}
add_action('pc_imported_users', 'foo');
?>
pc_pre_self_user_del

Perform an action right before a user self-deletes

Parameters
  1. (int) user ID
pc_pre_user_delete

Perform actions before user is deleted.
Data and metas are still reachable.

Parameters
  1. (int) user ID to be deleted
Usage
<?php
// send goodbye mail before deleting
function foo($user_id) {	
	// get mail
	global $pc_users;
	$email = $pc_users->get_user_field($user_id, 'email');
	
	if(!empty($email)) {
		wp_mail( ... ) // simplified code	
	}
}
add_action('pc_pre_user_delete', 'foo');
?>
pc_pre_user_update

Perform an action right before user is updated

Parameters
  1. (int) user ID
  2. (array) update query array
pc_pvt_page_comments_template

Give the opportunity to override comments template on users private page.
Must return a path to the new commenta template.

pc_pvt_page_display

Users private page is being displayed (triggered in the_content hook)

pc_registered_user

Perform an action when user successfully registers with a registration form.

Parameters
  1. (int) newly registered user ID
  2. (int) newly registered user status
Usage
<?php
// add a meta value for newly registered user
function foo($user_id, $status) {	
	global $pc_meta;
	$pc_meta->add_meta($user_id, 'meta_key', 'meta_val');
}
add_action('pc_registered_user', 'foo', 10, 2);
?>
pc_restricted_comment_is_show

Restricted comments block is shown to user

pc_settings_messages

Insert new customizable messages in settings.
Remember to add related validation indexes

Parameters
  1. (array) associative array containing settings data (option_key => value)
Usage
<?php
// add a new cusomizable message to be used in custom codes
function foo($fdata) {	
	$val = (isset($fdata['custom_mess'])) ? $fdata['custom_mess'] : ''; 
	?>
	

My custom message

custom message label

custom message description

<?php } add_action('pc_settings_messages', 'foo'); ?>
pc_settings_tabs_body

Add contents related to inserted custom tabs into settings panel.

Parameters
  1. (array) associative array containing settings data (option_key => value)
Usage
<?php
// add contents related to a new settings tab named 'test'
function foo($fdata) {	
	$val = (isset($fdata['pc_my_option'])) ? $fdata['pc_my_option'] : ''; 
	?>
	

My custom message

option label

custom option description

<?php } add_action('pc_settings_tabs_body', 'foo'); ?>
pc_settings_tabs_list

Add tabs into settings panel. Code must comply with jQuery tabs (see usage)

Usage
<?php
// add 'test' tab in settings
function foo() {	
	?>
	
  • My custom tab
  • <?php } add_action('pc_settings_tabs_list', 'foo'); ?>
    pc_tinymce_tabs_list

    Add tabs into shortcode wizard lightbox. Code must comply with jQuery tabs (see usage)

    Usage
    <?php
    // add 'test' tab in settings
    function foo() {	
    	?>
    	
  • My custom tab
  • <?php } add_action('pc_tinymce_tabs_list', 'foo'); ?>
    pc_user_activated

    Perform an action when pending user is enabled through change_status method.

    Parameters
    1. (int) activated user ID
    Usage
    <?php
    // contact user via mail during activation
    function foo($user_id) {	
    	// get mail
    	global $pc_users;
    	$email = $pc_users->get_user_field($user_id, 'email');
    	
    	if(!empty($email)) {
    		wp_mail( ... ) // simplified code	
    	}
    }
    add_action('pc_user_activated', 'foo');
    ?>
    
    pc_user_added

    Perform an action when user is added into database.

    Parameters
    1. (int) inserted user ID
    Usage
    <?php
    // contact new user via mail
    function foo($user_id) {	
    	// get mail
    	global $pc_users;
    	$email = $pc_users->get_user_field($user_id, 'email');
    	
    	if(!empty($email)) {
    		wp_mail( ... ) // simplified code	
    	}
    }
    add_action('pc_user_added', 'foo');
    ?>
    
    pc_user_added_by_admin

    Fired when user has been successfully added through the admin panel

    Parameters
    1. (int) user ID
    pc_user_created_from_wp

    Perform an action a new user is added starting from an existing WordPress user on admin side

    Parameters
    1. (int) newly created PrivateContent user ID
    2. (int) WordPress user ID
    pc_user_created_from_wp_register

    Perform an action a new user is added starting from an existing WordPress user on website's frontend

    Parameters
    1. (int) newly created PrivateContent user ID
    2. (int) WordPress user ID
    pc_user_dashboard_save

    Fired when user data is saved through the admin panel (user dashboard)

    Parameters
    1. (array) fetched fields data array (data passed by the form validation class)
    2. (int) user ID
    3. (int) true if the action is triggered on a newly added user, otherwise false
    pc_user_detached_from_wp

    Perform an action when user is detachecd from its WordPress mirror.
    Action is performed right before WP user deletion.

    Parameters
    1. (int) user ID
    2. (int) mirror WP user ID
    pc_user_login

    Perform an action when user logs in

    Parameters
    1. (int) user ID
    pc_user_logout

    Perform an action when user logs out

    Parameters
    1. (int) user ID
    pc_user_synced_with_wp

    Perform an action when user is synced with a WordPress mirror user.

    Parameters
    1. (int) user ID
    2. (int) mirror WP user ID
    pc_user_updated

    Perform an action when user is updated (any field or meta is updated)

    Parameters
    1. (int) user ID
    Usage
    <?php
    // contact user if admin update its data
    function foo($user_id) {	
    	// get mail
    	global $pc_users;
    	$email = $pc_users->get_user_field($user_id, 'email');
    	
    	if(!empty($email) && pc_user_logged(false) === false)) {
    		wp_mail( ... ) // simplified code	
    	}
    }
    add_action('pc_user_updated', 'foo');
    ?>
    
    pvtcont_init

    Fires whenever PrivateContent elements are loaded.
    Ideally should be used instead of "init" or "wp_loaded" to write code involving PrivateContent elements