친구 목록을 모두에게 보여주며, 날 추가한 친구를 보여준다.
우선 시작하기에 앞서.. 본 내용은 전문가가 제작한 내용이 아닌, 그저 질문답변을 통한 제작된 내용을 공유합니다.
혹여나 제가 나중에 이 내용을 또다시 쓸 일이 오거나, 다른 분이 저와 같은 방법을 쓸 때 사용하기 위하여 남겨둡니다.
1. 로그인과 관계 없이 보여주려면.
root/modules/communication/communication.view.php 파일에서 약 286번째 줄의 dispCommunicationFriend()함수의
// Error appears if not logged-in의 아래 기능 코드인
if(!Context::get('is_logged'))
{
return $this->stop('msg_not_logged');
}
를 삭제한다.
본 코드는 만약 로그인 되어있지 않을 경우. 즉, 로그인된 정보를 가져오지 못했을 경우 로그인 해달라는 경고창이 뜨는 내용이다.
본 내용은 로그인과 상관없이 특정 유저(주소창에 member_srl 항목이 전달되어야함.)의 친구와 특정 유저를 추가한 사람을 보기 위한다면 추가해야한다.
2. 친구를 추가한 정보를 가져오려면.
기본적으로 XE나 Rhymix에서는 제공하지 않는 기능이다.
본인의 친구만 보여줄 수 있지만, 본인을 추가한 친구는 알 수 없었다.
#633447 의 글로 가능해졌다.
본 작업은 @윤삼 님의 도움으로 가능해진 기능입니다.
2-1. 우선 첨부파일의 getFriendsForMember.xml 을 다운로드 받는다.
2-2. 해당 파일을 root/modules/communication/queries 에 업로드 한다
2-3. communication.view.php 에 다음의 코드를 입력한다.
{
if($this->config->enable_friend == 'N')
{
return $this->stop('msg_invalid_request');
}
$oCommunicationModel = getModel('communication');
// get a group list
$tmp_group_list = $oCommunicationModel->getFriendGroups();
$group_count = count($tmp_group_list);
for($i = 0; $i < $group_count; $i++)
{
$friend_group_list[$tmp_group_list[$i]->friend_group_srl] = $tmp_group_list[$i];
}
Context::set('friend_group_list', $friend_group_list);
// get a list of friends
$friend_group_srl = Context::get('friend_group_srl');
$columnList = array('friend_srl', 'friend_group_srl', 'target_srl', 'member.nick_name', 'friend.regdate');
$args = new stdClass();
$args->member_srl = $logged_info->member_srl;
if(Context::get('member_srl')) $args->member_srl = Context::get('member_srl');
$output = executeQuery('communication.getFriendsForMember',$args);
$friend_count = count($output->data);
if($friend_count)
{
foreach($output->data as $key => $val)
{
$group_srl = $val->friend_group_srl;
$group_title = $friend_group_list[$group_srl]->title;
if(!$group_title)
{
$group_title = Context::get('default_friend_group');
}
$output->data[$key]->group_title = $group_title;
}
}
// set a template file
Context::set('total_count', $output->total_count);
Context::set('total_page', $output->total_page);
Context::set('page', $output->page);
Context::set('friend_list', $output->data);
Context::set('page_navigation', $output->page_navigation);
$this->setTemplateFile('friends');
}
2-4. 이후 communication/conf/module.xml 에 다음을 추가한다.
<action name="dispCommunicationFriendForMember" type="view" permission="member" />
act에 ?act=dispCommunicationFriendForMember를 하여 보면 나를 추가한 친구를 볼 수 있다.
또한 &member_srl=(특정 멤버 srl) 을 할경우 해당 멤버를 추가한 친구를 볼 수 있다.
댓글 8
지금 좀 일이 많아 두서없는 글이라... 도움이 되셨으면 좋겠습니다.
"2-1. 우선 첨부파일의 getFriendsForMember.xml 을 다운로드 받는다." ...그런데 이 첨부 파일이 어디에 있나요...? 좋은 팁 공유해 주셔서 감사드립니다!! ^^
또한, 하단의 문제의 경우에는 현재 넘겨지는 파라메터가 정상인지 아닌지 검사해볼 필요가 있습니다.
자세한건 시간이 날때 쪽지 및 기타 내용으로 도와드리겠습니다.