PrivateContent Plugin
API Documentation
Database Tables
pc_users
#PrivateContent stores data in two database tables: pc_users for users main data and pc_user_meta for their meta data. Just like WordPress does with posts. Tables use the WordPress prefix: get their full name through the PC_USERS_TABLE and PC_META_TABLE constants.
Prefer the plugin classes to direct queries: they validate data, manage serialization and trigger hooks.
Columns
| Column | Description |
|---|---|
id | user ID (auto increment) |
insert_date | registration date. Datetime related to the WordPress timezone |
name | user name - max 150 characters |
surname | user surname - max 150 characters |
username | user username - max 150 characters. Unicity is granted by the plugin validation, not by a database key |
psw | password hash created through wp_hash_password(). Check it only through wp_check_password() |
categories | serialized array of user category IDs, stored as strings (eg. a:2:{i:0;s:1:"2";i:1;s:1:"5";}) |
email | user e-mail - max 255 characters |
tel | user telephone - max 20 characters |
page_id | user private page ID (pg_user_page post type) |
wp_user_id | ID of the WordPress user synced with the PrivateContent one (0 = no user synced) |
disable_pvt_page | 1 if the user private page is disabled, otherwise 0 |
last_access | last login date. Datetime related to the WordPress timezone. 1970-01-01 00:00:01 means the user never logged in |
status | user status: 1 = enabled, 2 = disabled, 3 = pending |
pc_user_meta
#Feel free to store anything you need into the meta table using the related class. It supports also arrays and objects (they are serialized).
The table has no unique key on user ID + meta key: always use the class methods, they prevent duplicated records.
Columns
| Column | Description |
|---|---|
meta_id | meta data ID (auto increment) |
user_id | ID of the user the meta belongs to |
meta_key | meta key - max 255 characters |
meta_value | meta value (string, number or serialized array/object) |
Related WordPress entities
#PrivateContent uses also standard WordPress entities:
| Entity | Description |
|---|---|
pg_user_categories | taxonomy containing user categories |
pc_reg_form | taxonomy containing registration forms. The form structure is stored in the term description |
pg_user_page | post type containing users private pages (one for each user) |
pg_restrictions | post meta containing a post restrictions. Read them through get_post_restr() |
pc_restrictions | term meta containing a term restrictions. Read them through get_term_restr() |
pc_user_id | WordPress user meta storing the ID of the PrivateContent user a WP user is synced with |
pg_* | plugin settings are stored as WordPress options prefixed with pg_ |