只允许朋友在他们的个人资料页面上发表评论


allowing just friends to comments in their profile page

我有一个包含评论系统的个人资料页面,我只是允许个人资料的所有者写他们的评论,现在我想让朋友也写怎么做??

在成员表中,我有一个friend_array字段,其中包含与该用户为好友的用户的id

好友请求系统包括ajax和jquery <标题> code.php h1> friend_requestrongystem h1> div class="answers">

if($_SESSION['user_id']==$id)是特定于博客所有者的,对吗?因此,如果会话id在可接受的id数组中,则进行条件检查。像这样:

// assuming you already populated the $iFriendArray as outlined in your question
$iFriendArray[] = $id; // add blog owner to the friend array

if(in_array($_SESSION['user_id'], $iFriendArray))
{
    // can comment
}

这已经更新为使用在你的问题中更新的朋友数组。

有任何问题请随时提问,我可能会更新。