comment for registered user only?

kenosh

Joined: 2003-12-14
Posts: 3
Posted: Sun, 2003-12-14 18:25

HI, just like to find out is there anyone out there who can make "comment for registered user only" by default? Meaning that I dont have to go into each album and change the setting permission "who can make comment" to LOGGEDIN.. Instead, I want all album that created to be "LOGGEDIN" by default.

Thanks in advance for those who can reply me and thanks for those who are reading it. :)

 
beckett
beckett's picture

Joined: 2002-08-16
Posts: 3474
Posted: Tue, 2003-12-16 18:46

Eventually we'll make this easier.
For now... you'll want to edit the code in util.php just a bit.
Find the createNewAlbum() function.

Change these lines:

        $gallery->album->setOwner($gallery->user->getUid());
        $gallery->album->save();

to

        $gallery->album->setOwner($gallery->user->getUid());
        $loggedIn = $gallery->userDB->getLoggedIn();
        $loggedInUid = $loggedIn->getUid();
        $gallery->album->setAddComments($loggedInUid, 1);
        $gallery->album->save();

-Beckett (

)

 
kenosh

Joined: 2003-12-14
Posts: 3
Posted: Wed, 2003-12-17 12:37

becket: I added the code in but seems like it's still the same. Here is the coding...

function createNewAlbum( $parentName, $newAlbumName="", $newAlbumTitle="", $newAlbumDesc="") {
global $gallery;

// get parent album name
$albumDB = new AlbumDB(FALSE);

// set new album name from param or default
$gallery->session->albumName = $albumDB->newAlbumName($newAlbumName);

$gallery->album = new Album();
$gallery->album->fields["name"] = $gallery->session->albumName;

// set title and description
if ($newAlbumTitle) {
$gallery->album->fields["title"] = $newAlbumTitle;
}
if ($newAlbumDesc) {
$gallery->album->fields["description"] = $newAlbumDesc;
}

$gallery->album->setOwner($gallery->user->getUid());
$loggedIn = $gallery->userDB->getLoggedIn();
$loggedInUid = $loggedIn->getUid();
$gallery->album->setAddComments($loggedInUid, 1);

$gallery->album->save();

/* if this is a nested album, set nested parameters */
if ($parentName) {
.... blah blah blah blah
}

Please advice. Thanks.

 
beckett
beckett's picture

Joined: 2002-08-16
Posts: 3474
Posted: Wed, 2003-12-17 15:23

Oops. I goofed ;) I need more sleep....!

Try this instead:

        $gallery->album->setOwner($gallery->user->getUid());
        $loggedIn = $gallery->userDB->getLoggedIn();
        $everybody = $gallery->userDB->getEverybody();
        $loggedInUid = $loggedIn->getUid();
        $everybodyUid = $everybody->getUid();
        $gallery->album->setAddComments($everybodyUid, 0);
        $gallery->album->setAddComments($loggedInUid, 1);
        $gallery->album->save();

Gotta turn off EVERYBODY first... *then* add LOGGEDIN. Let me know how that goes.

 
beckett
beckett's picture

Joined: 2002-08-16
Posts: 3474
Posted: Wed, 2003-12-17 15:26

Ooh... a little more thought tells me that the UIDs for these guys are straightforward, so instead you could replace all that with just:

        $gallery->album->setOwner($gallery->user->getUid());
        $gallery->album->setAddComments('everybody', 0);
        $gallery->album->setAddComments('loggedin', 1);
        $gallery->album->save();

That's a little clearer.
-Beckett (

)

 
kenosh

Joined: 2003-12-14
Posts: 3
Posted: Wed, 2003-12-17 22:21

cool beckett.. it's what I wanted right now... thanks for your time, effort and coding. :)