hi there,
there is a "Galleries List" on the menu to show all the galleries, and i want to just show the logged in user's galleries "My Galleries", how can i do that? In the node_gallery_menu() function of mode_gallery.module file already has the "My galleries" menu entry.... so not sure how to enable it??
$items['galleries'] = array(
'title' => 'Galleries List',
'page callback' => 'node_gallery_list',
'access arguments' => array(NODE_GALLERY_PERM_VIEW_GALLERY),
'file' => 'node_gallery.pages.inc',
'type' => MENU_NORMAL_ITEM,
);
$items['galleries/%user'] = array(
'title' => 'My Galleries',
'title callback' => 'node_gallery_list_title',
'title arguments' => array(1),
'page callback' => 'node_gallery_list',
'page arguments' => array(1),
'access arguments' => array(NODE_GALLERY_PERM_VIEW_GALLERY),
'file' => 'node_gallery.pages.inc',
'type' => MENU_NORMAL_ITEM,
);
Comments
Comment #1
dbeall commentedHi foodbo, you should be able to add a menu link with the path of 'My Galleries'.
You can rename the link if you like, but the path (My Galleries) should work.
I tested this just to be sure with Alpha10
When a user is logged in, that should show 'users galleries' or user names galleries.
my link shows, (daves galleries)
Goto: Administer > Site building > Menus
open the menu you want use, I used navigation in this example.
Add a new item
path = My Galleries
name = anything you want
description = anything you want(mouse over text or hint)
checkmark = enabled
parent item = add it to a parent if needed or add it to any menu
Comment #2
foodbo commentedThanks dbeall,
I have tried that and it says "The path 'My Galleries' is either invalid or you do not have access to it." but should the path just be "My Galleries"??? , it looks like more link_title to me than the router_path.
I tried to add that to navigation menu too, (/admin/build/menu-customize/navigation/add) and using drupal 6.14
also i have tried "my galleries", "my_galleries", "" and "", but none of them work......
anymore ideas??
thanks in advance.
Comment #3
dbeall commenteddid you try --My Galleries --capital M --capital G
Comment #4
foodbo commentedYes, I did
"The path 'My Galleries' is either invalid or you do not have access to it."
Comment #5
dbeall commentedthe cache_menu table may be the trouble and I have reproduced your problem on my test site.
One method is empty the cache_menu table and navigate to the module list page(which should force an automatic rebuild).
http://drupal.org/node/589128 ;How to debug/trace menu calls
I am trying to force a menu rebuild, but have not been able to get it fixed yet.
I use admin_menu, which has a clear menu cache function, but it has not worked
I have to get to work, but will pursue this later today.
The path according to the code should be:
'title' => 'Galleries List',
'title' => 'My Galleries',
Comment #6
dbeall commentedi should add here, on a fresh install with wamp(local machine) it works fine.
The site where i reproduced this is my test site(davebeall.com)
Comment #7
foodbo commentedNot sure, how u did it.
I have a fresh drupal install with only the minimum modules (imagecache, node_gallery and imageapi) enabled, and it display the same message "The path 'My Galleries' is either invalid or you do not have access to it."
The "Galleries List" is automatically appear without any configuration /
addadding it to the menu manually so why does the "My Galleries" needs to be added manually?I have tried to clear all the cache tables, but it did not work. drupal doesn't let me add the item in the first place, so I don't think it is to do with the cache.
Another thing that i have tried is, to
alladd the "Galleries List" manually and it wont' let me do that either and displayed the same message... , so I don't think the path is like "Galleries List" or "My Galleries" or the validation from the form is already blocking those invalid path???So should I change this issue to bug report???
thx
P.S
I am using drupal 6.14, imagecache 6.x-2.0-beta10, imageapi 6.x-1.6, node gallery 6.x-2.0-alpha10 and XAMPP (Basispaket) version 1.7.1
Comment #8
foodbo commentedmaybe easier for the maintainer/s to response, they might know what is going on....
Comment #9
dbeall commentedIf you need this right now without troubleshooting,
download http://drupal.org/project/me ;install it.
Goto: Administer > Site configuration > Me aliases
add [user-name] for the token in the top text box.
[x] Rewrite links generated by the drupal menu system.
Save it.
Put the menu link path in as 'My Galleries' and it should work.
I tested this and it has worked.
add note: token is required if you want to use [user-name]
Comment #10
foodbo commentedthanks dbeall for ur help.
Well, just running out of ideas of how to troubleshoot and i am not really a PHP coder, so better to let the maintainer know and they might be able to find out the coding issue and fix it for the next release. (if they do read this, maybe i should change this priority to critical too).
I will give the me module a try as a quick fix for now. ( i am trying to cut down or use as less modules as possible, got over 40 modules installed... )
thx
Comment #11
dbeall commentedI have noticed something..
Open the Navigation menu and check to see if the My Galleries is in the list, it might say, "admin's galleries" if you are logged in as admin.
Look at the drag handles, if it is there, drag it to the left. --OR-- check mark expanded next to the "Galleries List" link.
I noticed that it shows up as a child menu link to the "Galleries List" , but that menu link is not expanded.
Comment #12
foodbo commentedHi there dbeall,
I have a problem of using "Me" module that u suggested in #9, as i am using the suckerfishmenu javascript and somehow the whole navigation menu is gone when i enabled the me module.( getting tired of trying to fix this, doesn't seem to get anywhere)(Actually is the "Devel" module causes the problem)#9, Yes I got that working.
#10,
there is no "My Galleries" or "Admin's galeries" in navigation menu. :-(I know what u mean now, after the ME module is enabled, and i can see the admin's galleries. i am thinking to changing the name just "Galleries".i am changing the priority and see will the maintainer help?
many thanks.
Comment #13
dddave commentedI also cannot get this item to go.
This may be caused by something else but on the sandbox I am playing with the "Galleries List" item is active but the page doesn't show the galleries........ The page is empty.
Comment #14
dbeall commentedsame here, list is empty. I was waiting for some else to see it before I opened my big huge mouth..
Comment #15
dddave commentedThis was introduced in one of the last devs I think. I noticed it at least with the last one so it wasn't introduced with the current dev.
Comment #16
dbeall commentednot too much help..
I have july 27th dev running on my test site and it's all oksorry..
I have Me alias on that one.. no good on that one
buckeyelake.org has July 27th dev too and no go
Comment #17
dbeall commentedBoth my July 27th devs have gallery list , but not My Galleries menu
we should separate these two issues..
one is OP My Galleries
two is Gallery list
Comment #18
dbeall commentedAlpha9, My Galleries ;The path 'My Galleries' is either invalid or you do not have access to it.
Alpha7, My Galleries ;The path 'My Galleries' is either invalid or you do not have access to it.
Comment #19
kmontySounds like this has been a long-term issue. Argh.
Comment #20
foodbo commentedAt least we have a work around method for "My Galleries".
but how can you change the name from "UserName's Galleries" to "My Galleries".I know how to change the gallery menu name, you can just go to the navigation menu and edit "UserName's Galleries" to "Galleries", somehow it doesn't work with "My Galleries" title, it seems fine just with "Galleries" for now.The gallery list seems work fine with me, i can see all the galleries on the site.......
Comment #21
kmontyDoes anyone think we should just get rid of these pages entirely? They can be built with views, which seems like a better/more flexible way to display this data anyways.
Comment #22
dbeall commentedMy Galleries menu issue;
I will do a clean Drupal install with each version side by side, late tonight and see if I can narrow down the release or where it changed.
I don't trust reusing a database to trouble shoot.
Comment #23
dbeall commentedViews is nice, but.. I don't know if pitching them is the best thing to do.. Have to think about that.
It would make views a required install.
EDIT: we would also have to include views pages with the default install.. or answer support requests like crazy
Comment #24
kmontyMmmm, maybe scratch my last comment since I forgot about the links in the breadcrumb. I still cannot help but feel there is a better way to do this.
Comment #25
kmonty"Views is nice, but.. I don't know if pitching them is the best thing to do.. Have to think about that.
It would make views a required install."
I was suggesting just not having the pages entirely. If someone wanted to make a list of user galleries or all galleries, they could setup some views on their own. They are not complicated views to create, in my opnion.
Comment #26
dbeall commentedwell, it's like this.. in the interest of time and releases
If we can have some other issues fixed that are really(really) important..
I am assuming that everyone is using views these days....?
And the list pages can be made with views.
1. we can post the views code for import. That's easy enough.
or
2. we can include the views with default install like other mods do.
and
3. Down the road, this could be revisited for a new release in the future...
Comment #27
Tally commented#21 kmonty: "Does anyone think we should just get rid of these pages entirely? They can be built with views, which seems like a better/more flexible way to display this data anyways."
I think any commercial site will use views or a custom module for presentation with NG being the engine driving it all. (When NG is released and it is fully in my site, I will be using few, if any, of the default NG pages.) But, the module needs to accommodate casual users and their sites where views or custom modules are not needed and/or not wanted.
Ideally, the NG module should be usable out-of-the-box for a basic system. The module also needs to accommodate more advanced users with the nodes themeable with lots of css classes for customization.
But, I don't think the NG module needs to be all things to all people, as long as the hooks and core are there for customization.
Comment #28
foodbo commentedI have tried to create a list of galleries for the user, it works fine just display galleries but i couldn't (don't know how to) get the list of operations (edit, upload, delete). so i thought just stick to the pages that come with but causing some much problems..
Comment #29
dbeall commentedactually we have a views code for import now.. can add some different ones..
Comment #30
dddave commented+1 for importing the code
dbeall creates awesome docs and it should be easy enough even for noobs to import the views code. Moreover cutting this out reduces the sources of error in the module itself and makes it easier maintanable, doesn't it?
edit: If the owner deletes one of his galleries he is prompted to his "My Galleries" page. Noticed this during some test for another issue. BUT: This page also is empty even though the user has a couple of other galleries.
Comment #31
kmontyThe only problem is we lose the nice breadcrumbs (of course, they don't work correctly right now, but that is not the point here :-P ).
Maybe it is fair to say if you really want to use breadcrumbs with node gallery, you have to import/create views and use the custom breadcrumbs modules?
Comment #32
dbeall commentedwe have instructions for setting up custom breadcrumbs in the handbook.. using 'node types'
Comment #33
dbeall commentedI am quickly starting to agree with Tally #27..
after some time testing the access and sort image patches.(both seem to be fine)
The views module will end up being mostly required if the list and my galleries pages are gone.
It is looking like an administrators nightmare.
The menu has to be set to access each gallery.
Comment #34
boon4376 commentedIDK if this will be helpful or not, but if you have user profiles or any page where your users have information about themselves, you can build a view that will easily take them to a listing of all of their own galleries, or so if people are viewing their profiles, the viewers will see a link to the profile owners image galleries...
1.) Create a view that has two fields and displays 1 item
2.) Arguments: User:UID
3.) Fields: 1.) User: UID (Exclude from view) ; 2.) Global text (As a link), link path: "galleries/[uid]" (as localhost/drupal/galleries/[UID] will take you to only galleries belonging to the given User id)
4.) When adding the view to the users profile via panels (assuming you are using advanced profiles)... make sure you select User ID for "user being viewed"...
You can label the link something like "View my galleries" with the global text as link method....
I dont think this view can be added to any menus or blocks unfortunately, if it can im all ears!
Comment #35
dbeall commentedyou should be able to use the view in a block by editing the view and add 'block' at the top left, just under default and page view. I imagine you could use an imagecache preset in the block too, for a thumbnail list of their galleries.
Views is a very neat thing.. I will be doing some more with my node_gallery views in Dec/Jan
Comment #36
kmontyA view can be added to a page view. Select the page view on the view edit page and at the bottom of the right column, you'll see Path options and menu options. Select menu options and make a menu normal item.
Comment #37
dddave commentedIs this #626740: Node Gallery list bug fix a dublicate? And contains it something useful?
Comment #38
vb commentedMay be i have something misunderstood, but, please look at
function node_gallery_list($account = NULL, $gallery_config = NULL) {
your line in last dev 04.11
$items[] = theme('gallery_cover', $gallery);
i think shoud be
$items[] = theme('gallery_cover_view', $gallery);
without this Gallery list does not work.
Comment #39
dbeall commented@vb, Agree, this works just fine. I used your code and generated a patch.
* How to enable "My galleries" on the navigation menu?
This thread has taken several directions, so I posted the patch here
#626740: Node Gallery list bug fix
Comment #40
kmontyStill an issue or can we close this?
Comment #41
dbeall commentedas far as I know, the "my galleries" menu link will not work.
However, the "ME" aliases module provides a work-around.
It's your call, technically, it's still broke
"The path 'My Galleries' is either invalid or you do not have access to it."
Comment #42
designwork commentedHi dbeall,
can you try this code:
Every menu path needs an default local task two work:
cheers
dirk
Comment #43
designwork commentedHm thinking...
I would like to have a tab on my user profile to. So I can edit my galleries on my account
try this:
Dirk
Comment #44
designwork commentedHi All,
I changed the menu in node_gallery_module. please delete all the old menu items starting with galleries. Try to use the following code:
In the main Navigation you have now two links one called Gallery List, the second one called USERNAME`s Galleries. On the user Profile you have a tab showing the galleries of the user.
Cheers
Dirk
Comment #45
dbeall commentedThat works just fine, tested on localtoast wamp with 6.x-2.x-dev Jan 9th
I had to leave this part in for the 'Galleries List' menu link to work
There maybe should be some kind of argument to determine if a user is logged-in to make the
user's galleriesmenu link visible. It is visible to anonymous visitors and displays as's Galleries.Comment #46
dbeall commentedThis might not be important.. the first $item in #44 has a spelling error
'type' => MENU_DEFAULT_LOKAL_TASK,
'type' => MENU_DEFAULT_LOCAL_TASK,
EDIT: notes as i mess with this
--------------------------------
I could remove the code snippet from #45 after this change
This won't work--
$items['galleries/list'] = array(
This works
$items['galleries'] = array(
--------------------------------
well, after 5 hours of searching the API's and anything else I could find, I did not find the answer...
how to make the 'user's galleries' or 'My Galleries' menu link only visible on the navigation menu when logged in...
I read all the book pages about the arguments, but I just don't understand it.
Here is what I ended up with, I added a few labels for people like me looking at the code..
Comment #47
designwork commentedHi dbeall,
I had a different behavior on my local install. But know I have two install and this works for my.
If you change the menu on a existing install run clear cache on admin->settings->performance.
I only have installed Drupal 6.x and node gallery &.x-2.x-dev. The anonymos user can not see the second link anymore. Actually I´m still not convinced about that sollution because it is not behaving the "right way". The menue system should work different if I read the api pages, but lets test us and think about it.
What do you think about the Tab on the user account?
Cheers
Dirk
Comment #48
dbeall commentedI like the tab on the account page, but some people might not want it.. That's why I labeled the code so people can remove it or comment it out..
I use admin_menu that has a clear cache function, I also tested it with the "Drupal performance clear cached data" and the links shows in the navigation menu as ( 's Galleries ) for anonymous users.. The link is correct for logged in users ( admin's Galleries )
Comment #49
dbeall commentedI will try the test on my vps live site(davebeall.com) and see what it does.. give me half hour
Comment #50
dbeall commentedOk, I added it to my live site and enabled the navigation block for anonymous users.. same behavior
The block is on the left side, all pages except node gallery www.davebeall.com
Comment #51
dbeall commentedI notice that it is showing password protected galleries on the gallery list page
Comment #52
dbeall commentedthis code gives me sql syntax error
'access arguments' => array('create', 'node_gallery_get_types()'),Comment #53
designwork commentedHm.....
I can not reproduce that behavior of your site with the code I posted. Have a look here http://photographer.freelens.ws/
So we need to find out why or what is going wrong there. Even 'access arguments' => array('create', 'node_gallery_get_types()'), gives no sql erroes to me.
So lets digg a bit.
Cheers Dirk
Comment #54
dbeall commentedI used the code from #47. No sql error on either buckeyelake.org or db.com, the error was on wamp.. So that is probably fine.
well, I have ( 's Galleries) for anonymous on this site http://www.buckeyelake.org/galleries
Enabled the navigation block for anonymous users, it's normally set just for logged in users...
This is the same vps server that davebeall.com is on, but complete separate install, separate database.
'user's galleries' link won't show at all on navigation davebeall.com site, hmmmm
Try to add the link manually.. The path 'My Galleries' is either invalid or you do not have access to it.
However, the My Galleries tab on account page is fine.
I will mess with it and see how it plays out...
I have 5 more sites I can try it with if i need to, but they are shared host.
Comment #55
wxman commentedI too tried the code in #47, and I have similar results as dbeall. The admin (user 1) gets a link under the "Gallery list" menu link, labeled "Admin's Galleries", and a tab in the account section. An authenticated user is getting the tab, but no menu links. The anonymous users only see the main Gallery List link in the navigation menu.
Comment #56
dbeall commentedHi wxman, try it on my site, I get different results
I have users menu visible for all for a test. It has account link and galleries, and user's galleries
http://www.buckeyelake.org
user wxman
password
removedComment #57
dbeall commentedactually, my work around has been to have the navigation only visible for logged in users(normal on my site).. That makes it ok for my purposes..
Comment #58
wxman commentedI just tried it, and that's how only my admin one works for me. I wish you could try mine, but I still have the URL not pointing to the new Drupal site. Maybe mine is coming from me moving menu items around, and making custom menus, but I would think the link would still be generated even if in the wrong place. The regular user doesn't get the link in the main menu, only the tab.
I have to ask. How did you get the "visibility" and the "Gallery display setting"? Are those from other modules?
Comment #59
designwork commentedHi All,
just some explanaitons on menu.inc and why this in the original code could never work.
First menu Item we provide.
This is the base path of the node gallery module /galleries.
"page callback" is the page (function) it will show when you call the URL.
"acces arguments" are the rights a user need to see this Menu Item and to access the path.
"file" defines the file to load for that callback. To if you click this url the file node_gallery.pages.inc will be called and the function node_gallery_list will provide the display of the galleries.
"MENU_NORMAL_ITEM" is the type of menu we provide in drupals menu system.
actualy we could make it more drupal if we make the access call different
The second menu item in the original module had a wrong path, because it passed a wildcard
$items['galleries/%user'] = array(and therefor it could never appear in the navigation menu.So I changed it to a drupal user variable "user_uid_optional_load". The current user uid is loaded an this page call.
'page arguments' => array(1), This is the user uid
'access callback' => 'node_access', Here We define the kind of access callback we need here
'access arguments' => array('create', 'node_gallery_get_types()'), Now we define the callback. A user only may see this menu item and access the URL if he has the rights to create a gallery.
This was tested by me on 3 installs now and is working. If ite is not working for you, maybe you need to set rights for the user roles, or the menu.inc is caching your menu so clear cache. Your browser cache may also avoid your menu to work right. You always have to delete the files from your file system that you wanna update before applying new ones, or maybe uninstall the module first.
So please try all this things first and give some more informations on the bug reports.
Cheers
Dirk
Comment #60
wxman commentedI just uploaded the last DEV (Jan 18), and as it is "out of the box", I only get a single menu link to galleries. If the logged in user, who has a gallery, clicks that link, it still only shows that one link.
I changed node_gallery.module like suggested to this:
and added one for user tabs:
I'm still only getting one menu item, but at least this way I have the tab on the user account page. The odd thing is both ways, the admin does see a menu item, under "Gallery list" for the admin's galleries.
EDIT: Just ignore me. I found the check box to turn on the user tab in the settings. I'm still not getting a separate menu item for the user's galleries.
Comment #61
designwork commentedHi wxman,
did you uninstall/reinstall the module and/or runed a clear chache?
Dirk
Comment #62
justintime commentedFunny, I actually fixed this in NG3 development awhile ago. I'm attaching a patch that is a backport of the functionality. Make sure to visit /admin/build/menu-customize/navigation and click "Save Configuration" after applying the patch to clear your cache. Let me know if it works or not.
Comment #63
justintime commentedComment #64
justintime commentedOh, forgot to mention that I tested the patch myself on the demo server: http://ngdemo.sysadminsjourney.com/ you can preview the behaviour there before applying the patch if you like.
Comment #65
dddave commentedIt works.
However I had do some extensive cache flushing and I only got it to work AFTER I enabled the tab on the user profile (Show tab on user profile). I disabled this option afterwards and the menu item stays. So either this setting did the trick or it was a mere coincidence and it was the 7th or so cache flush. I now that the menu cache is notorious for its persistence...
Side-note: The new settings contain a string informing the user to set the permissions for "view user tab". I couldn't find such a permission. Is this something in NG3 or am I missing something here?
Comment #66
justintime commented@dddave - did you visit /admin/build/menu-customize/navigation after installing the patch and click "Save Configuration"? That's the only sure-fire way I know of to clear the menu cache without using devel or admin_menu. Toggling the user profile setting also clears the menu cache, so that's why that did it for you.
re: your side note: I think you may have another patch providing that string. If you look at my patch, that string doesn't occur anywhere in it.
Comment #67
dbeall commentedI haven't had my coffee yet to day,, but the tab on the user profile page is part of the slideshow module.. node_gallery_display
from node_gallery_display.module
@@line 21
Comment #68
dddave commented@dbeall
That makes sense.
@justintime
I did resave the menu item AND I used the "Flush all" option of Admin_menu. I am using a pretty polluted test install so maybe something on my side was the problem.
Perhaps we do get some additional feedback from other testers...
Comment #69
dddave commentedI guess putting this into the next available dev release might be a good idea. If nobody complains we can consider this fixed. Seems as we are lacking testers...
Comment #70
scroogie commentedPerhaps create an update function with only a call to menu_rebuild().
Comment #71
justintime commented@scroogie, good idea. Done.