本文整理汇总了PHP中ElggUser::getPrivateSetting方法的典型用法代码示例。如果您正苦于以下问题:PHP ElggUser::getPrivateSetting方法的具体用法?PHP ElggUser::getPrivateSetting怎么用?PHP ElggUser::getPrivateSetting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ElggUser
的用法示例。
在下文中一共展示了ElggUser::getPrivateSetting方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCustomerId
/**
* Get Stripe customer ID for the user
* @return string|boolean
*/
public function getCustomerId()
{
$customer_id = $this->user->getPrivateSetting('stripe_customer_id');
if (!$customer_id) {
$stripe = new StripeClient();
// Try other customer IDs stored on this user
$customer_ids = $this->user->stripe_customer_id;
if ($customer_ids) {
if (!is_array($customer_ids)) {
$customer_ids = array($customer_ids);
}
foreach ($customer_ids as $customer_id) {
$account = $stripe->getCustomer($customer_id);
if ($account) {
break;
}
}
}
if (!$account) {
$account = $stripe->createCustomer($this->user);
}
$customer_id = $account->id;
$this->user->setPrivateSetting('stripe_customer_id', $customer_id);
}
return $customer_id;
}
示例2: getAccessToken
/**
* Get an access token for signing API requests
*/
public function getAccessToken()
{
if (!elgg_instanceof($this->entity)) {
return false;
}
switch ($this->entity->getType()) {
case 'site':
return StripeClientFactory::getSecretKey();
break;
default:
return $this->entity->getPrivateSetting('stripe_access_token');
break;
}
}