I wish to create a default Friends Only Alb

I wish to create a default Friends Only album for photos and videos, but photos are the most important.

Each module creates two albums for members and each is set to privacy level 3 (public)

I've altered files in the Photos and Inc modules and changed the database to successfully allow all members access to two additional albums and the Create New Album option is now last on the list

The current configuration of Dolphin encourages members to create a new album for every photo they upload and I wish to stop this.

My upload form now looks like this:

  • Profile Photos
  • General Photos
  • Friends Only Photos
  • Cover Photos
  • Create New Album . . .

All options with the exception of Create New Album currently have a default privacy level of 3, but Friends Only Photos must be 5.

I'm unable to change this. Alex T supplied this function in a previous and lengthy thread, but I'm not sure how it's meant to work.

    function checkDefaultAlbums($iProfileId)

    {

    $sUri = $this->_oConfig->getUri();

    $aAlbums = $this->_oConfig->getDefaultAlbums(true, array('{nickname}' => getUsername($iProfileId)));

                 foreach($aAlbums as $sAlbum) {

        $aAlbumInfo = $this->oAlbums->getAlbumInfo(array('fileUri' => uriFilter($sAlbum), 'owner' =>    $iProfileId));

        if(!empty($aAlbumInfo) && is_array($aAlbumInfo))

        continue;

            $this->oAlbums->addAlbum(array(

                'caption' => $sAlbum,

                'owner' => $iProfileId,

                'AllowAlbumView' => ($sAlbum == getParam('sys_album_default_name')) ? BX_DOL_PG_HIDDEN : $this->oAlbumPrivacy->_oDb->getDefaultValueModule($sUri, 'album_view'),

            ), false);

      }

    }

AlexT said: "All albums have the same default privacy level, if you need different privacy levels for different albums you need custom modification, I would suggest to do this in the following code in inc/classes/BxDolPrivacy.php file"

The original thread is here:

https://www.boonex.com/forums/topic/Modifying-default-photo-album.htm

----------------

I also wish to have Profile Photos as the third item and that's something else I'm struggling with.

Quote · 28 May 2018

Hello john42!

 

The easiest way to add the new album in your case it would be in one more addAlbum calling. Just add after the following lines in the given example:

>getDefaultValueModule($sUri, 'album_view'),

            ), false);

one more calling of the mentioned method:

 

$this->oAlbums->addAlbum(array(

                'caption' => '[your album caption]',

                'owner' => $iProfileId,

                'AllowAlbumView' => 'BX_DOL_PG_FRIENDS',

            ), false);


With the best regards, Leonid

Quote · 29 May 2018

Thanks Leonid, I'm working on it but I'm busy with other things for a week. I'll report back when I can.

Quote · 30 May 2018

 

@Leonid, sorry to drag this up again after 9 months, but I had a pretty torrid time over most of last year. I thought I'd bring it to the surface while the forum is quiet as it may also help others.

To refine my question, I'm really trying to do 2 things:

1. Automatically create one or two additional albums for every member. This is what your previous post attempted to do, but I can't get the array to change anything.

2. Put items in a decent order when members post photos. The current choices are in this order

Create New Album
Admin's Photos
Admin's Cover Photos

I want the order to be:

Admin's Photos
Friends Only
Admin's Profile Photos (See note below)
Admin's Cover Photos
Create New Album. . .

This puts the least used items at the bottom, not the top.

Your code above addressed Item 1 and if I can get it to work, it's much easier than what AlexT suggested in another post.

I managed to get "Create New Album to the bottom of the list, but I can't remember how. Unfortunately I can't get the items in the order I need.

This will actually go on my colleagues licensed site when it works.

All help appreciated.

Note re Profile Photos.  I'm putting them in a different album because the profile photo is changed every time a member uploads a new photo. If there's a way of stopping this from happening, I haven't been able to find it.

 

 

 

Quote · 6 Jan 2019

 

 

Note re Profile Photos.  I'm putting them in a different album because the profile photo is changed every time a member uploads a new photo. If there's a way of stopping this from happening, I haven't been able to find it.

 

The profile photo is the first photo listed in the profile photo album.  When a new image is uploaded, it is placed at the front of the album; which might make sense if a person wants a new profile photo image displayed by uploading a new image.  Instead of placing the photo at the beginning of the album it needs to be placed at the end of the album and therefore, the current profile photo will not be changed

Geeks, making the world a better place
Quote · 7 Jan 2019

Hello johnk42!

 

No prob to return to this theme so much time later :-), ok let's review your challenges:

 

1) Yes, my answer solves the creation of the necessary albums in the specific place. Just need to insert this code to new member's join. It can be done simply via the editing the inc/classes/BxDolJoinProcessor.php, after the line 

 

