New(ish) module: user homes

Glooper

Joined: 2005-09-21
Posts: 225
Posted: Sat, 2010-04-17 22:36

Download from Gallery Modules.

Just done a new version of the user homes module. The old functionality is there but I've also added stuff to the "add Gallery" dialog... so that when you add a new gallery you can choose to make that gallery private and give new user details. That will create the gallery, create a user and group.. give permissions so that only the new user can view the gallery and then set the gallery to be the new users user-home! *phew*.. it's simpler than what it sounds, honest!

You will need the latest experimental code to use this as bharat has kindly pushed some required changes into it.

Ben

Benjamin Albert Smith - Photography
Pikitia - New Zealand Photography

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Sun, 2010-05-16 07:26

Ben, I've create a wiki page about it. If you make more updates, please replace your zip link in your post above or update that page :)

Feel free to update the wiki page with any other information you feel like it needs. I've only used an earlier version of your module and it's been awhile.

http://codex.gallery2.org/Gallery3:Modules:user_homes

Thanks
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
Shemo725

Joined: 2008-04-18
Posts: 424
Posted: Thu, 2010-05-20 20:27

glooper, nice mod. is there a way to set permissions for the user homes, also?

basically, if I have a user say "x", I want "x" to be able to add and edit his/her album, but I do not want "x" to be able to add/edit photos/videos in other albums.

 
Glooper

Joined: 2005-09-21
Posts: 225
Posted: Thu, 2010-05-20 21:55

Currently this is not done automatically through user-homes.. but you can use the normal permissions dialog to allow a user to edit his or her album.

Ben

Benjamin Albert Smith - Photography
Pikitia - New Zealand Photography

 
Glooper

Joined: 2005-09-21
Posts: 225
Posted: Thu, 2010-05-20 21:56

Cheers Nivekiam...

I'll make sure to update the page if I do another release :)

Ben

Benjamin Albert Smith - Photography
Pikitia - New Zealand Photography

 
Shemo725

Joined: 2008-04-18
Posts: 424
Posted: Mon, 2010-05-24 02:02
Glooper wrote:
Currently this is not done automatically through user-homes.. but you can use the normal permissions dialog to allow a user to edit his or her album.

Ben

Benjamin Albert Smith - Photography
Pikitia - New Zealand Photography

that can't be done at a user level, can it? I thought permissions were for an entire album in gallery 3..am I wrong?

also, it appears there may be a bug with your module..check out this thread:
http://gallery.menalto.com/node/96132

 
engineer

Joined: 2005-09-13
Posts: 84
Posted: Mon, 2010-07-05 10:53

I installed a fresh gallery3 as well as some modules. I found that new album can't be created even if log in as admin. Here is the error log:

2010-07-05 03:43:43 -07:00 --- error: Kohana_Exception [ 42 ]: Invalid method group called in Item_Model
/var/www/g3rc/system/libraries/ORM.php [ 269 ]
#0 [internal function]: ORM_Core->__call('group', Array)
#1 /var/www/g3rc/modules/user_homes/helpers/user_homes_event.php(183): Item_Model->group('privacy')
#2 [internal function]: user_homes_event_Core::album_add_form(Object(Item_Model), Object(Forge))
#3 /var/www/g3rc/modules/gallery/helpers/module.php(374): call_user_func_array(Array, Array)
#4 /var/www/g3rc/modules/gallery/helpers/album.php(49): module_Core::event('album_add_form', Object(Item_Model), Object(Forge))
#5 /var/www/g3rc/modules/gallery/controllers/albums.php(171): album_Core::get_add_form(Object(Item_Model))
#6 [internal function]: Albums_Controller->form_add('1')
#7 /var/www/g3rc/system/core/Kohana.php(331): ReflectionMethod->invokeArgs(Object(Albums_Controller), Array)
#8 [internal function]: Kohana_Core::instance(NULL)
#9 /var/www/g3rc/system/core/Event.php(208): call_user_func_array(Array, Array)
#10 /var/www/g3rc/application/Bootstrap.php(67): Event_Core::run('system.execute')
#11 /var/www/g3rc/index.php(94): require('/var/www/g3rc/a...')
#12 {main}

After disable the user home module, 'add a album' works.

 
offensichtlich

