Often you want views droplets to be customized appropriately for the current user. Sometimes you can use a 'current user' filter for this, but that only works if users are only allowed to see their own MySite (otherwise they see a droplet customized for them on another users MySite page), and sometimes only an argument is provided by the module you are pulling content from (rather than a filter).
This patch passes arg(1) - the UID of the MySite page being viewed (often the current users UID) into the view, and also adds it to the 'read more' link for that view.
This is relatively safe, as any views with no argument configured will simply ignore it. This could, however break views that are relying on MySite passing no argument in (e.g. because they have taxonomy IDs are the first argument, and only every want to show the default 'no argument' view in the droplet). If we want to support these types of views (without people needing to clone them) we will need to add an option to enable/disable argument passing, but then we are in danger of heading into token or panels context type functionality which could be feature creep for what we need here.
| Comment | File | Size | Author |
|---|---|---|---|
| druplet_uid_arg.patch | 1.5 KB | owen barton |
Comments
Comment #1
agentrickardRight. This may be a single use solution. It is, however, related to http://drupal.org/node/200945.
I think we may have to pass the Droplet content to a hook to let other modules make modifications on-the-fly. Otherwise, we have to enable argument or token replacement logic when creating the Droplet.
Filing against HEAD.
Comment #2
agentrickardDoes http://drupal.org/node/198904 solve your issue as well?
Comment #3
owen barton commentedAdded a comment over there - I think that passing an argument is still preferable.
Comment #4
patchak commentedThis is great, would it apply to mysite v3 ??
Patchak
Comment #5
agentrickardThe patch above should apply fairly cleanly. You might get an 'offset' message, but you can ignore that.
Comment #6
patchak commentedI applied this patch on mysite version : 5.x-3.0 and it seems to be working, as the right argument is passed.
I get this error on the mysite admin section tho:
# warning: include_once(sites/all/modules/mysite/plugins/types/droplet.inc.inc) [function.include-once]: failed to open stream: No such file or directory in /var/www/html/www/yelp-like/sites/all/modules/mysite/mysite.module on line 3423.
# warning: include_once() [function.include]: Failed opening 'sites/all/modules/mysite/plugins/types/droplet.inc.inc' for inclusion (include_path='.:/usr/share/pear') in /var/www/html/www/yelp-like/sites/all/modules/mysite/mysite.module on line 3423.
It seems to be working at it's pretty cool!!
Patchak
Comment #7
agentrickardThat error means that Drupal is looking for a misnamed file
droplet.inc.incshould bedroplet.inc.Check the names of the files in your plugins/types directory.
This is not normal behavior and may be due to changes you have implemented.
Comment #8
B747 commentedI am getting the same error as patchak after applying the patch, so I can only assume it's an error with the patch. Anyone care to shed some light, please?
Comment #9
Rival24 commentedI'm having exactly the same problem and I'm can't find any reference to droplet.inc.inc in any of the other mysite files.
I'm not entirely sure if my interpretation of this patch is correct. If a bunch of users create a page with a couple of droplets, and I'm going to visit a page other than my own (with a buddylist droplet for instance) I don't want to see the stuff that applies to me. I want to see the buddies of the person that created the site. Is this correct?
Rival24
Comment #10
agentrickardComment #11
agentrickard