Add panels/ctools visibility control based on user relationships

rfay - July 2, 2009 - 18:40
Project:User Relationships
Version:6.x-1.0-beta10
Component:Code
Category:task
Priority:normal
Assigned:Unassigned
Status:closed
Description

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.

AttachmentSize
user_relationships_panels_visibility_01.patch5.62 KB

#1

rfay - July 3, 2009 - 19:46

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

AttachmentSize
user_relationships_panels_visibility_508524_02.patch 5.17 KB

#2

fafeng - July 5, 2009 - 06:04

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

rfay - July 5, 2009 - 14:01

@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

rfay - July 5, 2009 - 15:50
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.

AttachmentSize
user_relationships_panels_visibility_508524_03.patch 5.13 KB

#5

Michelle - July 5, 2009 - 16:18

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

ayalon - July 6, 2009 - 12:17

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

rfay - July 6, 2009 - 12:34

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.

AttachmentSize
new_visibility_rule.png 5.88 KB
visibility_rule_configuration.png 10.87 KB

#8

ayalon - July 8, 2009 - 13:29

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

rfay - July 8, 2009 - 13:36

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

#10

fafeng - July 10, 2009 - 02:13

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

rfay - July 10, 2009 - 02:16

@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

fafeng - July 10, 2009 - 02:41

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

#13

kevin riggen - July 29, 2009 - 17:02

Which files are we supposed to patch?

#14

rfay - July 29, 2009 - 17:40

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

#15

mitkoru - July 30, 2009 - 14:25

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

rfay - July 30, 2009 - 14:26

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

rfay - August 2, 2009 - 04:38

@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".

AttachmentSize
user_relationships_panels_visibility_508524_04.patch 5.16 KB

#18

ayalon - August 3, 2009 - 14:55
Status:needs review» reviewed & tested by the community

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

#19

n00b0101 - September 30, 2009 - 17: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

n00b0101 - September 30, 2009 - 17:21

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

#21

Michelle - September 30, 2009 - 17:24

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

alex.k - October 25, 2009 - 21:14
Status:reviewed & tested by the community» fixed

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

#23

System Message - November 8, 2009 - 21:20
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.