function importEasyBlog($source, $language, $start = 0, $limit = 100) { $db = JCommentsFactory::getDBO(); $query = "SELECT c.*" . "\n, u.username as user_username, u.name as user_name, u.email as user_email" . "\nFROM `#__easyblog_comment` AS c" . "\nLEFT JOIN `#__users` AS u ON c.created_by = u.id " . "\nORDER BY c.`created`"; $db->setQuery($query, $start, $limit); $rows = $db->loadObjectList(); foreach ($rows as $row) { $comment = new JCommentsImportedComment($db); $comment->object_id = $row->post_id; $comment->object_group = 'com_easyblog'; $comment->parent = $row->parent_id; $comment->userid = $row->created_by; $comment->name = isset($row->user_name) ? $row->user_name : $row->name; $comment->username = isset($row->user_username) ? $row->user_username : $row->name; $comment->email = isset($row->user_email) ? $row->user_email : $row->email; $comment->homepage = $row->url; $comment->comment = $row->comment; $comment->title = $row->title; $comment->ip = $row->ip; $comment->published = $row->published; $comment->date = $row->created; $comment->isgood = $row->vote > 0 ? $row->vote : 0; $comment->ispoor = $row->vote < 0 ? $row->vote : 0; $comment->source = $source; $comment->source_id = $row->id; $comment->lang = $language; $comment->store(); } }
function importRSComments($source, $language) { $db =& JCommentsFactory::getDBO(); $query = "SELECT c.*, u.name as user_name, u.username, u.email as user_email" . "\nFROM `#__rscomments_comments` AS c" . "\nLEFT JOIN `#__users` AS u ON c.uid = u.id "; $db->setQuery($query); $rows = $db->loadObjectList(); foreach ($rows as $row) { $comment = new JCommentsImportedComment($db); $comment->object_id = $row->id; $comment->object_group = $row->option; $comment->userid = $row->uid; $comment->name = isset($row->user_name) ? $row->user_name : $row->name; $comment->username = $row->username; $comment->email = isset($row->user_email) ? $row->user_email : $row->email; $comment->homepage = $row->website; $comment->ip = $row->ip; $comment->title = $row->subject; $comment->comment = $row->comment; $comment->published = $row->published; $comment->date = $row->date; $comment->source = $source; $comment->lang = $language; $comment->store(); } }