Joined: 2010-08-13
Posts: 9
Posted: Sat, 2010-08-14 20:22

Confirming engineer.

2010-08-14 10:58:29 -07:00 --- error: Kohana_Exception [ 42 ]: Invalid method group called in Item_Model
/home/abcde/www/whatever/gallery3/system/libraries/ORM.php [ 269 ]
#0 [internal function]: ORM_Core->__call('group', Array)
#1 /home/abcde/www/whatever/gallery3/modules/user_homes/helpers/user_homes_event.php(183): Item_Model->group('privacy')
#2 [internal function]: user_homes_event_Core::album_add_form(Object(Item_Model), Object(Forge))
#3 /home/abcde/www/whatever/gallery3/modules/gallery/helpers/module.php(374): call_user_func_array(Array, Array)
#4 /home/abcde/www/whatever/gallery3/modules/gallery/helpers/album.php(49): module_Core::event('album_add_form', Object(Item_Model), Object(Forge))
#5 /home/abcde/www/whatever/gallery3/modules/gallery/controllers/albums.php(171): album_Core::get_add_form(Object(Item_Model))
#6 [internal function]: Albums_Controller->form_add('15')
#7 /home/abcde/www/whatever/gallery3/system/core/Kohana.php(331): ReflectionMethod->invokeArgs(Object(Albums_Controller), Array)
#8 [internal function]: Kohana_Core::instance(NULL)
#9 /home/abcde/www/whatever/gallery3/system/core/Event.php(208): call_user_func_array(Array, Array)
#10 /home/abcde/www/whatever/gallery3/application/Bootstrap.php(67): Event_Core::run('system.execute')
#11 /home/abcde/www/whatever/gallery3/index.php(94): require('/home/abcde/www...')
#12 {main}

Deactivating user_homes helped resolving the issue.

 
Glooper

Joined: 2005-09-21
Posts: 225
Posted: Sat, 2010-08-14 21:08

Hi,

cheers for the bug info. I've not updated this module for RC2 yet so this is probably the problem. Will have a look this week sometime.

Cheers
Ben

Benjamin Albert Smith - Photography
Pikitia - New Zealand Photography

 
vangel

Joined: 2009-12-13
Posts: 20
Posted: Sun, 2010-08-15 22:10

very interested in this. Ok so I got the register module , its a bit buggy but works ok. I then installed user homes. It dint break anything but it seems to have no effect. My register module has groups set to something like "members". I am hoping your module will work the same way as the G2 one. I installed everything less than 4 hours ago. RC2 and modules from GIT repo.

Things that would complete this + register module together maybe.

1. We can set a parent album where user homes will be created (it can be changed i supposed without affecting existing homes) just like G2. Like a rollover I currently use in one G2 site.
2. Users can be taken to home album directly. This home album must be created by the user (under the parent album as set in 1.) when they login for the first time they are prompted. They may choose not to create but they will be prompted each time if we set default post login to user home, not sure how the story plot is going here :/.... OR simpler way just create album with username/Name settings automatically and let users edit it if they wish to but prevent asking users to enter directory names please. Its a huge mistake. I just saw this in register module.

3. last but not the least -> default permissions :)

Sorry i am not an impressive coder i can fix small bugs in scripts at most and take very very long to figure things out ^^ But I am ready to pitch in 75$ from me for this to be done plus help with end user testing. I was reading one contest wiki page but it seems its for G2. I am serious. I have set my 75$ aside, anyone else wants to pitch in? If anyone from ops can tell me how i can officially do this please tell me :)

thanks. Love G3, great work, i am a fan again after 4 years. Will be posting in my blog a review on G3 soon.

 
vangel

Joined: 2009-12-13
Posts: 20
Posted: Mon, 2010-08-16 07:05

i know 75$ is not much but thats all i got now. but dont worry ill keep increasing as i get mo cash. ;)

Now I think this can be achieved by some sort of batch script too. I see code has something like events. I am thinking can it be like this.
event "on users account activation" : make album by username under album "parent album name". then use this permission on this "new album".

can someone give me some idea on how to do this?

 
Glooper

Joined: 2005-09-21
Posts: 225
Posted: Mon, 2010-08-16 08:48

Hi Vangel,

