Are "Per User Albums" supposed to be created at login or only after the user visits user/acidfree? Right now, I'm only seeing an album being created after a visit to user/acidfree but I'd like to have them created on the fly after login, only if the user doesn't already have their album and has the appropriate permissions.
I've started down the path of creating a custom user hook to facilitate this task but wanted to make sure my install of the module was working correctly before I proceed. If I do need to write the code to make it happen, would you be able to point me towards the place that creates the per user album so I can model my code after it?
Really nice module overall. It does most of what I'm trying to accomplish right of out the box. Thanks for any assistance.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | give-user-create-link.patch | 1.61 KB | yodersj |
| #8 | custom1.tar_.gz | 1.28 KB | fashion |
| #4 | custom.tar_.gz | 1.01 KB | bittindm |
Comments
Comment #1
vhmauery commentedNo, each user must visit user/acidfree. The reason they aren't created automatically is because people complained.
But here is the section of code that calls the code that creates the album. Calling acidfree_get_root($uid, true) will create an album for user $uid.
Comment #2
bittindm commentedBelow is the solution I came up with in order to assign a custom album title and change some of the default settings when the album is created. I'd like users to always have at least one album so I put in a check to see if their album actually exists. I guess that keeping the $user->acidfree_album value when a user deletes their album is also by design. Not sure if creating my own module with this code is the best approach, but I thought it was better than hacking the original.
One thing I noticed on the Acidfree settings page is that the "Sort all albums" checkbox doesn't seem to store or retain it's value. Has this already been addressed or should I file a bug report?
Thanks again for the support and for all the work that went in to this module.
Comment #3
fashion commentedHi,
That is a good contribution to acidfree module.
Can you kindly let me know how to use it ... where to put this code .... in acidfree.module file ?
when is the new ablum created.
I get access denied when I go to -www.abc.com/username/acidfree and page not found at -www.abc.com/user/acidfree
am using this module on Drupal 5.1 and other functions like creating album and uploading images are working fine.
Another problem I am facing is ( may be u cud help ), I do not get a link in the sidebar for per user album. I mean if a user aaa is logged in he shud be able to see a link in the sidebar "My albums" that points to his albums page. Wud appreciate your help.
Thanks.
Comment #4
bittindm commentedI placed the code in a small custom module (see attached tar) that is intended to handle any custom functions that need to happen when a user logs in. So on login, it checks to see if they already have an album, if not one is created for them (even if they've deleted their default album). This might not be ideal for every purpose but I need each user to have at least one default album.
Not sure why you'd be getting page not found for /user/acidfree, that seems to work on my install but I don't think there should be a page associated with /username/acidfree not unless you create URL aliases using pathauto.
Regarding the missing menu item, it looks like there's a place in the module that is supposed to create it but it's not showing up for me either. I'm still looking in to why that's not working. Once I figure it out, I'll post my findings.
Comment #5
fashion commentedHi, Cud you figure out "the missing menu item" ???
Comment #6
bittindm commentedFirst you probably want to check your existing menu items. Looks like the module adds a suggested menu item that you can enable via the menu admin (admin/build/menu).
If you'd like to create your own menus, try the code below in a custom module. It actually creates 2 menus, one for "All Albums" then a sub-menu for "My Album" on a per user basis.
Comment #7
skizzo commentedthe "sort all albums" checkbox is described in http://drupal.org/node/147674
Comment #8
fashion commentedHi, I added the above code as mentioned in the custom module u provided earlier but I still cannot see any My Album link. "All albums" link is visible. I changed it to "Galleries" in the function anf "MY family album" to "My Album". I hope that would not create any problem.
I can see the "- My Album" link in the admin/build/menu and its locked. What does this mean ?
Also, what is the name of the album created by default ?
Comment #9
Eluzion commentedThe custom menu module in post #6 is working for me (as far as showing up) but both the 'My Albums' and 'My family album' just end up linking to the default Acidfree Album page. It looks like it's linking correctly '/albums/username' but it ends up just going to the Acidfree Album page. What is the path to user created albums? www.yoursite.com/acidfree/albums/username?
Comment #10
wonder95 commentedNo, it's http://www.yoursite.com/user/acidfree.
Comment #11
yodersj commentedFor what it is worth, here is a patch file for a modification I did to acidfree.module. While it does not create a user's album on login, it will give them the 'user/acidfree' link on their profile page should no album exist.
Comment #12
najibx commentedHow can this be adapted to automatically create album per group (OG) and create link, Group Albums, in group link?
Comment #13
antenne commentedCan somebody tell me what I should do with the custom module for users to get an automatic album when they login?
I don't know what to do with it
thank you very much
Comment #14
bittindm commentedYou would place the code above in to new module, in the example it would be called "custom.module". Check out the handbook http://drupal.org/node/82926 to find out more information on creating a custom module.
In comment #8, fashion has actually created the module which is included as an attachment.
Once you have the module, you would need to enable it in your Drupal install on the Modules page /admin/build/modules. Then you should see that users receive an album when their account is created or when they login if they don't already have an album.
As a note, for the My album menu link to work properly, I believe you need to be using the PathAuto module http://drupal.org/project/pathauto to build an alias when a new Acidfree album is created. In PathAuto, under Node Path Settings, I have the pattern for Acidfree album set as album/[user] . If you don't see the menu item immediately, try clearing your cache.
Comment #15
antenne commentedthank you
I have it working properly now.. just have to look at the My album menu link.. hope thats going to work to
thanks again
Comment #16
antenne commentedWell I've done everything as desciped above but the "My album" link does not appear..
I can see it at http://www.eigenkleding.nl/admin/build/menu but it is locked..
what can I do?
Comment #17
bittindm commentedYeah, I had the same problem for the longest time with dynamic menu items. The best way I've found to move locked menu items is to add an attribute "pid" then assign it the parent menu ID. You might be able to look up the menu ID by menu name with a Drupal function, which would be better than hardcoding the id IMO, but I haven't have time to track that down yet.
Example (my parent menu item has an ID of 84):
Comment #18
EgonO commentedshouldnt it be:
by the way - in the actual dev-release is a menu provided - but it doesnt appear at admin/build/menu
Comment #19
roleychiu commentedIs there a way to modify the custom.module code to make the initial album unpublished by default?
I have a block on my user profile page that pulls up all albums as teasers and it's showing up the default album along side the user created ones. The default album has the child albums. I only want to show the albums that my users create in the block, not that default album.
Since this album is is of type acid_free, I don't think i can filter it in my SQL since the query pulls up all albums of type acid_free for that userID.
Anyone have a solution?
Comment #20
roleychiu commentedSolved:
Solved the problem of the Second Album being automatically inserted into the first album. I modified bittindm's custom.module code by adding in the line:
$node->status = 0;
function _custom_create_root($title, $uid) {
$node = new stdClass();
$node->type = 'acidfree';
_acidfree_set_node_defaults($node);
$node->created = $node->updated = time();
$node->title = $title;
$node->body = t('Album description.');
$node->parent = 0;
$node->weight = 0;
$node->order_by = 'node.nid DESC';
$node->view = 'list';
$node->share = 0;
$node->uid = $uid;
$node->status= 0; // <------ unpublish
node_save($node);
return $node->tid;
}
Naturally, any albums created by the user fall under it, but this makes displaying the albums easier since an SQL statement would have, under normal circumstances, brought up the initial album too (which would redundantly display the child albums and confuse some end-users).
Comment #21
pschraier commentedI have installed the create user album following the above suggestions, but am not able to display the albums using the acidfree album displays (I am sure there is a way to do it with views, but I am struggling with them).
One thing that can work is to put all the albums under a master album, but I don't know how to change the coding to create the per user album inside another one.
Does anyone have a suggestion on how to do it?
Comment #22
GuybrushSThreepwood commentedCustom module has another error, each time a user Logs out and then Log in a new Album is created, so that leading to an endless list of albums created with each Login.
Comment #23
sciem commentedHi. what is the best way to put link in Advance Profile leading to album of viewed user. For examp. I am (A user) loged in -> I'm viewing profile of user B ->and I want go to his album (needed link to his album)
Is there function I can call?? Any support welcome....