PATH:
home
/
lab2454c
/
incforce.com
/
wp-content
/
plugins
/
paid-memberships-pro
/
includes
<?php /** * Define the XMLRPC Methods We Add * Since v2.0 */ add_filter('xmlrpc_methods', 'pmpro_xmlrpc_methods'); function pmpro_xmlrpc_methods($methods) { $methods['pmpro.getMembershipLevelForUser'] = 'pmpro_xmlrpc_getMembershipLevelForUser'; $methods['pmpro.hasMembershipAccess'] = 'pmpro_xmlrpc_hasMembershipAccess'; return $methods; } /** * API method to get the membership level info for a user. * Since v2.0 */ function pmpro_xmlrpc_getMembershipLevelForUser($args) { // Parse the arguments, assuming they're in the correct order $username = $args[0]; $password = $args[1]; $user_id = $args[2]; //optional user id passed in global $wp_xmlrpc_server; // Let's run a check to see if credentials are okay if ( !$user = $wp_xmlrpc_server->login($username, $password) ) { return $wp_xmlrpc_server->error; } // The user passed should be an admin or have the pmpro_xmlprc capability if(!user_can($user->ID, "manage_options") && !user_can($user->ID, "pmpro_xmlrpc")) return "ERROR: User does not have access to the PMPro XMLRPC methods."; // Default to logged in user if no user_id is given. if(empty($user_id)) { $user_id = $user->ID; } $membership_level = pmpro_getMembershipLevelForUser($user_id); return $membership_level; } /** * API method to check if a user has access to a certain post. * Since v2.0 */ function pmpro_xmlrpc_hasMembershipAccess($args) { // Parse the arguments, assuming they're in the correct order $username = $args[0]; $password = $args[1]; $post_id = $args[2]; //post id to check $user_id = $args[3]; //optional user id passed in $return_membership_levels = $args[4]; //option to also include an array of membership levels with access to the post global $wp_xmlrpc_server; // Let's run a check to see if credentials are okay if ( !$user = $wp_xmlrpc_server->login($username, $password) ) { return $wp_xmlrpc_server->error; } // The user passed should be an admin or have the pmpro_xmlprc capability if(!user_can($user->ID, "manage_options") && !user_can($user->ID, "pmpro_xmlrpc")) return "ERROR: User does not have access to the PMPro XMLRPC methods."; // Default to logged in user if no user_id is given. if(empty($user_id)) { $user_id = $user->ID; } $has_access = pmpro_has_membership_access($post_id, $user_id, $return_membership_levels); return $has_access; }
[-] addons.php
[edit]
[+]
compatibility
[-] adminpages.php
[edit]
[-] reports.php
[edit]
[-] deprecated.php
[edit]
[-] fields.php
[edit]
[+]
lib
[+]
..
[-] email.php
[edit]
[-] xmlrpc.php
[edit]
[-] admin.php
[edit]
[-] scripts.php
[edit]
[-] localization.php
[edit]
[-] capabilities.php
[edit]
[-] widgets.php
[edit]
[-] checkout.php
[edit]
[-] updates.php
[edit]
[-] filters.php
[edit]
[-] cleanup.php
[edit]
[-] page-templates.php
[edit]
[-] notifications.php
[edit]
[-] services.php
[edit]
[-] terms.php
[edit]
[-] rest-api.php
[edit]
[-] setup.sql
[edit]
[-] upgradecheck.php
[edit]
[-] profile.php
[edit]
[-] states.php
[edit]
[-] init.php
[edit]
[-] metaboxes.php
[edit]
[-] menus.php
[edit]
[-] login.php
[edit]
[-] email-templates.php
[edit]
[-] license.php
[edit]
[-] spam.php
[edit]
[-] functions.php
[edit]
[-] recaptcha.php
[edit]
[-] privacy.php
[edit]
[-] compatibility.php
[edit]
[-] https.php
[edit]
[-] currencies.php
[edit]
[-] abandoned-signups.php
[edit]
[-] content.php
[edit]
[+]
updates
[-] countries.php
[edit]
[-] crons.php
[edit]
[-] pointers.php
[edit]
[-] sessions.php
[edit]