우선 시작하기에 앞서.. 본 내용은 전문가가 제작한 내용이 아닌, 그저 질문답변을 통한 제작된 내용을 공유합니다.

 

혹여나 제가 나중에 이 내용을 또다시 쓸 일이 오거나, 다른 분이 저와 같은 방법을 쓸 때 사용하기 위하여 남겨둡니다.

 

 

 

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 에 다음의 코드를 입력한다.

 

 

 

 

function dispCommunicationFriendForMember()
{
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) 을 할경우 해당 멤버를 추가한 친구를 볼 수 있다.

 

 

ルイスP

profile
おはよう--、歌いてルイスです。
  • profile
    문제가 있거나 또는 작동하지 않는경우 댓글 달아주시면 감사하겠습니다..

    지금 좀 일이 많아 두서없는 글이라... 도움이 되셨으면 좋겠습니다.
  • ?
    감사합니다
  • profile
    구현에 성공하셨나보군요. 올려주신 팁 저도 잘 참고하겠습니다. 감사합니다~
  • profile

    "2-1. 우선 첨부파일의 getFriendsForMember.xml 을 다운로드 받는다." ...그런데 이 첨부 파일이 어디에 있나요...? 좋은 팁 공유해 주셔서 감사드립니다!! ^^

  • profile profile
    엇 파일이 누락되었나 보군요, 시간이 될때 본 글에 갱신하고 다시 댓글 달아드리겠습니다.


    또한, 하단의 문제의 경우에는 현재 넘겨지는 파라메터가 정상인지 아닌지 검사해볼 필요가 있습니다.
    자세한건 시간이 날때 쪽지 및 기타 내용으로 도와드리겠습니다.
  • profile profile
    답변해 주셔서 감사합니다. ^^ 네. 시간 나실 때 천천히 알려 주세요. 다시 한번 좋은 정보 공유해 주셔서 감사드립니다. ^^
  • profile profile
    안녕하세요, 해당 팁이 적용된 사이트와 증상을 쪽지로 남겨주시면 확인후 쪽지 드리겠습니다.
  • profile
    엄... 그런데 다들 위의 팁이 이상없이 잘 되시나요?? 저같은 경우에는 여러 가지로 문제가 있는 것 같습니다. 우선 나를 친구로 추가한 친구의 그룹명이 나오지 않구요. 그리고 나를 친구 추가한 친구 한 사람의 닉네임으로 여러 개가 나오는데 막상 회원정보를 보면 다 다른 친구들입니다. 즉 다른 친구들의 이름이 한 사람의 닉네임으로만 표시가 되는 것 같습니다. XE는 현재 최신버전인 1.8.43 버전을 사용하고 있는데, 다른 분들은 잘 되시는지 모르겠습니다....