list($iMemberId, $sStatus) = $this->registerMember();


or via the alert system as more complex, but more flexible variant.

 

But in this case my code should be little changed with the following beginning:

 

$oAlbums = new BxDolAlbums('bx_photos', {id of a new member});

 

2) To place the "Create" variant to the end of the available albums list you need to change the following part in the inc/classes/BxDolFilesModule.php

 

$aAlbums[0] = $sCreateNewAlbumCaption ? $sCreateNewAlbumCaption : _t('_sys_album_create_new');
        ksort($aAlbums);

 

just trade the places of the shown lines:

 

ksort($aAlbums);
$aAlbums[0] = $sCreateNewAlbumCaption ? $sCreateNewAlbumCaption : _t('_sys_album_create_new');

 

You may also to use another sorting function than ksort too, to get another order of the albums.

Quote · 7 Jan 2019

 

Thanks for your help @leonid

You're right it does as you say. For those who decide to make these changes, they only apply to new members or a new installation.  Thus you won't see the changes until you create a new profile. That's where I was making a mistake.  This is really the way it should be because it doesn't add a heap of new albums to an existing member's album list. 

I had moved ksort to the line above and that's how I was able to get the dreaded Create new Album option to the bottom of the stack.

I also tried rsort which reverses the sort order, but it's difficult to get the main album to the top.

ksort:
   Cover Photos
   Friends Photos
   Main Photos
   Profile Photos
   Create New Album . . .

rsort:
   Profile Photos
   Main Photos
   Friends Photos
   Cover Photos
   Create New Album. . .

My preferred sort order would be:

   Main Photos
   Friends Photos
   Profile Photos
   Cover Photos
   Create new Album. . .

At least I'm half way there.

Finally: It works without me changing inc/classes/BxDolJoinProcessor.php.

I'm unable to do it because I don't know what to place here: {id of new member});

$oAlbums = new BxDolAlbums('bx_photos', {id of a new member});

Regards

 

Quote · 9 Jan 2019

Hello johnk42!


No prob :-)


So regarding your sorting issues - well, ksort is the best way, just need to provide a proper order of your albums by ids. So your list should have for example:

120 =>   Main Photos
121 =>   Friends Photos
122 =>   Profile Photos
123 =>   Cover Photos


the these lines:


 

ksort($aAlbums);
$aAlbums[0] = $sCreateNewAlbumCaption ? $sCreateNewAlbumCaption : _t('_sys_album_create_new');


will have the effect which you want.


About your second trouble - well, if you sure that user already logged then you may just call getLoggedId()

function instead of {id of a new member}  . If you not sure about logged then need to see a place where you call $oAlbums code.

Quote · 9 Jan 2019

The id of the new member is that created by mysql when it adds the record; increments the id automatically when the record of the new member is created in the Profile table.  Therefore, I guess the script creates the new record in the database and then polls the database for the record id so it can then create the photo albums and assign them to the correct user.  I don't know; perhaps a bit more info on how it all works will help here.

Geeks, making the world a better place
Quote · 9 Jan 2019

Leonid, if you're out there can you please look at the attached error report?

I've made the changes to my Photos Upload Form as per your instructions and they're fantastic. I now have:

Please Select . . .

    General Photos 

    Friends Only

    Mt Profile Photos

    My Cover photos

I've removed Create New Album as an option, but members can still do that on their Albums page.

Everything works perfectly but . . . . . 

  • A new member initially gets the attached MySQL error message when uploading their FIRST photo.
  • When they go back using the browser back button  and return, the message has gone and they can safely upload the first photo.
  • The error appears regardless of the album chosen.
  • Future photos can be uploaded fine. Once the error message is bypassed everything works perfectly and the message is never seen again.

Note: I originally did some changes suggested by AlexT. They were far more complex and didn't work as well as yours. I cleaned up AlexT's code, but I may have missed something.

Having said that, I didn't experience any problems until I made your changes.

Database error.rtf · 108K · 160 downloads
Quote · 2 May 2019

Hello 

 

Yes, I missed that. So need to add the following code before the end of function checkDefaultAlbums:

 

$iVis = 4;
foreach (array('General Photos', 'Friends Only') as $sName) {
      $aAlbumInfo = $this->oAlbums->getAlbumInfo(array('fileUri' => uriFilter($sName), 'owner' => $iProfileId));
      if (empty($aAlbumInfo)) {
	 $this->oAlbums->addAlbum(array(
	      'caption' => $sName,
	      'owner' => $iProfileId,
	      'AllowAlbumView' => $iVis,
         ), false);
	$iVis++;
     }
}

 

 

Quote · 2 May 2019
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.