Hi,
we have a main biblio page with all publications of our chair. Additionally, our research assistants include snippets like biblio_db_search('author', 'my own name')
to present a list of publications on their personal page.
Now if someone goes to the main biblio page and sets the filter to "author = someone", and then goes to the personal pages of the resarch assistants, he won't see any publications anymore.
That's because in biblio_build_query
you find this:
foreach ($session as $filter) {
$arg_list = array_merge($arg_list, $filter);
}
Thus, when you filter by "author = someone" on the main list, and "someone" internally has aid = 1
, and then execute the biblio_db_search('author', 'my own name')
on a users personal page, the clause WHERE aid = 1
will be added. So you finally search for publications where "author rlike my_own_name AND aid = 1". Of course this fails if "someone" is not "my_own_name".
The same happens on the drupal profile pages, i.e., user/xxx/biblio
.
The attached patch prevents adding filter values when biblio_db_search is called with "inline" or "profile".
cu,
Frank
Comment | File | Size | Author |
---|---|---|---|
#8 | biblio_inline_without_filters_v2.patch | 709 bytes | Frank Steiner |
biblio_inline_without_filters.patch | 1.06 KB | Frank Steiner | |
Comments
Comment #1
Frank Steiner CreditAttribution: Frank Steiner commentedComment #2
Frank Steiner CreditAttribution: Frank Steiner commentedSorry for bumping :-) I'd just like to ask if there's a chance to getting this fixed in the module itself. If you don't consider this a bug (or the patch not a solution) we will try to work around it otherwise.
Comment #3
rjerome CreditAttribution: rjerome commentedHi Frank,
I see your problem, but I'm not sure your solution is quite correct. I suspect there are times when you would want filters in the "inline" mode, but I think the underlying problem is how and when to clear the 'biblio_filter' SESSION variable (maybe I need to find some why to avoid it completely, if I recall it was sort of a lazy mans hack anyway).
Comment #4
Frank Steiner CreditAttribution: Frank Steiner commentedOk, thanks for the feedback!
What do you think about an additional keyword like 'ignore_filters' as possible parameter for biblio_db_search? That would keep the original behaviour while allowing to disable filters manually. If you feel comfortable with such an approach, I can write a patch.
Comment #5
rjerome CreditAttribution: rjerome commentedOK, I think I found the solution using the "exit" hook... Could you try adding this code to your module (and removing your other related patches) and see if it fixes the problem.
Comment #6
Frank Steiner CreditAttribution: Frank Steiner commentedIt works in that the entries on the user pages now are fine! But if you still have the global publication page open the filter is removed there also, so that when you see "where author is xx" and click e.g. on one of the sort options, the filter disappears. I think this could be confusing if a filter vanishes "magically" ;-)
I think it would be better to keep the filters until explicitely deleted by the user and have a parameter for biblio_db_search to chose if filters should be considered or not.
Comment #7
rjerome CreditAttribution: rjerome commentedYes, I discovered that little problem after I posted that code :-(
I guess your right, the easiest solution is some kind of switch.
Comment #8
Frank Steiner CreditAttribution: Frank Steiner commentedWhat about this one?
Comment #9
rjerome CreditAttribution: rjerome commentedIf it works for you, it works for me :-)
Ron.
Comment #10
rjerome CreditAttribution: rjerome commentedcommitted to CVS
Comment #11
Frank Steiner CreditAttribution: Frank Steiner commented> If it works for you, it works for me :-)
Oh, cool! How often can I apply this before it expires?
Thanks :-)
Comment #12
rjerome CreditAttribution: rjerome commentedThat was a Christmas present!
Now you have just 360 more sleeps until the next one :-)