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


PHP Network::update_membership_type方法代码示例

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


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

示例1: get_members

 /**
  *  Function : get_members()
  *  Purpose  : get members of the network based on the parameters passed to it
  *  @param    $params - array - the various elements of this array may be defined
  *            as follows
  *            $params['search_keyword']=>'blah'
  *            $params['neglect_owner']=>TRUE - if we want to exclude owner of n/w
  *            $params['cnt']=>TRUE - if we want to get count
  *            $params['network_id']=>2 - get members of network having id 2
  *            $params['sort_by']=> 'U.created' - column name
  *            $params['direction']=> DESC - order by clause
  *            $params['page']=> 2 - page number 2
  *            $params['show']=> 5 - show 5 records
  *	       $params['also_search_fullname'] => true - will match against user's
  *	        first, last, and full (combined) name as well as their username
  *  @return   type array
  *            returns array of members of n/w
  */
 public static function get_members($params)
 {
     Logger::log("[ Enter: function Network::get_members] \n");
     // fix Mother Network owner not set issue
     if ($params['network_id'] == 1) {
         $owner_arr = Network::get_members_by_type(array('network_id' => 1, 'user_type' => NETWORK_OWNER));
         if ($owner_arr['total_users'] == 0) {
             Network::update_membership_type(array('user_id_array' => array(1), 'user_type' => NETWORK_OWNER, 'network_id' => 1));
         }
     }
     $data = array();
     $notshow = UNVERIFIED;
     if (isset($params['show_waiting_users']) && $params['show_waiting_users'] == true) {
         $sql = "SELECT DISTINCT U.user_id, NU.user_id, NU.network_id, NU.user_type, U.*\n               FROM {networks_users} AS NU, {users} AS U\n               WHERE NU.network_id = ?\n               AND NU.user_id = U.user_id\n               AND U.is_active <> ? ";
         //count query to find total members
         $sql_count = "SELECT count(DISTINCT U.user_id) AS CNT\n               FROM {networks_users} AS NU, {users} AS U\n               WHERE NU.network_id = ?\n               AND NU.user_id = U.user_id\n               AND U.is_active <> ?  ";
         array_push($data, $params['network_id'], DELETED);
     } else {
         $sql = "SELECT NU.user_id, NU.network_id, NU.user_type, U.*\n               FROM {networks_users} AS NU, {users} AS U\n               WHERE NU.network_id = ?\n               AND NU.user_id = U.user_id\n               AND U.is_active <> ? AND U.is_active <> ? AND NU.user_type <> ? ";
         //count query to find total members
         $sql_count = "SELECT count(*) AS CNT\n               FROM {networks_users} AS NU, {users} AS U\n               WHERE NU.network_id = ?\n               AND NU.user_id = U.user_id\n               AND U.is_active <> ? AND U.is_active <> ? AND NU. user_type <> ? ";
         array_push($data, $params['network_id'], DELETED, UNVERIFIED, NETWORK_WAITING_MEMBER);
         // get only active members
     }
     //we dont want the owner of the network to come in listing
     if (!empty($params['neglect_owner']) && $params['neglect_owner'] == TRUE) {
         $sql .= " AND NU.user_type <>  ? AND U.user_id <> ? ";
         $sql_count .= " AND NU.user_type <> ?  AND U.user_id <> ? ";
         array_push($data, NETWORK_OWNER, SUPER_USER_ID);
     }
     //we have search criteria
     if (!empty($params['search_keyword'])) {
         $sql .= " AND ( U.login_name LIKE '%" . $params['search_keyword'] . "%' ";
         $sql_count .= " AND ( U.login_name LIKE '%" . $params['search_keyword'] . "%' ";
         // If we want to search for the full name, not just username
         if (isset($params['also_search_fullname']) && $params['also_search_fullname'] == true) {
             $sql .= "OR U.first_name LIKE '%" . $params['search_keyword'] . "%'    \n                         OR U.last_name LIKE '%" . $params['search_keyword'] . "%'\n                         OR CONCAT(U.first_name, ' ',U.last_name) LIKE '%" . $params['search_keyword'] . "%'";
             $sql_count .= "OR U.first_name LIKE '%" . $params['search_keyword'] . "%'\n                                OR U.last_name LIKE '%" . $params['search_keyword'] . "%'\n                                OR CONCAT(U.first_name, ' ',U.last_name) LIKE '%" . $params['search_keyword'] . "%'";
         }
         $sql .= ")";
         $sql_count .= ")";
     }
     // if we are intersted in getting total records only then return count
     if (!empty($params['cnt']) && $params['cnt'] == TRUE) {
         $cnt = Dal::query_one_assoc($sql_count, $data);
         Logger::log("[ Enter: function Network::get_members returning count] \n");
         return $cnt['CNT'];
     }
     // OK we want to find the details
     $sort_by = !empty($params['sort_by']) ? $params['sort_by'] : 'U.created';
     $direction = !empty($params['direction']) ? $params['direction'] : 'DESC';
     $order_by = ' ORDER BY ' . $sort_by . ' ' . $direction;
     if (!empty($params['page']) && !empty($params['show'])) {
         $start = ($params['page'] - 1) * $params['show'];
         $limit = ' LIMIT ' . $start . ',' . $params['show'];
     } else {
         $limit = "";
     }
     $sql = $sql . $order_by . $limit;
     $res = Dal::query($sql, $data);
     $users_data = array();
     while ($row = $res->fetchRow(DB_FETCHMODE_ASSOC)) {
         // get current info for the user
         $u = new User();
         $u->load((int) $row['user_id']);
         $row['display_name'] = $u->display_name;
         $row['user_obj'] = $u;
         // add user object, when it is already loaded!
         $users_data[] = $row;
     }
     if (empty($users_data)) {
         return NULL;
     }
     $final_array = array('users_data' => $users_data, 'total_users' => count($users_data));
     Logger::log("[ Exit: function Network::get_members] \n");
     return $final_array;
 }
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:95,代码来源:Network.php

示例2: __

         } else {
             // status updated by network owner in a network
             $params['user_type'] = NETWORK_MEMBER;
             Network::update_membership_type($params);
         }
         $message = __('Status of selected user(s) updated successfully');
     } catch (CNException $e) {
         $message = $e->message;
     }
     break;
 case 'approve':
     try {
         $params['status'] = ACTIVE;
         User::update_user_status($params);
         $params['user_type'] = NETWORK_MEMBER;
         Network::update_membership_type($params);
         // providing defaults to new user
         // creating message basic folders
         Message::create_basic_folders($_REQUEST['uid']);
         // adding default relation
         if ($_REQUEST['uid'] != SUPER_USER_ID) {
             User_Registration::add_default_relation($_REQUEST['uid'], PA::$network_info);
         }
         // adding default media as well as album
         User_Registration::add_default_media($_REQUEST['uid'], '', PA::$network_info);
         User_Registration::add_default_media($_REQUEST['uid'], '_audio', PA::$network_info);
         User_Registration::add_default_media($_REQUEST['uid'], '_video', PA::$network_info);
         User_Registration::add_default_blog($_REQUEST['uid']);
         //adding default link categories & links
         User_Registration::add_default_links($_REQUEST['uid']);
         $message = __('Status of selected user(s) updated successfully');
开发者ID:Cyberspace-Networks,项目名称:CoreSystem,代码行数:31,代码来源:cnnetwork_user_management.php


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