Closed (fixed)
Project:
Views Global Filter
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
20 Mar 2012 at 10:01 UTC
Updated:
29 Dec 2012 at 13:38 UTC
Jump to comment: Most recent file
Comments
Comment #1
Ingmar commentedWhat's your opinion on this Rik, would it be difficult to develop? I remember you've developed the 'take default from normal user' very fast.
Comment #2
rdeboerShould be fairly straightforward. But have no time for at least two weeks.
Patches welcome!
Rik
Comment #3
rdeboerOMG... that was April when I said no time for two weeks.... It dropped off my radar....
Haven't given up.... It's still in the back of my mind... sorry.......
Comment #4
Ingmar commentedhehe:) Time flies when your having fun (I hope). Would still be handy.
Comment #5
rdeboerIt's back on the shortlist!
Rik
Comment #6
rdeboerDone and checked in.
Both any number of profile2 user profiles and the core user account profile are scanned upon login for any global filter field values. You may mix the two.
If a global filter field appears on both a profile2 profile AND the core user profile, then the profile2 field takes precedence.
See latest 7.x-1.x-dev (17 Sept 2012 or later).
Comment #8
delvalle commentedThanks a lot! I was also looking for this feature. Now I'm starting to implement it and I have two questions:
1) Using this new feature, I will only apply views filters based on the selections in the user profiles (Profile2 in my case), without using any Global Filter block or cache features in my site.
I'm not sure, but I think Session Cache API is not used anymore in this use case, so maybe it could be possible to remove it as a required dependency of Global Filter module. If this is not possible, I would like to know what Session Cache storage option is more recommended for my case (I don't need any cache storage, but it's mandatory to select one option if the Session Cache module is enabled).
2) Now the changes in user profiles are evaluated only at login, so the users must logout and login again in order to have the changes applied to the corresponding filters and views (not very user friendly...). There is some way to apply changes made in user profiles without forcing the users to logout and login again?
Thanks again RdeBoer, this module rocks! :)
Comment #9
rdeboerHi Xiwino
1) Yes technically speaking if you only want the global filter values to come from the user profile, then Global Filter does not need to depend on Session Cache API. But it's only a small module, it does not do much. In your case I would probably pick the default $_SESSION, or cookie if you want the selection to continue after logout.
2) Yes changes to the profile are only evaluated upon login. That's how it was designed. After that the filter is changed wherever you put the global filter block. In your case you want people to go to their user profile every time they want to change the global filter, right? Why not put the global filter block on the profile page? Wouldn't that almost achieve the same effect?
Rik
Comment #10
delvalle commentedThanks Rik!
I will pick the $_SESSION and try the solution of putting the global filter block on the profile page (surely not my ideal solution, but could do the trick for the moment). Fixed for me...
Comment #11
rdeboerThinking about this more.... if the global filter was set on Submit of the profile (as well as upon login), would that satisfy your use-case. As you would not need to position any Global Filter blocks anywhere, right?
Comment #12
delvalle commentedYes, setting the global filters on submit/update of profiles would be perfect for my use-case and would eliminate the need for any Global Filter blocks.
Comment #13
rdeboerNot everyone wants it this way though.
Flagging as feature request (with option to switch this behaviour on or off).
Comment #14
rdeboer@xiwino
Checked in two optional features, which can be switched on or off independently on the Global Filter configuration page.
o Set global filters according to the user profile upon login
o Set global filters according to the user profile upon submit
That should satisfy your use-case, right?
Please test 7.x-1.x-dev (18 Dec 2012 or later), as I haven't had much time to do that yet.
Rik
Comment #15
delvalle commentedThanks Rik,
That would satisfy my use-case, but I've done some quick-testing of the dev version and the "upon submit" option doesn't seem to work.
In module configuration I've checked both options (upon login and upon submit) and the login option still works OK but submitting the user profile doesn't make any change in my global filters.
I've run update.php and also cleared all caches, but it still doesn't seem to do anything. I want to use Profile2, but I've also tested with core profile and doesn't work either upon submit (it works correctly upon login in both cases).
Comment #16
rdeboerThere was a bug in setting the Global Filters from the core profile, which I've just fixed and checked in. Profile2 profiles worked for me though. For more info enter your user name or names on the GLobal Filter config page, in this box: "Show Global Filter informational messages during execution". For example "admin,anon".
Then change user profile fields and see what it sets when you Save.
Use 7.x-1.x-dev (19-Dec or later).
You do indeed need to clear caches after installing the latest version as it's a new form submit handler.
Comment #17
delvalle commentedOK, the results of my tests using last dev (with messages during execution activated):
1) Profile2 changes with the option "Provide a separate page for editing profiles" DESELECTED works perfectly (changes apply when saved and also upon login). After saving the messages show as expected:
2) Profile2 changes with the option "Provide a separate page for editing profiles" SELECTED only applies upon login (no messages or changes in global filters when saved). NOTE: The goal of this option is to make the Profile2 page available on /profile-examplename/uid instead of inside the profile (/user/uid/edit/examplename)
3) Core profile doesn´t seem to work different to previous dev: Changes only applies upon login (no messages or changes in global filters are showed when saved).
My desired configuration is 2): Profile2 with the separate page activated (having that separate page is the only reason why I want to use Profile2).
Comment #18
rdeboerOops.... completely forgot about the Profile2 option for separate page... no wonder it's not working!
Will investigate.
Suprised though about core profile... believe I have that working on my system. We're talking about the Account tab at user/1/edit, right?
On my system all core and Profile2 user profile fields get saved into their associated Global Filters, regardless of whether you press Save on the Account tab, the Main Profile tab (default Profile2 tab) or any additional Profile2 tabs.
Naturally only those profile fields that indeed appear as drivers for global filters will be set and show up in the info messages.
Rik
Comment #19
rdeboerScreenshot of the user/1/edit/main page, i.e. default Profile2 user profile page, showing a field that is used as a Global Filter driver.
Also showing core's user profile (Account tab) and another Profile2 user profile page, "Profile2 Rik".
Comment #20
rdeboerChecked in code to make above work for the case where "Provide a separate page for editing profiles" is ticked (ie Profile2 Pages submodule enabled).
Available in 7.x-1.x-dev (21 Dec 2012 or later).
Comment #21
delvalle commentedAll right, now it's working perfectly for the 3 options! (core profile and Profile2 with and without separate page).
Maybe the core profile problem was caused by something in my configuration or set of installed modules (although that would be strange, because I think I haven't done any change since the test with the previous dev version). I've been thinking about a possible explanation without any success... Anyway, now it's working! :)
Thanks for all your help, Rik!
Comment #22
rdeboerOk then we can well and truly close this!
Merry Xmas.
Comment #23
Ingmar commentedI suggested the features to take default from Profile2 and have been following this topic ever since then. The new features will definitely come in handy for me as well. Thanks Rik for the work you put into this!
Comment #24
rdeboerYou're welcome Ingmar! Thanks for you initial suggestions that got this improvement going.
Comment #24.0
rdeboerAdded link to Ingmar's profile