Hi there,
I am using the "node gallery" module and it comes with "Galleries List" which shows all the galleries from everyone.
If you select your own gallery from the "galleries list", it will have a breadcrumb named as "[user name]'s galleries" and it links to http://localhost:8080/qbs_v01r01_dev/galleries/1 where 1 indicates uid i think?, and it will link u to your list of galleries.
So, what i want is, to have a navigation menu item , e.g. My Gallery and it links to my galleries only, in this case the admin user is "galleries/1".
so how can i do that.
I have tried to use view and i can use user:uid arguments with the argument type:User ID from logged in user, to do kind of the same thing, but i would rather to use the "node gallery" default page than creating a new one if possible.
many thanks.
Comments
First check and see
First check and see if
http://localhost:8080/qbs_v01r01_dev/galleries/
Will redirect to the current user's gallery. If so you can just create a menu item to that.
If not you can either put in a feature request to the module requesting it, or you can create a simple module to do the work for you.
If you've never done that before it's pretty easy. Read the handbook on the subject. You'd just need to implement hook_menu(); (so you'd create a my_module_menu() function), and a callback function something along the lines of:
<?phpfunction my_module_my_gallery() {
global $user;
return drupal_goto('galleries/'. $user->uid);
}
?>
--
Dave Hansen-Lange
Director of Technical Strategy, Advomatic.com
Pronouns: he/him/his
thanks dave
Customization - I haven't done any customization yet and don't really know php..... learning it thought.
This link http://localhost:8080/qbs_v01r01_dev/galleries/ , it shows all the user galleries not just the owner.
In the node_gallery_menu() function of node_gallery.module file, it already has the "My galleries" menu entry.... so is that mean i can just enable it?
<?php$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,
);
?>
yes
enable it :)
interesting... so how to enable it then?
interesting... so how to enable it then?
@foodbo because that menu
@foodbo because that menu item is MENU_NORMAL_ITEM it means that it should just be somewhere at admin/build/menu entitled "My Galleries". Probably in the "Navigation" menu, but you can move it to wherever you want.
--
Dave Hansen-Lange
Director of Technical Strategy, Advomatic.com
Pronouns: he/him/his
Nah, if it is that obvious i
Nah, if it is that obvious i would probably find it, I can see the "Galleries List" under admin/build/menu (admin/build/menu-customize/navigation) but no "My Galleries". also i have looked through the node gallery settings (admin/settings/node_gallery), and found nothing.
I have also searched thr the forum and node gallery issue list, don't think anyone has mentioned "my galleries" there.
Anymore ideas, anyone????
someone was helping but doesn't seem to get anywhere...... http://drupal.org/node/609150#comment-2201698
users galleries
Designwork came up with the code in thread http://drupal.org/node/609150
this goes in node_gallery.module
function node_gallery_menu() {
$items = array();
for the 'user's galleries' or 'My Galleries', displays as 'Joe's Galleries' if the user name is 'Joe'.
The trouble with this code is it needs an argument to determine if the user is 'logged in'.
I was hunting for how to add that argument when I landed here..
$items['galleries/list/%user_uid_optional'] = array('title' => 'My Galleries',
'title callback' => 'node_gallery_list_title',
'title arguments' => array(2),
'page callback' => 'node_gallery_list',
'weight' => -9,
'page arguments' => array(2),
'access callback' => 'user_access',
'access arguments' => array('view node gallery'),
'file' => 'node_gallery.pages.inc',
);
to add a 'My Galleries' tab to user page for the user's galleries
$items['user/%user/galleries'] = array('title' => 'My Galleries',
'page callback' => 'node_gallery_list',
'page arguments' => array(1),
'access arguments' => array(NODE_GALLERY_PERM_VIEW_GALLERY),
'file' => 'node_gallery.pages.inc',
'type' => MENU_LOCAL_TASK,
);
have fun, I'm goin looking for the user argument to add to it...