Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
when i click on new message at the top oft the page is the headline (see picture 1), when i send a message with a user id (maybe over the user profile or the advanced forum) there is no headline on the page (see picture 2).
Is this a bug or intend?
Thanks
strauch
Comment | File | Size | Author |
---|---|---|---|
#19 | privatemsg_menu_1.patch | 2.56 KB | Berdir |
#12 | privatemsg_menu.patch | 2.73 KB | NaheemSays |
#8 | privatemsg_menu_2.patch | 2.79 KB | dawehner |
#8 | pm.jpeg | 15.61 KB | dawehner |
#8 | pm_read.jpeg | 18.53 KB | dawehner |
Comments
Comment #1
NaheemSays CreditAttribution: NaheemSays commentedNo idea how to fix the menu inheritance, but the following code may help make this less noticeable.
in pm_new, replace
with
Good idea?
Comment #2
strauch CreditAttribution: strauch commentedyeah thats nice :).
thank you
strauch
Comment #3
NaheemSays CreditAttribution: NaheemSays commentedAn actual description of the problem:
1. Go to "messages/new". You'll get picture 1.
2. Go to "messages/new/{user_id}". You'll get picture 2.
The problem is that all pages at "messages/%" inherit the same local tasks, but pages at messages/%/% don't inherit them.
This is seen on the above mentioned messages/new/% and also when viewing the messages at messages/view/% - in both cases the local tasks from the menu level above do not show.
Comment #4
BerdirYes, because these are defined as MENU_CALLBACK and not as MENU_LOCAL_TASK.
Atleast for the new message, there is an easy fix...
Instead of defining two different menu items, we could just have one and check the user_id instead of letting the menu system do this for us.
However, this does not work for messages/view/%
Comment #5
NaheemSays CreditAttribution: NaheemSays commentedThis also does not add the local menu for the view messages pages, but apart from the the above patch is rtbc (I added a slight change to it here).
Comment #6
BerdirYes, the view messages is a slightly different issue and harder to fix.
In difference to write message, there is no "default" view message page that *is* listed as an local tab.
And there seems to be no easy way to force the display of the local tabs of page X. I tried trough every menu_set_x function i could find, none did what wanted (in fact, they didn't do anything, except of breaking the breadcrumb ;) ) and asked twice in IRC..
Comment #7
dawehneri'm not sure but it should be able to change the tabroot in the menu router-item could solve, perhaps the problem
But it seems to be ignored in hook_menu, looked in the talbe menu_router
Comment #8
dawehnerhey i got something working
i changed the type of messages/view/% to menu_local_task
so this adds the feature itself, that it shows the local tasks on viewing a privatemsg
The only thing to do is, to hide the tab on all other pages
Therefore i created a extra access callback which proves this
The patch is from head
Added some screenshots to show that it works.
Is this a clean way?
Comment #9
dawehnerits a patch so....
Comment #10
BerdirSeems to be a nice workaround. Maybe it would be better if we change the weight of the read-tab to a different value so the tab is at the end of the list (maybe before tags)
Comment #11
strauch CreditAttribution: strauch commentedthis patch works fine, i will test it with my community and then change the status ;).
Comment #12
NaheemSays CreditAttribution: NaheemSays commentedSmall changes to above patch, otherwise looks good. Marking as rtbc.
Comment #13
litwol CreditAttribution: litwol commentedah ;). i knew one patch will slip up.
- $items['messages/inbox'] = array(
+ $items['messages/list'] = array(
you are removing inbox in favor of list. but then every where else in code messages/inbox is left neglected.
observe:
line 270: case 'inbox':
line 829: url('messages/inbox')
overall i dont agree with the apprach. lets not be lazy, add a bunch of extra menu items that act specifically as a localtask.
Comment #14
litwol CreditAttribution: litwol commentedI've double checked with menu masters. they said we need to create different menu_local_task for each menu depth (or generally whenever we need them)
Comment #15
NaheemSays CreditAttribution: NaheemSays commentedoops at leaving inbox in there.
The reason for removing the menus is to fix the observation in the original post - to fix the "local tasks" and to leave/add the menus at the top of the pages.
Is there another way to approach this?
Comment #16
NaheemSays CreditAttribution: NaheemSays commentedremoved
from mthe patch - I will pout that in with #303087: Move "Sent Messages" to privatemsg_filter, Add inbox, improve user filtering. to stop these two patches blocking on each other.
This patch is standalone and AFAIK is not needed for any others, nor does it depend on others.
Comment #17
Berdir@litwol
I'm not sure if I understood your comment about being lazy correctly. The problem with the current way is that it is not intuitive to go back to the thread list when we are viewing a thread or writing a new message to a specific user. The target of this issue/patch is to provide the same (or atleast, similiar) navigation/tasks for every privatemsg-related pages (except admin). Or, more explicitly, to get a mix of the menu types CALLBACK and LOCAL_TASK.
The send message page is imho quite unproblematic, because the user id is an optional parameter for the same page.
I am also not 100% happy with the proposed solution for the view message page, but I can't find a better solution and it is imho better than the solution that we currently have. There seems to be no easier way to embed CALLBACK-items into an existing page with local taks.
Comment #18
strauch CreditAttribution: strauch commentedWill there be a new patch? For the new dev version?
Thanks
strauch
Comment #19
BerdirI found out something really interesting by looking at how Views has done this for the "Edit" local Tab.
There is a simple, not so obvious trick. When parameters are defined with a name, for example %node, the menu system does call the respective name_load functions and when these functions return FALSE, the tab is not displayed.
So, I changed messages/view/% to messages/view/%privatemsg_thread and added a (currently, very smple) privatemsg_thread_load function. All this function does at the moment is checking if the parameter is an int value bigger than 0. At a later point, this can be extended. I haven't done this yet, because I want to synchronise it with #288183: Provide api function for other modules to send messages.. If this patch gets commited, I will extend the load function there.
While this solution is a bit harder to understand than the access callback, it seems to be the "Drupal way" to do it, and does add something useful (atleast later).
Comment #20
strauch CreditAttribution: strauch commentedThank you berdir, i will test it.
Best regards
strauch
Comment #21
strauch CreditAttribution: strauch commentedI tested it with my test community and had no problems.
Comment #22
litwol CreditAttribution: litwol commentedCommitted !!! :)
Thanks.