'Inbox Messages', 'page callback' => 'private_msg_inboxpages', // Note this is the PAGE CALLBACK! 'access arguments' => array('rate content'), 'file' => 'private_msg_inbox.inc', 'type' => MENU_CALLBACK, ); $items['user-sent/messages'] = array( //// Display sent Pages. 'title' => 'Sent Messages', 'page callback' => 'private_msg_sentpages', // Note this is the PAGE CALLBACK! 'access arguments' => array('rate content'), 'file' => 'private_msg_sent.inc', 'type' => MENU_CALLBACK, ); $items['user-draft/messages'] = array( //// Display draft Pages. 'title' => 'Draft Messages', 'page callback' => 'private_msg_draftpages', // Note this is the PAGE CALLBACK! 'access arguments' => array('rate content'), 'file' => 'private_msg_draft.inc', 'type' => MENU_CALLBACK, ); $items['user-favorite/messages'] = array( //// Display draft Pages. 'title' => 'Favorite Messages', 'page callback' => 'private_msg_favorite', // Note this is the PAGE CALLBACK! 'access arguments' => array('rate content'), 'file' => 'private_msg_favorite.inc', 'type' => MENU_CALLBACK, ); // $items['user-edit/%/messages'] = array( ////// Display draft Pages. // 'title' => 'Draft Messages', // 'page callback' => 'private_msg_editdraft', // Note this is the PAGE CALLBACK! // 'access arguments' => array('rate content'), // 'page arguments' => array(1), // 'file' => 'private_msg_draft.inc', // 'type' => MENU_CALLBACK, // ); $items['user-draft/send/%'] = array( ////// send draft messages Pages. 'title' => 'Draft Messages', 'page callback' => 'private_msg_senddraft', // Note this is the PAGE CALLBACK! 'access arguments' => array('rate content'), 'page arguments' => array(2), 'file' => 'private_msg_draft.inc', 'type' => MENU_CALLBACK, ); //==================== Delete draft,inbox,sent messages Pages. =============================// $items['user-inbox/send/%/%'] = array( ////// Delete draft messages Pages. 'title' => 'Draft Messages', 'page callback' => 'private_msg_deletedraft', // Note this is the PAGE CALLBACK! 'access arguments' => array('rate content'), 'page arguments' => array(2,3), 'file' => 'private_msg_draft.inc', 'type' => MENU_CALLBACK, ); //==================== write new messages on single page =============================// $items['user-write/new/messages'] = array( 'title' => 'Write New Messages', 'page callback' => 'private_msg_writenew', // Note this is the PAGE CALLBACK! 'access arguments' => array('rate content'), 'file' => 'private_msg_draft.inc', 'type' => MENU_CALLBACK, ); //==================== Search pages =============================// $items['user-inbox-message/results'] = array( 'title' => 'Find User Messages', 'page callback' => 'private_msg_inboxsearch_pages', // Note this is the PAGE CALLBACK! 'access arguments' => array('rate content'), 'file' => 'private_msg_search.inc', 'type' => MENU_CALLBACK, ); $items['user-sent-message/results'] = array( 'title' => 'Find User Messages', 'page callback' => 'private_msg_sentsearch_pages', // Note this is the PAGE CALLBACK! 'access arguments' => array('rate content'), 'file' => 'private_msg_search.inc', 'type' => MENU_CALLBACK, ); $items['user-draft-message/results'] = array( 'title' => 'Find User Messages', 'page callback' => 'private_msg_draftsearch_pages', // Note this is the PAGE CALLBACK! 'access arguments' => array('rate content'), 'file' => 'private_msg_search.inc', 'type' => MENU_CALLBACK, ); $items['user-favorite-message/results'] = array( 'title' => 'Find User Messages', 'page callback' => 'private_msg_favoritesearch_pages', // Note this is the PAGE CALLBACK! 'access arguments' => array('rate content'), 'file' => 'private_msg_search.inc', 'type' => MENU_CALLBACK, ); //==================== view messages on single page =============================// $items['user-view/messages/%/%'] = array( 'title' => 'Read User Messages', 'page callback' => 'private_msg_readpages', // Note this is the PAGE CALLBACK! 'page arguments' => array(2,3), 'access callback' => TRUE, 'access arguments' => array('rate content'), 'type' => MENU_CALLBACK, ); //============= auto complete fields =============================// $items['customize/user/autocomplete'] = array( 'title' => 'Autocomplete for users', 'page callback' => '_users_autocomplete', 'access arguments' => array('rate content'), 'type' => MENU_CALLBACK, ); //============= Message will move Faviorite section =============================// $items['customize/message/favorite/%'] = array( 'title' => 'Move Messages to Favorite', 'page callback' => '_private_msg_move_favorite_message', // Note this is the PAGE CALLBACK! 'page arguments' => array(3), 'access callback' => TRUE, 'access arguments' => array('rate content'), 'type' => MENU_CALLBACK, ); return $items; } /** * Implement hook_block_info() */ function private_msg_block_info() { // set up an empty array which will contain the block contents $blocks = array(); // Generate listing of blocks from this module, for the admin/block page $blocks['messages_menu'] = array('info' => t('Messages Menu')); /*user-inbox/messages user-sent/messages user-draft/messages user-edit/* /messages user-write/new/messages user-message/results user-message/view pages */ $blocks['sent_messages_form'] = array('info' => t('Sent Messages')); // user-message/results and user-message/view/* pages $blocks['search_messages_form'] = array('info' => t('Search Messages')); //user-inbox/messages and user-sent/messages and user-draft/messages and user-message/results pages return $blocks; } /** * Implement hook_block_view() * * Generate HTML for the buddies block * @param op the operation from the URL * @param delta offset * @returns block HTML */ function private_msg_block_view($delta = '') { global $user; $block = array(); switch ($delta) { case 'messages_menu': module_load_include('inc', 'private_msg', 'private_msg_blockdata'); $block['subject'] = t(''); $block['content'] = private_msg_messages_menu(); break; case 'sent_messages_form': module_load_include('inc', 'private_msg', 'private_msg_blockdata'); $block['subject'] = t(''); $block['content'] = private_msg_sent_messages_form(); break; case 'search_messages_form': module_load_include('inc', 'private_msg', 'private_msg_blockdata'); $block['subject'] = t(''); $block['content'] = private_msg_search_messages_form(); break; } return $block; } /** * autocomplete helper * $string = string for search */ function _users_autocomplete($string) { global $user; $matches = array(); if ($string) { $items = array_map('trim', explode(',', $string)); $last_item = array_pop($items); $prefix = implode(', ', $items); $result = db_select('realname') ->fields('realname', array('uid')) ->condition('realname', '%' . db_like($last_item) . '%', 'LIKE') ->range(0, 10) ->execute(); foreach ($result as $users) { if (!in_array($users->uid, $items)) { // $userdata = user_load_by_name($user->name); //====== Check contact status request approved or not ================// $query = db_query("SELECT status FROM {message_contact_status} WHERE (sentd_uid=:sentd_uid AND rece_uid=:rece_uid) || (sentd_uid =:sentd_uid1 AND rece_uid=:rece_uid1)",array(":sentd_uid"=>$users->uid,":rece_uid"=>$user->uid,":sentd_uid1"=>$user->uid,"rece_uid1" => $users->uid))->fetchField(); //============== check friends are not -------------------------// $datauser = user_relationships_load(array("between" => array($users->uid, $user->uid))); $datauser = array_shift($datauser); if($query || !empty($datauser->approved)){ $userdata = user_load($users->uid); $value = !empty($prefix) ? $prefix . ', ' . check_plain(@$userdata->field_name_first['und'][0]['value'])." ".check_plain(@$userdata->field_name_last['und'][0]['value'])."(". check_plain($userdata->name).")" : check_plain(@$userdata->field_name_first['und'][0]['value'])." ".check_plain(@$userdata->field_name_last['und'][0]['value'])."(". check_plain($userdata->name).")"; $matches[$value] = check_plain($value); } } } } $userdata = ''; drupal_json_output($matches); } //====================== Read Single messages on seperate page =============================// function private_msg_readpages($args,$args1){ global $base_url; global $user; $output = ''; if($args1 == 'sent'){ $query = db_query("SELECT pmid.*,pmiu.recv_uidg FROM {private_msg_inbox_data} pmid RIGHT JOIN {(select mid,group_concat(recv_uid) recv_uidg from private_msg_inbox_userdata group by mid)} as pmiu on pmid.mid = pmiu.mid Where pmid.mid=:mid and pmid.sent_uid=:sent_uid AND pmid.is_delete=:is_delete",array(":mid"=>$args,":sent_uid"=>$user->uid,":is_delete"=>0)); //return comma seperated value from second tables. $query1 = $query->fetchAll(); if(count($query1)){ @$output = "