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

PrivateContent Plugin

API Documentation

Constants & Globals

Constants

#

PrivateContent defines PHP constants to speed up coding.

ConstantDescription
PC_DIRPrivateContent base directory (without trailing slash)
PC_URLPrivateContent base URL (without trailing slash)
PC_VERSPrivateContent version (eg. 9.15.1). Useful for version_compare() checks
PC_USERS_TABLEusers database table name, prefix included. Defined on plugins_loaded (priority 1)
PC_META_TABLEuser meta database table name, prefix included. Defined on plugins_loaded (priority 1)
PVTCONT_WP_USER_PASStrue if the logged WordPress user can bypass restrictions (see the "testing mode" settings). Defined on pvtcont_init (priority 1)
PVTCONT_CURR_USER_MANAGEABLE_CATSany or array of user category IDs the logged WordPress user can manage. Defined on pvtcont_init (priority 1)

Use defined() before using constants in code that might run earlier than the moment they are defined.

Global objects

#

Main classes are instantiated once and reachable through PHP globals:

GlobalDescription
$pc_userspc_users class instance - users management
$pc_metapc_meta class instance - user meta management
$pc_wp_userpc_wp_user class instance - WP User Sync
$pc_restr_wizardpc_restr_wizard class instance - restrictions. Available from plugins_loaded (priority 100)

Example

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

Global variables

#
VariableDescription
$GLOBALS['pc_user_id']ID of the logged user. Set on pvtcont_init (priority 1) and unset on logout. It is not re-checked against the database: use pc_user_logged() for a real-time check
$GLOBALS['pvtcont_user_check_already_passed']available only inside the pc_extra_user_check filter: true if the user already passed the standard categories check
$GLOBALS['pvtcont_wp_preview_check_already_passed']available only inside the pc_extra_wp_preview_check filter: true if the previewing admin already passed the standard check
$GLOBALS['pvtcont_check_user_id_is_username']if set, user meta methods treat the user parameter as a username even if it is numeric (useful for numeric usernames)
$GLOBALS['is_pc_bundle']set when PrivateContent runs as part of the bundle pack

Let's get in touch!

Features list