Closed (fixed)
Project:
Flag
Version:
6.x-2.x-dev
Component:
Actions integration
Priority:
Normal
Category:
Feature request
Assigned:
Issue tags:
Reporter:
Created:
18 Jun 2009 at 17:58 UTC
Updated:
3 Jul 2011 at 19:15 UTC
Jump to comment: Most recent file
Comments
Comment #1
sirkitree commentedPatch says it is malformed. Here is a re-roll that works.
Comment #2
Scott Reynolds commented/me should stop rolling patches by hand...
Comment #3
simham_uk commentedHi folks
I've been away for a while but recently back into this and have installed the latest dev build and applied the above patches. I can configure individual flags but they aren't getting written to the activity table but there are writes to activity_access for the flagging events.
Any quick ideas on why this could be (or have I missed something?) before I go digging deeper?
Just noticed this is a Flag issue. I am referring to Activity module (latest dev build) with flag integration patches.
Thanks
Simon H
Comment #4
Scott Reynolds commentedgoto admin/settings/activity/settings (we know bad url...but alias we wanted the template listing to be the landing page) and tell activity to log flag access.
Comment #5
simham_uk commentedHi Scott
I had set both my 2 flag types already and left bookmark and comments blank. I figured this bit was ok, otherwise it wouldnt be logging in activity_access?
Any other ideas? I'll try to figure it out as soon as I get the chance. I presume the latest CVS and the above two flag patches are all I need?
Comment #6
simham_uk commentedHi folks
I've done a bit of work and have discovered a few issues in acitivity module and activity patch for flag module:
1. activity_get_module_info(), line 26 needs changed to
require_once $info->path .'/'. $module .'.activity.inc';so the include path is correct, as per the location of flag.activity.inc.2. In activty_record():
$record->uid = (!empty($context[$type]->uid)) ? $context[$type]->uid : $user->uid;$context[$type]->uid didnt exist and $user wasnt a global.
Where the main failure is, is at activity_record_check(), or rather, flag_activity_type_check() in the flag acitivity patch:
$token_objects['flag'] doesn't seem to exist, and therefore, $token_objects['flag']->fid doesn't exist.
So, this is where I'm stuck. Can you suggest a suitable replacement for flag_activity_type_check() or how we get 'flag' into $token_objects if required?
Thanks
Simon
Comment #7
simham_uk commentedHi again
I also noticed that when flagging, activities get logged for each flag type, regardless. And if each node has multiple locations (Location module) I end up with the flag activity logging 4 times, 2 flag types, 2 locations, 1 node. Any ideas on this one?
Thanks again
Simon
Comment #8
rjbrown99 commentedI have applied the #495524: Fix Flags Trigger implementation :-D patch as well as this patch and had a thought. I currently have a flag called 'favorite' which can apply to two different content types. Each content type appears at a different path that was created by pathauto. For example:
Content Type #1 - path is /type1/[nid]
Content Type #2 - path is /type2/[nid]
My flag action of 'favorite' can apply to BOTH content types. One of the challenges now is that the flag actions are not created as a 'trigger' of the node. So when I go to settings/activity/create and select flag, content has been flagged, I can do it but the public message now can't be linked back to the nodes because I could only provide a single path. I.E. I can only set the public message set to:
Person 1 flagged this
since the path will be correct for one node type but not the other.
One potential solution for my use case would be to move the flag action as a sub-type to the nodeapi. In that instance I would go to Create -> Node -> and one of the triggers would be "Flag". In this case I could then create a node flag trigger for each content type so I could correctly provide the two different paths.
Does that make sense?
Comment #9
rjbrown99 commentedI agree with #6 - the include path in activity seems to be incomplete. Since the new flag include is in the modulepath/flag/includes/flag.activity.inc, activity.module should do something like this starting around line 20:
Whereby the last elseif is the addition.
Even with that fix, it still doesn't work for me despite being configured under settings for the activity access control and having a created activity to record the flag type and display some output. Not sure why, but I am out of time for now.
Comment #10
Scott Reynolds commentedRe: include path...
From the patch
So that is handled already. There isn't an error there
Comment #11
Scott Reynolds commentedOk I have decided to combine these two patches. Makes my life a bit easier and no one else is really using Flags Trigger implementation
Attached it is a complete patch, including the fixes to flag_flag() function. Please remember that when reviewing this patch, patch -i flag_activity.patch will create a file flag.activity.inc in the ROOT of the flag folder. You must move that to flag/includes folder.
I have tested both flag and unflagged. There was a bug when an admin selected types that preventing recording that is now fixed. There was a bug with how flag fired its actions (namely, 'unflag') that is now fixed. And there was a bug with flag where it failed to declare an 'op' in the context array, that is now fixed.
Comment #12
Scott Reynolds commentedRe: #8 #495526-8: Activity2 Integration
#473946: Provide clean url tokens to node author profile has been committed with the fix so the urls will now work with pathauto. if you need help, or that commit doesn't fix it for you please take post on that issue, not here.
Comment #13
quicksketchHere's a reroll with the following nitpicks fixed:
- Fixed comments to be sentences, fixed line wrapping.
- Remove whitespace at end of lines.
- Clarified comments, fixed grammar.
- Changed the object keys to be all lower case in hook_activity_info(), since that's what activity module does. Should multiple words be separated with underscores instead of spaces?
A few questions:
Why can't user flags be recorded? Does this mean flags on taxonomy terms, files, or other datatypes aren't supported either? Maybe this should be hard-coded to only support node and comment rather than excluding only user.
When completed, this patch will only be applied to the 2.x version since it makes API changes and adds new functionality.
Comment #14
Scott Reynolds commentedIts because Token can't handle 'account' and 'user' together. We would have to create a pseudo hook_token implementation that grabs all tokens for 'user' and prefix them with flagged-user-. Then add the notable user object into the objects array. Sortof a huge mess.
Thats considerably larger undertaking
It is not reflective of the ability to handle other Drupal objects. User is difficult with token. Flag friend and others have to handle it differently as well.
Comment #15
quicksketchWell that's good news. Is there anything else that needs consideration here? I think things look good otherwise.
Comment #16
Scott Reynolds commentedIm really proud of this patch. I think it reflects a whole bunch of awesomeness. You can create a flag and follow someone. All activity (og, comments, flagging, node creation, status message updates) of the person you are following can be configured totally within a View. You can bookmark a node or comment and all activity happening on that node can be surfaced in an Activity View.
Its one of those things that makes you go "Wow I can build a View to do that?"
I would like to create a separate pass at user flagging as a follow up. I came up with pretty unique idea to handle it.
Comment #17
pribeh commentedHi Scott and quicksketch, thanks for your work on this. I've tried installing the latest (sept. 23) activity 2.x-dev module and the flag 2.x-dev, applying the patch in #13 and I get the following error after applying a 'activity access = flag' filter:
warning: Invalid argument supplied for foreach() in /Users/thomascermak/Sites/londonfuse/sites/all/modules/activity/views/activity_views_handler_filter_access.inc on line 64.Comment #18
marc.groth commentedHi all,
What is the status of the patch for 2.x? I ask because I tried installing the latest versions of flag and activity (both 2.x-dev) and applying the patch in #13 but get the error:
"The patch seems outdated! The file line
}
and the patchline
$output .= theme('table', $header, $rows);
do not match!"
Any ideas?
Thanks in advance.
Comment #19
marc.groth commentedAs well as this, when using TortoiseMerge, I see two patches on the left. One is named flag.module, the other is "null" (please see the attached screenshot)...
Comment #20
pribeh commentedHi Scott,
I know you're probably super busy. But any possible update on this? This type of feature could do wonders for one of my sites.
Thanks so much,
Thomas
Comment #21
Scott Reynolds commentedWould point out that the bug is probably because this patch adds a new file. And patch doesn't put that file in the right spot. Same for #19, that is why it is null, its a new file.
See: drupal.org/patch/create under the section Adding/Deleting Files Using the Diff Command
Just move flag.activity.inc form flag/ into flag/includes
Comment #22
pribeh commentedI feel stupid. Thanks Scott.
Comment #23
nitram079 commentedthis just made my day - really powerful stuff, wow! Big THANKS for the module to Scott, the patch to Scott & contribs!
Comment #24
Scott Reynolds commentedSounds like this is working for you guys. So marking as RTBC.
If it isn't please mark as needs work and why it isn't working.
Comment #25
pribeh commentedDefinitely working fine here. This should go in the dev.
Comment #26
quicksketchErg. RTBC patches that DON'T APPLY drive me nuts. This patch has been broken for the last month since #397464: Action for executing a flag was committed. I assume the users confirming this works were either using an earlier 2.x version or the 1.x version.
Anyway, other than that I agree that this patch is ready to go. So after a reroll and adjusting for the changes to the trigger integration, this is committed. Thanks Scott Reynolds for your work on this feature.
Attached patch that was committed.
Comment #27
nitram079 commentedmee -feed / you feed issue resolved, see here http://drupal.org/node/396960#comment-2227106
Comment #28
pribeh commentedYa, I haven't tested on the latest dev.
Comment #30
BenK commentedSubscribing...
Comment #31
pribeh commentedI just wanted to add in case BenK was interested that I've tested this thoroughly the latest devs of both flag and Activity 2.x and the integration works just as desired.
Comment #32
tallsimon commentedGreat please roll in to latest dev for more to try out with more ease!
Comment #33
adam_c commentedIm not sure if your plans cover my issue, I would like to add flags to activity streams, just like with facebooks 'like'. It does not seem to be possible as activity feeds are not actually nodes.
Comment #34
liliplanet commentedYes subscribe, thx ..
Is it possible to 'flag' an activity .. so not node or user, but the activity itself, same as 'I Like' in Facebook .. or am I missing something here :) ?
Comment #35
quicksketchLiliplanet, that is an different request. Flag does not support flagging anything other than Users, Nodes, and Comments; though it's API allows the flagging of anything. No more types will be added directly to Flag module however, so flagging of activity items will need to be a separate module.
Comment #36
ocamp commentedDo I still need to apply this patch or is it in any releases?
Comment #37
ocamp commentednvm got it working now.
Comment #38
Michsk commentedThis options doesn't seem to work with views3. New issue?
Comment #39
quicksketchYes, new issue.