本文整理汇总了PHP中ThemexCore::updatePostMeta方法的典型用法代码示例。如果您正苦于以下问题:PHP ThemexCore::updatePostMeta方法的具体用法?PHP ThemexCore::updatePostMeta怎么用?PHP ThemexCore::updatePostMeta使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ThemexCore
的用法示例。
在下文中一共展示了ThemexCore::updatePostMeta方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: removeUser
/**
* Removes course member
*
* @access public
* @param int $ID
* @return void
*/
public static function removeUser($ID, $user)
{
self::refresh($ID);
if (self::isMember($user)) {
ThemexCore::removeUserRelation($user, self::$data['ID'], 'course');
$number = count(self::$data['users']) - 1;
ThemexCore::updatePostMeta(self::$data['ID'], 'course_popularity', $number);
}
}
示例2: addOrder
/**
* Adds order
*
* @access public
* @param int $ID
* @return void
*/
public static function addOrder($ID)
{
$order = wc_get_order($ID);
$products = $order->get_items();
//set author
if (!empty($products)) {
$product = reset($products);
$post = get_post($product['product_id']);
//set affiliate
$referral = get_current_user_id();
$affiliate = self::getAffiliate();
if (!empty($affiliate) && $affiliate != $referral) {
ThemexCore::updatePostMeta($ID, 'affiliate', $affiliate);
self::removeAffiliate();
//send email
$content = ThemexCore::getOption('email_order_referral');
if (!empty($content)) {
$user = get_userdata($affiliate);
if ($user !== false) {
$subject = __('New Referral', 'makery');
$keywords = array('username' => $user->user_login, 'order' => '<a href="' . ThemexCore::getURL('profile-referrals') . '">' . $order->get_order_number() . '</a>');
$content = themex_keywords($content, $keywords);
themex_mail($user->user_email, $subject, $content);
}
}
}
if (!empty($post)) {
wp_update_post(array('ID' => $ID, 'post_author' => $post->post_author));
//send email
$content = ThemexCore::getOption('email_order_received');
if (!empty($content)) {
$user = get_userdata($post->post_author);
$subject = __('New Order', 'makery');
$keywords = array('username' => $user->user_login, 'order' => '<a href="' . ThemexCore::getURL('shop-order', $order->id) . '">' . $order->get_order_number() . '</a>');
$content = themex_keywords($content, $keywords);
themex_mail($user->user_email, $subject, $content);
}
}
}
}
示例3: removeRelation
/**
* Removes user relation
*
* @access public
* @param int $ID
* @param array $data
* @return void
*/
public static function removeRelation($ID, $data)
{
$relation = themex_value('relation_id', $data);
$type = themex_value('relation_type', $data);
if (in_array($type, array('shop', 'product'))) {
ThemexCore::removeUserRelation($ID, $relation, $type);
if ($type == 'shop') {
$relations = count(ThemexCore::getUserRelations(0, $relation, 'shop'));
ThemexCore::updatePostMeta($relation, 'admirers', $relations);
}
}
die;
}
示例4: updateRating
/**
* Updates shop rating
*
* @access public
* @param int $ID
* @return void
*/
public static function updateRating($ID)
{
$rating = get_comment_meta($ID, 'rating', true);
if (!empty($rating)) {
$comment = get_comment($ID);
$user = get_post_field('post_author', $comment->comment_post_ID);
$shop = ThemexUser::getShop($user);
$rating = ThemexWoo::getRating($user);
ThemexCore::updatePostMeta($shop, 'rating', $rating['rating']);
ThemexCore::updatePostMeta($shop, 'ratings', $rating['ratings']);
}
}