當前位置: 首頁>>代碼示例>>PHP>>正文


PHP BuckysUser::updateUserMessengerInfo方法代碼示例

本文整理匯總了PHP中BuckysUser::updateUserMessengerInfo方法的典型用法代碼示例。如果您正苦於以下問題:PHP BuckysUser::updateUserMessengerInfo方法的具體用法?PHP BuckysUser::updateUserMessengerInfo怎麽用?PHP BuckysUser::updateUserMessengerInfo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在BuckysUser的用法示例。


在下文中一共展示了BuckysUser::updateUserMessengerInfo方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: saveContactInfoAction

 public function saveContactInfoAction()
 {
     $data = $_POST;
     $token = isset($data['TOKEN']) ? trim($data['TOKEN']) : null;
     if (!$token) {
         return ['STATUS_CODE' => STATUS_CODE_BAD_REQUEST, 'DATA' => buckys_api_get_error_result('Api token should not be blank')];
     }
     if (!($userID = BuckysUsersToken::checkTokenValidity($token, "api"))) {
         return ['STATUS_CODE' => STATUS_CODE_UNAUTHORIZED, 'DATA' => buckys_api_get_error_result('Api token is not valid.')];
     }
     $header = [];
     $header['email'] = $data['email'];
     $header['work_phone'] = $data['work_phone'];
     $header['home_phone'] = $data['home_phone'];
     $header['cell_phone'] = $data['cell_phone'];
     $header['email_visibility'] = $data['email_visibility'];
     $header['home_phone_visibility'] = $data['home_phone_visibility'];
     $header['work_phone_visibility'] = $data['work_phone_visibility'];
     $header['cell_phone_visibility'] = $data['cell_phone_visibility'];
     $count = isset($data['COUNT']) ? $data['COUNT'] : 0;
     $info = [];
     for ($i = 0; $i < $count; $i++) {
         $row = [];
         $row['name'] = $data['CONTACT_NAME' . $i];
         $row['type'] = $data['CONTACT_TYPE' . $i];
         $row['visibility'] = $data['VISIBILITY' . $i];
         $info[] = $row;
     }
     if (BuckysUser::updateUserFields($userID, $header) && BuckysUser::updateUserMessengerInfo($userID, $info)) {
         return ['STATUS_CODE' => STATUS_CODE_OK, 'DATA' => ['STATUS' => 'SUCCESS']];
     } else {
         return ['STATUS_CODE' => STATUS_CODE_UNAUTHORIZED, 'DATA' => buckys_api_get_error_result('There was an error to saving your information.')];
     }
     exit;
 }
開發者ID:HAPwebsite,項目名稱:Social-Network-Website,代碼行數:35,代碼來源:accountApi.php

示例2:

    if ($_POST['action'] == 'save_address') {
        $data = ['address1' => $_POST['address1'], 'address2' => $_POST['address2'], 'city' => $_POST['city'], 'state' => $_POST['state'], 'zip' => $_POST['zip'], 'country' => $_POST['country'], 'address_visibility' => $_POST['address_visibility']];
        //Update User Phone numbers
        if (BuckysUser::updateUserFields($userID, $data)) {
            echo 'Success';
        } else {
            echo $db->getLastError();
        }
        exit;
    }
    //Save Contact Info
    if ($_POST['action'] == 'save_messenger') {
        $data = [];
        for ($i = 0; $i < count($_POST['username']); $i++) {
            $data[] = ['name' => $_POST['username'][$i], 'type' => $_POST['type'][$i], 'visibility' => $_POST['visibility'][$i]];
        }
        //Update User Phone numbers
        if (BuckysUser::updateUserMessengerInfo($userID, $data)) {
            echo 'Success';
        } else {
            echo $db->getLastError();
        }
        exit;
    }
}
buckys_enqueue_stylesheet('account.css');
buckys_enqueue_stylesheet('info.css');
buckys_enqueue_javascript('info.js');
$TNB_GLOBALS['content'] = 'info_contact';
$TNB_GLOBALS['title'] = "Contact Info - " . TNB_SITE_NAME;
require DIR_FS_TEMPLATE . $TNB_GLOBALS['template'] . "/" . $TNB_GLOBALS['layout'] . ".php";
開發者ID:HAPwebsite,項目名稱:Social-Network-Website,代碼行數:31,代碼來源:info_contact.php


注:本文中的BuckysUser::updateUserMessengerInfo方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。