当前位置: 首页>>代码示例>>PHP>>正文


PHP ThemexCore::addUserRelation方法代码示例

本文整理汇总了PHP中ThemexCore::addUserRelation方法的典型用法代码示例。如果您正苦于以下问题:PHP ThemexCore::addUserRelation方法的具体用法?PHP ThemexCore::addUserRelation怎么用?PHP ThemexCore::addUserRelation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ThemexCore的用法示例。


在下文中一共展示了ThemexCore::addUserRelation方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getQuestions

 /**
  * Gets quiz questions
  *
  * @access public
  * @param int $ID
  * @return array
  */
 public static function getQuestions($ID)
 {
     $selection = absint(ThemexCore::getPostMeta($ID, 'quiz_selection'));
     $questions = themex_filter(ThemexCore::getPostMeta($ID, 'quiz_questions'));
     if (!empty($selection) && $selection < count($questions)) {
         $keys = ThemexCore::getUserRelations(get_current_user_id(), $ID, 'questions', true);
         if (!empty($keys)) {
             $keys = explode(',', $keys);
             $questions = array_intersect_key($questions, array_flip($keys));
         }
         if ($selection != count($questions)) {
             $questions = themex_shuffle($questions);
             $questions = array_slice($questions, 0, $selection);
             $keys = implode(',', array_keys($questions));
             ThemexCore::addUserRelation(get_current_user_id(), $ID, 'questions', $keys);
         }
     }
     return $questions;
 }
开发者ID:rinodung,项目名称:wordpress-demo,代码行数:26,代码来源:themex.lesson.php

示例2: addUser

 /**
  * Adds course member
  *
  * @access public
  * @param int $ID
  * @param bool $private
  * @return void
  */
 public static function addUser($ID, $user, $private = false)
 {
     self::refresh($ID);
     $redirect = get_permalink($ID);
     if ($user != 0 || self::$data['status'] == 'premium' && self::$data['product'] != 0) {
         if (!self::isMember($user)) {
             if ($private || self::$data['status'] == 'free' || self::$data['status'] == 'premium' && self::$data['product'] == 0) {
                 ThemexCore::addUserRelation($user, $ID, 'course', current_time('timestamp'));
                 self::$data['users'][] = $user;
                 $number = count(self::$data['users']);
                 ThemexCore::updatePostMeta($ID, 'course_popularity', $number);
                 $message = ThemexCore::getOption('email_course');
                 if (!empty($message)) {
                     $data = get_userdata($user);
                     $keywords = array('username' => $data->user_login, 'title' => get_the_title($ID), 'link' => $redirect);
                     themex_mail($data->user_email, __('Course Membership', 'academy'), themex_keywords($message, $keywords));
                 }
                 if (!$private) {
                     wp_redirect($redirect);
                     exit;
                 }
             } else {
                 if (self::$data['status'] == 'premium') {
                     ThemexWoo::addProduct(self::$data['product']);
                 }
             }
         } else {
             if (!$private) {
                 wp_redirect($redirect);
                 exit;
             }
         }
     }
 }
开发者ID:rinodung,项目名称:wordpress-demo,代码行数:42,代码来源:themex.course.php

示例3: addRelation

 /**
  * Adds user relation
  *
  * @access public
  * @param int $ID
  * @param array $data
  * @return void
  */
 public static function addRelation($ID, $data)
 {
     $relation = themex_value('relation_id', $data);
     $type = themex_value('relation_type', $data);
     if (in_array($type, array('shop', 'product'))) {
         ThemexCore::addUserRelation($ID, $relation, $type);
         if ($type == 'shop') {
             $relations = count(ThemexCore::getUserRelations(0, $relation, 'shop'));
             ThemexCore::updatePostMeta($relation, 'admirers', $relations);
         }
     }
     die;
 }
开发者ID:qhuit,项目名称:UrbanPekor,代码行数:21,代码来源:themex.user.php


注:本文中的ThemexCore::addUserRelation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。