Getting Started

This documentation is intended to web developers wanting to tweak or extend privateContent.

To be as compatible as possible with core plugin and avoid troubles during updates is strongly suggested to use following classes and functions. Specially to manage users and their data, in order to correctly trigger hooks and allow a correct usage experience to final customers.

If you think any useful function or method is missing, feel free to contact at support [at] and we can speak about its implementation!
Let's try to briefly understand how PrivateContent works under the hook:

Restriction side

First of all, the essential resource is pc_user_logged() API function.
This must be used to check a logged user and eventually get its data.

Normally restrictions are based on user categories, then you should use pc_user_check() API function.
However you can always perform more complex matchings using data fetched through pc_user_logged().

Fastest way to get logged user ID without queries is using the global variable:

if(isset($GLOBALS['pc_user_id'])) {
	$user_id = $GLOBALS['pc_user_id'];	
} else {
	// no user logged	

However is surely safer to use pc_user_logged('id'), checking database in real time.

Users Management side

As you probably know, PrivateContent users are apart from wordpress ones and stored in a different users database.
This unless you use WP User Sync system, creating WP "mirrors" and eventually emulating their roles.

Using WP user sync they will be also able to use WP-based login and logout systems.
In any case, PrivateContent users won't be able to reach wp-admin.

To insert and manage users is strongly suggested to use Users Management class methods.
To extend stored data in most case Meta Data table will be more than enough and already integrated in APIs.

In case of new fields, remember to insert them in PrivateContent form framework through pc_form_fields_filter filter.
Is essential to trigger automatic data validation and use methods coming with that class.

Users private page is a custom post type named pg_user_page. Container's page contents are replaced for each user.
To extend users reserved area just target that container's page (to manage global layout or sidebar) or use pc_pvt_page_contents filter to inject contents.

lcwebPrivateContent – API documentation