Closed (fixed)
Project:
Flag
Version:
7.x-3.x-dev
Component:
Miscellaneous
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
11 Nov 2008 at 15:27 UTC
Updated:
30 Nov 2012 at 09:10 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
mooffie commentedThis screenshot shows how Panels' "Add content" box looks after applying the patch. You can see three flag-links there (one for each flag).
Those of you having x-ray vision can also see two user flags (they're hiding behind the "Screen S" window. Yeah, this screenshort is damaged, but I noticed that too late and it's a pain for me to make another, on my old computer.)
Comment #2
mooffie commentedNOTE TO DRUPAL 5 USERS:
If you're using Bio, or Usernode, you want to load this node. Panels has the concept of "Relationships". The "Relationship" section is on the "Context" tab. You'll be able to load the user's usernode there (I don't know about Bio). Once you add this node to the game, you'll have "Node context" in your "Add content" box (as in the screenshot).
Comment #3
mooffie commentedComment #4
mooffie commentedHere is a revised patch, where the code is moved to an '.inc' file. Because of the way Panels loads things, the Panels support shouldn't be placed directly in the 'includes' folder but in a folder of its own.
1. Apply the patch.
2. Put 'link.inc' in 'includes/panels'.
Comment #5
typehost commentedI am working on a site using Bio & Advanced Profile. I patched the Flag module, created & uploaded the links.inc file to includes/panels.
Created a bookmark only for Uprofile type, added "Node ID" as an argument & "User uprofile" as a relationship in the advanced profile panels page (see: screenshot).
(Note: by default, the advanced profile panel only had "User ID" as an argument and "Node from user" as relationship.)
No Flag blocks showing in the content section pop-ups.
Any suggestions on what needs to be done to configure this would be appreciated.
Comment #6
mooffie commentedAre you using D5? This patch wasn't tested on D6.
Could you please add the following line to the start of function flag_link_panels_content_types() (in link.inc) ?
(The purpose here is to verify that Panels loads and calls our code. You should see that 'Hello! ...' when configuring the panel.)
Comment #7
typehost commentedI have added:
to the link.inc file, and do not see "hello" when configuring the panel.
What I really need to do is be able to print the flag link in a specific part of a Panels block - which has a self-existing (APK) template.
Note: it is 5.x we are working with.
Comment #8
mooffie commentedGood. Problems where nothing happens are usually easier to solve.
Note that this "hello" you're supposed to see in Drupal's message area right after you click the "Content" tab. Perhaps you looked for it somewhere else.
The next step is to add the following...
...to the "global" level of the link.inc file. In other words, somewhere outside of any function.
You should see this new message when you click the "Content" tab.
Make sure your server has permission to read this file. For example, if you created that link.inc file with only "600" permission, and the server isn't running as "you", then PHP won't be able to load this file.
Comment #9
typehost commentedI added
to the link.inc file - checked the permissions, it was set to 644
Changed the permissions to 755 (folder is also 755)
"This link.inc file was loaded!" message did not appear in the message section
Comment #10
Flying Drupalist commentedHi, D6 please! :)
Comment #11
mooffie commentedGreat.
Now, open 'flag.module' in an editor. Locate the function flag_panels_include_directory(). Add the following line at the beginning of its body:
Let me know what messages, if any, you now see.
Comment #12
typehost commentedI added
And I see the message as listed when first navigating to the panels page (list) - by the time I get to the settings page it is displayed 5 times in the message box.
Comment #13
typehost commentedTo be more specific, on the content page:
Comment #14
mooffie commentedtypehost, I want to make sure the server user can read the 'link.inc' file:
Create a new node, having the "PHP" input format.
Paste the following into its body:
When you preview, or view, this node, you'll see "File exists...and is readable", and in the message area you'll see "This link.inc file was included!" (provided you didn't remove that message form that file). Please confirm.
Comment #15
typehost commentedI received:
which made it clear the mistake was I uploaded the file to /includes/panels (drupal core) and not to the flag module directory
changed that and received:
Flag bookmarks now showing in the add content section of panels (thanks)
only thing - getting a "missing content type - Deleted/missing content type flag_link"
I have this bookmark only set to uprofile type, same result though when biography & user node are enabled
+ "Node from User" / "Node ID" / "User uprofile 2" are my three choices for the block configuration
the settings in context are the same as the screenshot above (panels.png)
Comment #16
typehost commentedResult I end up with is: Flag "" is not defined.
Comment #17
typehost commentedBumping this again as I need to solve the issue - 1) is what is the reason for the Flag is not defined result, and 2) is there still not anyway to simply print the flag link in the template of the advanced profile page?
Comment #18
mooffie commentedBug(s). In Panels, it seems. The good news is that I can reproduce the problem on my system, so I'll be able to debug it. I'll report back soon.
Comment #19
mooffie commentedHere's the updated Panels support.
1. Undo all the changes you made to the module.
2. Apply the patch.
3. Put 'flag.panels.inc' (make sure to fix the attachment's name) in the 'includes' sub-folder of the Flag module.
(You may have to re-add the links to the Panel. I don't know if the old links will work because Panels caches things.)
Comment #20
typehost commentedNice - it is working perfectly now. I really appreciate your attention to these issues and assistance in working out the bugs. The functionality is important to our sites - many thanks.
Comment #21
thelocaltourist commentedHow do I do this for D6?
Created flag.panels.inc
Added patch to flag.module
Uploaded
Flags appeared on Add Content To... in Panels2. When I inserted received the error: Error: Flag "f" is not defined.
Comment #22
Stan.Ezersky commentedHow to do it in Drupal 6?
Comment #23
mooffie commentedI don't know, I don't have access to Drupal.
Basically, Panels 2.x for D6 was supposed to be a straight port of Panels 2.x for D5. If the patch doesn't work in D6, as comment #21 suggests, it might mean they have changed the API slightly.
Comment #24
Witch commentedoh no :\ what can drupal 6 users do now? i need this feature.
hope that somebody can do this. i appreciate this very much!
Comment #25
ctalley5 commentedSame here
Comment #26
ctalley5 commentedsubscribe.... D6 & Panels 3???
Comment #27
mrgoltra commentedsubscribing. Trying to get this to work.
Comment #28
chaosprinz commentedalso subscribing for Drupal6 & Panels3
Comment #29
quicksketchNeeds work for the D6 version of panels (3.x), at this point I don't think it's worth maintaining a Drupal 5 version of this feature.
Comment #30
ctalley5 commentedhas anybody else had any luck with this yet
Comment #31
henrijs.seso commented+1
Comment #32
quicksketchMoving to 2.x where all new features are being added. I don't use Panels module so I'm very unlikely to develop such a feature. Unless a community developer puts this together, this is unlikely to happen.
Comment #33
webanalya commentedalso subscribing for D6 & Panels 3
--------------
I circumvented the problem by amending node.tpl.php of my theme:
- inserting
print flag_create_link('bookmarks', $node->nid);in the link section ;- create a pane with node > node links
Comment #34
nitram079 commentedThere is actually a quite easy solution for this, however, not as easy as directly from panel. Here is what you do:
- create a view that displays a flag link for the corresponding node
In my case, I have a node type for a video page on my site and have three flags: like, bookmark, report
Below is the views export for a) only one flag (in my case the like flag) and b) for all three of my flags
Comment #35
BenK commentedSubscribing...
Comment #36
coolhandlukek2 commentedSubscribing...
Comment #37
glitz commentedsubscribing. need to attach a flag to a panel page.
Comment #38
henrijs.seso commentedPanels integration must include:
- Ability to add flags to node/user pages
- Ability to check if content is flagged in access rules
- Ability to check flag status in selection rules, so page can use different variants depending on flag status
- Load flag and flagger as context and/or argument
- ... (more?)
Comment #39
glitz commentedgot it, thanks
Comment #40
freelylw commentedwhen we will have a panels version of flag ? its a important function since panels is widely used in drupal.
Comment #41
quicksketchWhen someone writes it. :P
I don't use Panels, and I'm not going to write integration for something I don't use. Considering I won't be able to maintain such code, it may end up in a separate project entirely.
Comment #42
henrijs.seso commentedok, ill write it, im not much of a writer, but I hope it will turn out awesome... right now I am consulting with allmighty merlin over at #889088: flag ctools integration. go there, there is some code you can try out...
Comment #43
henrijs.seso commentedcontent type plug-in is also available at #889088: flag ctools integration It will allow you to display flag links as well as display flag status in panels.
Comment #44
henrijs.seso commentedthis is latest version, wrapped into a module. Drop this in flag folder or in modules, activate under Flags.
Has access and content types plugins, other soon. Questions, comments?
Comment #45
g76 commentedThis would be incredible, thank you so much for your work.
I can seem to get it to work, I was hoping you could help, it may be something I have done wrong. I am not a coder, but would be more than happy to be an active tester if you have need. I have dropped ctools_flag into the modules dir, but I am not seeing any change in panels.
Your module would be a complete solution to what I am looking for, so I can not thank you enough. I have been looking for a way to create panels "layout" variants and be able to select them or change them on the fly instead of creating/cloning variants for each instance. Since my navigation/site structure is taxonomy based and I am overriding the tax term view in panels, I thought it may be possible to use the flag terms module to flag a term in the site structure vocab as "Layout 1", "Layout 2", etc... and then apply the flag as a selection rule. This would negate the need to create cloned variants per tax term just to change the panel page a bit. Also, the layouts can be adjusted on the fly.
I hope this makes sense. If there is another way to accomplish this that you know, please let me know. I would love any input you would have to offer.
thanks again
Comment #46
henrijs.seso commentedCurrently only node flags are supported, Ill work on it a little more to add user and term support.
Comment #47
g76 commentedthank you so much.
Comment #48
lpalgarvio commentedsubscribing
Comment #49
lpalgarvio commentedgood job :)
i can confirm that it is working well, when directly included in a Panel
-------------------------------------------------------------------------------------------------------
Flags also work well as before, with or without this module, when using as a Field in a View included in a Panel.
the View itself also works well, even with a nid argument (which is supplied by Panels when inside a panel).
so there is no conflict, even when using both methods at same time in a panel :P
-------------------------------------------------------------------------------------------------------
please commit to the module, in the main module or as a standalone module (included or not with Flags).
thanks
Comment #50
mooffie commentedLavaMeTender, it would be nice if you published this module on Drupal.Org, as an independent module.
Comment #51
lpalgarvio commentedworks pretty well :)
commit it somewhere :P
Comment #52
lpalgarvio commentedother working solutions:
Fivestar panels integration - http://drupal.org/node/703614
Ubercart panels integration - http://drupal.org/node/658732
Comment #53
henrijs.seso commentedThis will be independent module as soon as it is ready.
Comment #54
Vote_Sizing_Steve commentedSubscribing
Comment #55
freelylw commentedIs user flags are supported now ? I am using the APK, waitting for the user flags, thanks
Comment #56
rbrownellAny activity on this? What are our options?
Comment #57
rbrownell#53 What is the module going to be called? Does it have a project page yet?
Comment #58
itserich commentedSo to add flags for panels, the zip file in #44 is downloaded into all/modules OR all/modules/flag and extracted?
Then enabled?
Thank you!
EDIT I installed the zip in all/modules, extracted it, enabled it like a regular module. Went to a panel -> add content -> flag -> flag links.
Seems to work great. Hope it becomes a module, easier for people to find!
Thank you!
Comment #59
lpalgarvio commentedworks just like a regular module
Comment #60
itserich commentedYes thank you it is a big relief.
Comment #61
kevinwalsh commentedTested, works great.
Comment #62
itserich commentedIt should be made easier to find, if possible.
Comment #63
tim.plunkettWhat is left for this to be released?
Comment #64
henrijs.seso commentedStill under construction.
Comment #65
tim.plunkettIs it going to be a sub-module or standalone? Either way, can it go into CVS?
Is it being developed on github or something?
If it was on d.o, then users could open up issues against it, or at least see what the timeline was.
Comment #66
freelylw commentedany progress for this module ? Thanks
Comment #67
bjsomers commented+1
Comment #68
lpalgarvio commentedNeeds caching support in Panels. and with AJAX.
at this point, for it to work, you should disable global caching for the panel in question, and instead enable local caching for each item you place as content in your panel, except for flag.
Comment #69
Exploratus commented+1
Comment #70
marcxy commentedNode: Profile Node
User: User being viewed
Flag: Bookmarks
When I add to my "Content Profile/APK" panel, I see this when I click on a user:
* warning: array_keys() [function.array-keys]: The first argument should be an array in /home/marc/domains/mywebsite.com/public_html/sites/all/modules/flag/flag.inc on line 347.
* warning: array_intersect() [function.array-intersect]: Argument #2 is not an array in /home/marc/domains/mywebsite.com/public_html/sites/all/modules/flag/flag.inc on line 347.
* warning: array_keys() [function.array-keys]: The first argument should be an array in /home/marc/domains/mywebsite.com/public_html/sites/all/modules/flag/flag.inc on line 347.
* warning: array_intersect() [function.array-intersect]: Argument #2 is not an array in /home/marc/domains/mywebsite.com/public_html/sites/all/modules/flag/flag.inc on line 347.
* warning: array_keys() [function.array-keys]: The first argument should be an array in /home/marc/domains/mywebsite.com/public_html/sites/all/modules/flag/flag.inc on line 347.
* warning: array_intersect() [function.array-intersect]: Argument #2 is not an array in /home/marc/domains/mywebsite.com/public_html/sites/all/modules/flag/flag.inc on line 347.
Comment #71
marcxy commentedWhen I switch to
User: No Context
the errors are gone.
However, in both cases, I still do not see a link.
thanks!
Comment #72
karlitos commentedWOW!!! thank you soo much for this patch. Works great!!
Comment #73
Shadlington commentedSubscribing
Comment #74
lsolesen commented+1
Comment #75
amitaibuHere's a new take, for D7 (porting back to 6 should be fairly easy).
Patch adds a ctools plugin that allows you to select the flag, and pass user/ node/ comment context, and on render uses flag_create_link() if context really exists.
Comment #76
amitaibuHere's the D6 version
Comment #77
amitaibuMinor fix -- have the flag's name as the block delta instead of the flag ID. Attached D6 and D7.
Comment #78
amitaibuHere's a screenshot.
Comment #79
jastraat commentedExpanding on the idea of ctools integration, I've written an access plugin for checking if a node is flagged. (This would require the flag_ctools_plugin_directory function from above, and this include file would go in plugins/access.)
Comment #80
amitaibu@jastraat ,
1) Please open a different issue.
2) Please patch is correctly.
3) Flag is not node centric, the patch, similar to mine should allow user/ node/ comments (at least).
Comment #81
jastraat commentedMy hesitation for opening a separate issue is that this depends on the flag_ctools_plugin_directory function as well. Should I assume that function does not exist in flag when I create a patch file?
Comment #82
perarnet commentedPatch in #77 applied against 7.x-dev and tests so far shows it is working well
Comment #83
rogical commented+1
hope to see this fixed soon
Comment #84
fuzzybearuk commentedWould really appreciate some help here. I applied the ctools-plugin-flag-77-d7.patch but still cannot get the flag to work in Panels - I presume there should be an option in the panels content options?
Comment #85
Shadlington commentedComment #86
dddave commentedper #84 and I guess this patch need a reroll anyways.
Comment #87
andypostprobably D7 could use Entity context and limit flags with entity type
Should they filtered by node-type
Comment #88
amitaibu@andypost, the patch in #77 is the correct one.
Comment #89
andypostI thonk #77 & #79 should be in one patch -access and content type plugins
Comment #90
Shadlington commentedAny progress on this?
#77 worked perfectly for me (though the patch isn't formatted correctly - needs the a/bluh b/bluh style)
Comment #91
andypostBoth #77 and #79 needs re-roll & re-factoring to able to be used with any entity that Flag module supports.
Probably#79 should be filed as another issue because it introduces
#77 Content-type plugin
This should be converted to Entity:
same
#79 Access plugin
Any supported entity type!
This logic require some work
Comment #92
joachim commentedComment #93
jherencia commentedOk, here is #77 rerolled and adapted to entity as #91.
I'm currently working on the access plugin.
Comment #94
jherencia commentedAnd here is #77+#79 rerolled to 7.x-3.x and compatible with any entity.
Comment #95
andypost@jherencia Awesome! I think this needs more reviews and manual testing. Overall looks great!
Minor things... I can't test them right now
now sure it works, suppose list($id,,) better
Interesting solution, should be tested
Suppose here need a check that entity type is flaggable
Comment #96
joachim commentedComment #97
avr commentedI needed this functionality so I took a quick look at the patch in 94 and updated the few items mentioned by @andypost.
The
flag_flag_link_content_type_infois working as expected for me - in panels with node and user contexts (and a combination of the two).From what I can tell
flag_create_linkalready provides all the necessary access checks throughflag::access.One other note, it would make more sense to me to use the
$info['label']for the category within Panels. When looking for the user link, I immediately when to the "User" category first - before checking "Entity".I didn't check anything with the access plugin.
Comment #98
joachim commentedLooks good.
Spotted this which looks like a 2.x API flag property:
I don't have panels installed myself, so I'd appreciate it if users of panels could try this out and give feedback.
Comment #99
avr commentedYep - completely missed the version number here. I had 2.x installed (at least you know it can be backported!).
I'll test again with 3.x-dev and update that property.
Comment #100
avr commentedOkay - tested with the 3.x-dev version and updated property.
I went ahead and created separate patches: 1 for the access plugin, 1 for the content type plugin, and one that combines both.
Comment #101
avr commentedUpdating status
Comment #102
Wayne22 commentedIm pretty new to drupal, how do you apply the patch ?
Could you patch the file and Post it along with where to replace it in the directory?
Comment #103
joachim commentedGoogle it ;)
http://drupal.org/patch/apply
Comment #104
Wayne22 commentedCould you patch the file and Post it along with where to replace it in the directory?
I am not a great DRUPAL NINJA such as yourself. Thank you
Comment #105
mvc@avr works perfectly for me, worth upgrading to 3.x for :) thanks!
@Wayne Leyden: with all due respect, using development branches of modules, let alone applying experimental patches, is an advanced drupal skill. if you don't know how to do it yourself and your technical level is not high enough to follow those instructions, you probably should wait until the change has been officially reviewed and applied.
Comment #106
joachim commentedCould I have a single patch please, rather than 3?
Comment #107
avr commentedThe first patch in the group above is a single patch.
Comment #108
andypost#100 flag-ctools_integration-332956-100.patch is right one
Comment #109
jherencia commentedHappy to see this RTBC, thank you @avr to continue my work :).
Comment #110
joachim commentedCommitted, with a few tweaks:
- 'node' changed to 'entity'
- a few documentation changes
Thanks to everyone who's worked on this.
Issue #332956 by Amitaibu, mooffie, jherencia, avr, jastraat: Added Ctools plugins for content type and access.
Comment #112
cromian commentedHi everyone sorry to bother but was this added to 7.x-2.1? or 7.x-3.2 I am using 7.x-2.1 due to flag friends and wanted to know what patch I should use?
Comment #113
cromian commentedHi everyone sorry to bother but was this added to 7.x-2.1? or 7.x-3.2 I am using 7.x-2.1 due to flag friends and wanted to know what patch I should use?
Comment #114
pasqualleThe ctools integration is in 7.x-3.2 (and 7.x-3.x-dev).
The 7.x-2.1 (and current 7.x-2.x-dev) release does not have ctools integration.