开发者

I'm trying to use a PHP code for panel visibility in a Panels3 based on Friendlist

I'm trying to gain a truth value to gain panel visibility. I have a view in place in a panel to display a listing of heartbeat messages that belong to a user. The display works but I cannot figure out how to restrict access to the panel based on the user who is viewing the panel. Goal is I want the panel to only be visible to friends and some people with certain roles. The roles I can handle but I don't know enough about PHP to get it working based on friendship status. I vaguely guess it would be something like:

logged user is twoway with user being viewed based on current uid argument.

I know my example is nothing like the actual code but as I said I开发者_运维知识库 don't have much to go on here.


This should get you going.

global $user;

$friend_list = get_friend_list($page_uid_argument);

if (in_array($user->uid, $friend_list)) {
  // show messages
}

Where get_friend_list() is a generic function that grabs the user to user relationships based on UID, and returns an array of UIDs. I don't know what you are using codewise/modules.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