Not sure what I understand what your asking for. Probably best that you start a new thread if you asking for help on creating your own module. I expect this module would be a good starting point but it sounds like you are asking for something more specific. I don't get enough time to work on the modules I currently develop let alone some new ones ;-)

Ben

Benjamin Albert Smith - Photography
Pikitia - New Zealand Photography

 
vangel

Joined: 2009-12-13
Posts: 20
Posted: Mon, 2010-08-16 17:28

Thanks Glooper. I understand , I will do a new thread later.
However specifically for your module I cant understand how this home album works post installation. Right now it doesn't do anything at all. Everything looks and works the same as without the module. I dont see any options or maybe I dint look in the right place. I have only searched the admin pages. I am going to manually create and assign albums to users at this point so this still helps.

thanks again

 
zukeris

Joined: 2010-09-17
Posts: 5
Posted: Sat, 2010-10-09 21:07

Hi,
I have noticed that home album can be set only once. You can’t rewrite it later. Besides if you don’t set home album at the same time when you create new user then you can’t set home album at all.

Anyone else have the same problem?

 
Glooper

Joined: 2005-09-21
Posts: 225
Posted: Sun, 2010-10-10 01:11

Fixed on my branch in github and fixed another issue I found when adding new albums.

Fixed version should appear on Gallery Modules in the next day or two. I'm not 100% sure how you tell though :-)

Ben

Benjamin Albert Smith - Photography
Pikitia - New Zealand Photography

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Sun, 2010-10-10 01:24

I think you just need to create a pull request on github so Bharat can pull it into -contrib and then Gallery Modules will pull in the update.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
Glooper

Joined: 2005-09-21
Posts: 225
Posted: Sun, 2010-10-10 02:18

Done.. so hopefully the changes will get pulled in the next day or two. :-)

Ben

Benjamin Albert Smith - Photography
Pikitia - New Zealand Photography

 
crackers

Joined: 2002-10-24
Posts: 67
Posted: Fri, 2010-11-19 19:19

I'm having aproblem setting the user's home album. On "create new user" I can set it to an album, however their personal one dosen't exist yet... so can set that... after I create the user and change to the proper album... it stops working altogether.

This is also true when user registration is enabled. I can't change their home albums....

Any thoughts?

 
damnfool

Joined: 2009-06-24
Posts: 16
Posted: Wed, 2011-03-02 02:13

Great module but I'm having one little problem relating to being able to view movies on the iphone. When I make any edit to the gallery to play back video on the iphone (such as the edit described here http://gallery.menalto.com/node/101033) it will work fine on a non private album but not on a private album. It just can't seem to be able to access the movie clip.
Does anyone have a clue what might be causing this or how to fix it?

 
chamb1

Joined: 2004-12-27
Posts: 32
Posted: Sat, 2011-05-14 02:43

Sounds like a great module, but I am missing something....maybe it is my config or combination of modules.

Are users supposed to see a "home link" in the header? I am not seeing anything with Wind or other themes I have tried....does anyone know of any module-conflicts?

 
chamb1

Joined: 2004-12-27
Posts: 32
Posted: Fri, 2011-05-20 01:10

I figured out how to make a home link...yeah.

 
LordZed

Joined: 2012-08-30
Posts: 9
Posted: Fri, 2012-09-07 05:24

Hi! So now that this post is open again... here is my problem again :)

I want to use user homes with chroot but it looks like it does not work. When I set the album in the user preferences and open the user settings again I can see that "none" is selected. Can someone tell me what I'm doing wrong!?

 
JaronRH

Joined: 2010-07-28
Posts: 23
Posted: Wed, 2013-08-07 01:20

Great plugin! I don't know if you take requests or not but is there any chance you could add a RESTful API hook? I'd really like to be able to get a users home gallery via the RESTful API if possible. Thanks!

 
JaronRH

Joined: 2010-07-28
Posts: 23
Posted: Wed, 2013-08-07 16:04

Nevermind - just add this to the helpers folder as user_home_rest.php You can then call "/rest/user_home" and it will return the home associated with the API key used or 1.

---

<?php defined("SYSPATH") or die("No direct script access.");

class user_home_rest {
static function get($request) {
$home = ORM::factory("user_home")->where("id", "=", identity::active_user()->id)->find();
return ($home->loaded() && $home->home != 0) ? $home->home : "1";
}
}
?>