示例#1
0
 public function update_user_info($data)
 {
     if (isset($data['ID']) && $data['ID'] > 0) {
         $sqlSetData = "user_activation_key = ''";
         // user_nicename;
         if (isset($data['user_nicename']) && !empty($data['user_nicename'])) {
             $sqlSetData .= ",user_nicename = " . $this->db->escape($data['user_nicename']);
         }
         // display_name
         if (isset($data['display_name']) && !empty($data['display_name'])) {
             $sqlSetData .= ",display_name = " . $this->db->escape($data['display_name']);
         }
         // first name
         if (isset($data['first_name'])) {
             $sqlSetData .= ", first_name = " . $this->db->escape($data['first_name']);
         }
         // last_name
         if (isset($data['last_name'])) {
             $sqlSetData .= ", last_name = " . $this->db->escape($data['last_name']);
         }
         // in_access_token
         if (isset($data['in_access_token'])) {
             $sqlSetData .= ", in_access_token = " . $this->db->escape($data['in_access_token']);
         }
         // in_token_expire
         if (isset($data['in_token_expire'])) {
             $sqlSetData .= ", in_token_expire = " . $this->db->escape($data['in_token_expire']);
         }
         // user_activation_key
         if (isset($data['user_activation_key'])) {
             $sqlSetData .= ", user_activation_key = " . $this->db->escape($data['user_activation_key']);
         }
         // cus_description
         if (isset($data['cus_description'])) {
             $sqlSetData .= ", cus_description = " . $this->db->escape($data['cus_description']);
         }
         // cus_avatar
         if (isset($data['cus_avatar'])) {
             $sqlSetData .= ", cus_avatar = " . $this->db->escape($data['cus_avatar']);
         }
         // cus_cover
         if (isset($data['cus_cover'])) {
             $sqlSetData .= ", cus_cover = " . $this->db->escape($data['cus_cover']);
         }
         // cus_quote
         if (isset($data['cus_quote'])) {
             $sqlSetData .= ", cus_quote = " . $this->db->escape($data['cus_quote']);
         }
         // cus_career
         if (isset($data['cus_career'])) {
             $sqlSetData .= ", cus_career = " . $this->db->escape($data['cus_career']);
         }
         // cus_company
         if (isset($data['cus_company'])) {
             $sqlSetData .= ", cus_company = " . $this->db->escape($data['cus_company']);
         }
         // cus_city
         if (isset($data['cus_city'])) {
             $sqlSetData .= ", cus_city = " . $this->db->escape($data['cus_city']);
         }
         // user_interested
         if (isset($data['interested'])) {
             $termIdArray = explode(',', $data['interested']);
             $meta_value_build = '';
             foreach ($termIdArray as $termId) {
                 if (is_numeric($termId)) {
                     !empty($meta_value_build) ? $meta_value_build .= ',' . $termId : ($meta_value_build .= $termId);
                 } else {
                     if (is_string($termId) && !empty($termId) && strlen($termId) > 0) {
                         // Insert into TERM table
                         $sqlInsert = "INSERT INTO wp_terms SET name = " . $this->db->escape($termId) . ", slug = " . $this->db->escape(CommonUtils::remove_vietnamese_accents($termId));
                         $this->db->query($sqlInsert);
                         $inTermId = $this->db->insert_id();
                         // Insert into TERM_TAXONOMY table
                         $sqlInsert = "INSERT INTO wp_term_taxonomy SET term_id =" . (int) $inTermId . ", taxonomy = 'post_tag', description = " . $this->db->escape($termId) . ", parent=0,count=1";
                         $this->db->query($sqlInsert);
                         !empty($meta_value_build) ? $meta_value_build .= ',' . $inTermId : ($meta_value_build .= $inTermId);
                     }
                 }
             }
             if (!empty($meta_value_build) && strlen($meta_value_build) > 0) {
                 $sqlMetaValue = "SELECT * FROM wp_usermeta WHERE user_id =" . (int) $data['ID'] . " AND meta_key = 'interested'";
                 $tempQuery = $this->db->query($sqlMetaValue);
                 if ($tempQuery->num_rows() > 0) {
                     // UPDATE
                     $sqlMetaValue = "UPDATE wp_usermeta SET meta_value = " . $this->db->escape($meta_value_build) . " WHERE user_id = " . (int) $data['ID'] . " AND meta_key = 'interested'";
                 } else {
                     // INSERT
                     $sqlMetaValue = "INSERT INTO wp_usermeta\n                                    SET user_id = " . (int) $data['ID'] . ",\n                                        meta_key = 'interested' ,\n                                        meta_value = " . $this->db->escape($meta_value_build);
                 }
                 $this->db->query($sqlMetaValue);
             }
         }
         //
         $sql = "UPDATE wp_users SET " . $sqlSetData . " WHERE ID = " . (int) $data['ID'];
         try {
             $this->db->query($sql);
             return $data['ID'];
         } catch (Exception $e) {
             echo $e->getMessage();
         }
     } else {
         return null;
     }
 }
示例#2
0
    echo config_item('wp_home_url') . '/' . CommonUtils::remove_vietnamese_accents($bookmark['post_title']) . '_post-' . $bookmark['post_id'] . '.html';
    ?>
">
                            <img width="253" height="195" alt="Capture" class="attachment-260x195 wp-post-image" src="<?php 
    echo config_item('wp_home_url') . '/wp-content/uploads/' . $bookmark['post_thumb_img'];
    ?>
">
                            <span class="circle">5,0</span>
                        </a>
                    </div>
                    <div class="title-container">
                        <a style="word-wrap: break-word;" class="color-hourlie js-paragraph-crop" title="<?php 
    echo $bookmark['post_title'];
    ?>
" href="<?php 
    echo config_item('wp_home_url') . '/' . CommonUtils::remove_vietnamese_accents($bookmark['post_title']) . '_post-' . $bookmark['post_id'] . '.html';
    ?>
">
                            <?php 
    echo $bookmark['post_title'];
    ?>
                        </a>
                    </div>
                    <div class="profile-container stretch clearfix">
                        <div class="col-xs-8 no-padding-right">
                            <div class="user-image-container pull-left">
                                <?php 
    $authorAvatar = $bookmark['post_author_avatar'];
    if (strpos($authorAvatar, 'http') === false) {
        $authorAvatar = config_item('wp_home_url') . '/' . $authorAvatar;
    }