Download & Extend

Add panels/ctools visibility control based on user relationships

Project:User Relationships
Version:6.x-1.0-beta10
Component:Code
Category:task
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

The attached patch is a ctools/panels plugin (wirapped in a small module) which allows visibility of a profile panel or pane to be determined based on the viewing user's relationship to the profile owner.

AttachmentSizeStatusTest resultOperations
user_relationships_panels_visibility_01.patch5.62 KBIgnored: Check issue status.NoneNone

Comments

#1

Here is another run at this patch/module based on feedback from merlinofchaos. This one allows you to select two users and the relationship between them

AttachmentSizeStatusTest resultOperations
user_relationships_panels_visibility_508524_02.patch5.17 KBIgnored: Check issue status.NoneNone

#2

On my site, the patch can not work, there has been the following error:Fatal error: “Cannot redeclare user_relationships_panels_visibility_ctools_access_settings() (previously declared in :”

I would like to have a solution, thank you

#3

@fafeng: Thanks for trying the patch. Please give the entire error message and maybe we'll know where it's been double-declared.

It sounds like perhaps the patch has been applied twice, or user_relationships is there twice?

Please grab a clean download of 6.x-1.0-beta10 and apply the patch to it. Then report back what the full error message is, and what you did to encounter it.

Thanks,
-Randy

#4

Version:6.x-1.x-dev» 6.x-1.0-beta10

Another round of the patch. I found that the #default_value was not being handled correctly.

AttachmentSizeStatusTest resultOperations
user_relationships_panels_visibility_508524_03.patch5.13 KBIgnored: Check issue status.NoneNone

#5

I don't have the cycles to get involved in testing this, unfortunately, but I wanted to say thanks for doing this. This will go well with APK.

Michelle

#6

Could you provide a shot description or screenshot how this patch works? I would give it a try but I don't understand the matter of the patch.

#7

Instructions on how to use the feature provided by the patch:

  1. Apply the patch
  2. Enable the module provided by the patch (UR-Panels Visibility)
  3. Now you have a Panels 3 access plugin that allows you to determine visibility of panes on a panel. So in a panel content display you can choose whether a pane is shown based on relationship. This is most likely to be used on /admin/build/delegator/user_view/panel_context/user_view_panel_context/content (the User View panel).
  4. On the pane configuration (the little "star" in the upper right corner), choose "create new visibility rule
  5. Configure based on two user profiles, probably "logged in user" and "user being viewed" the relationship between them that allows visibility for the pane.

You can also use the same technique to create a selection rule for the task handler.

This only works with Panels 3. (It's actually a ctools plugin; it may work with other things like views from merlinofchaos).

Although it might work other places, it's aimed at the user profile page.

Two screenshots attached show the creation and configuration of a new visibility rule.

AttachmentSizeStatusTest resultOperations
new_visibility_rule.png5.88 KBIgnored: Check issue status.NoneNone
visibility_rule_configuration.png10.87 KBIgnored: Check issue status.NoneNone

#8

Hi there!

Thanks four your detailed instructions. I applied the patch and activeted the new module.

If I try to add a rule (before any rule exists) I get this error on the Rule Creation Window:

warning: Invalid argument supplied for foreach() in /var/www/***/includes/form.inc on line 1200.

But I can add a rule and it is working well.

This module was exactly what I was looking for and should be immediatly added to the user_relationship module set.

Thanks a lot!

#9

@ayalon: Please confirm that you applied the patch in #4, as I remember that this was a problem before that.

#10

I found that when two patch after patch at the same time, there I am talking about the problem, then I can only patch the first.

#11

@fafeng: You must start over with each patch, as the patch is intended to be applied to the *original* files (6.x-1.0-beta10, but should work with any other as well). You can't patch it and then patch it again.

#12

thx,:P
I found the latest version has solved these problems?

#13

Which files are we supposed to patch?

#14

Like all contrib patches, this one is intended to be executed from the module's directory. http://drupal.org/patch

#15

hi guys,

thanks for the great work. It works fine for me, only when I set the options in panels (panels 3 btw) I get following error:

"warning: Invalid argument supplied for foreach() in C:\htdocs\site\includes\form.inc on line 1200."

I just ignore the error and it works but would be good to have it disappear. ;)

#16

I will be pleased to take a look at this, but you'll have to do some things for me to sort it out. You'll have to give a much more detailed explanation.

1. What path are you on when you have the problem?
2. What do you do (EXACTLY) that causes the problem?
3. Is it possible that other modules are involved?

Please export your panel and attach it if you'd like me to work on it.

Even better: Send me your database and the exact version of Drupal core that you're using. http://drupal.org/user/30906/contact

-Randy

#17

@mitkoru, #15, I took a look at your issue and was able to recreate it. It was (as you surmised) a trivial issue that did not affect functionality. However, it's fixed in this patch (attached).

Those of you who are using this: If it works for you, why don't you mark it "reviewed and tested by the community".

AttachmentSizeStatusTest resultOperations
user_relationships_panels_visibility_508524_04.patch5.16 KBIgnored: Check issue status.NoneNone

#18

Status:needs review» reviewed & tested by the community

I tested it and it works. It's on my live site..

#19

Forgive the n00b, question.... I took a look at http://drupal.org/patch/apply and the only thing that isn't clear to me between reading that and this, is where I should apply the patch? Do I put it in the user_relationships/ module directory or the panels directory or some subdirectory of one of them so that I can actually run the patch < file.patch command, or does that even matter?

#20

nevermind! I ran it from the user_relationships module dir and worked fine...

#21

Oooh... I'd forgotten this issue existed. I was planning on writing this in the next month or so. Thanks for keeping me from re-inventing the wheel. LOL

Michelle

#22

Status:reviewed & tested by the community» fixed

Committed in http://drupal.org/cvs?commit=279844. Thanks a ton to @rfay and testers!

#23

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

#24

Not sure if this would be an add-on to this sub-module and a new module altogether but I want users to be able to determine what relationship types are able to see each pane on their profiles.

There are some cck type privacy modules out there such as 'cck private fields' which place a little image in the top right of a cck field on the node edit form, you click on it, a jquery popup appears asking you who you want to be able to view that cck field.

I would like this same kind of functionality but for the blocks on a profile page.

I'm sure alot of people would find this a useful feature, is that a safe assumption?

I'm just not sure what the best approach to this this problem would be.

thanks

#25

Is it possible to create a negative relationship? I mean... can we display the panel if the user being viewed and the logged in user IS NOT a friend?

Right now, I don't have any problems creating a panel and making that panel viewable to users that are friends. It's pretty simple. First User = user being viewed; and Second User = Logged in User. Then you click on the Friend tick box to make that panel visible only to friends.

However, I'd like to create a panel that is Visible only to non-friends. This is useful for FB like pages when an authenticated user clicks on someone's user profile, and we can display a panel block that says...

"This user has set their profile to private. You must add this person to your friend list to see this profile."

This would prompt the user to send a friend request. Once the friend request is approved and the relationship is established, the other panels would show up and the "profile is private" panel would disappear to all friends.

I have only been successful in creating panels that appear when 1st user is user being viewed, and 2nd user is logged in user, relationship = friend.

Is there a tickbox that would be something like this...

Display only if 1st user and 2nd user:

EQUAL TO
NOT EQUAL TO

X Friend
X Classmate
X Child
X Etc...

Thanks in Advance for the assistance!!!

AttachmentSizeStatusTest resultOperations
UR-panels.jpg27.79 KBIgnored: Check issue status.NoneNone

#26

If I understand the question correctly, this is more of a panels support question.

The current version of Panels has a "NOT" selection in visibility rules. You should be able to use that to get something like what you want.

I'm sure you're experimenting with visibility rules already... It's been a long time since I used this so I don't have much more to offer right now.

nobody click here