Photo Albums Issue

I had a member recently tell me he could not see his photo album in the drop down menu when he clicked the Upload button.

 

I checked his profile and he has 13 photo albums but for some reason, only 10 are showing in the drop down menu. Does anyone know where to change this?

 

** He can go directly to the album and add more photos that way.

Nothing to see here
10 Mar 2015

SkyForum reported this problem quite a while back but i cannot find the original post. Ask him if he has the link to the post that he first reported this in. Perhaps there is some kind of solution there.

I don't think there is because he still mentioned the problem in his most recent thread which i did find. http://www.boonex.com/forums/topic/Fixing-what-I-got.htm

However, i know he also brought this issue up at least a year ago.

https://www.deanbassett.com
10 Mar 2015

There has never been a solution. I have been posting about the woes of the photo gallery for some time now. That's my latest post, still waiting on someone to provide a simple mod or fix.

http://towtalk.net ... Hosted by Zarconia.net!
10 Mar 2015

Let's all work together on this.  I will look at the code later and see why it is not pulling in all photo albums.  I also agree with SkyForums on making the changes he outlined to the photo uploads.

Geeks, making the world a better place
10 Mar 2015

I will start messing around in my test site and see if I can find out how to resolve it too.

Nothing to see here
10 Mar 2015

I can see that it 'might' be something that needs to be added in the BxDbFilesModule.php ~ 1173

 

function getInstanceUploadFormArray($aAlbums, $aPrivFieldView, $sAlbumsCaption = false, $sAlbumTitleCaption = false, $sCreateNewAlbumCaption = false)
    {
        $aAlbums[0] = $sCreateNewAlbumCaption ? $sCreateNewAlbumCaption : _t('_sys_album_create_new');
        ksort($aAlbums);
        $aForm = array(
            'form_attrs' => array(
                'id' => '_' . $this->_oConfig->getMainPrefix() . '_album_form',
                'method' => 'post',
                'onSubmit' => 'return submit_quick_upload_form("' . BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . '", $(this).serialize());'
            ),
            'params' => array (
                'db' => array(
                    'submit_name' => 'submit',
                ),
                'checker_helper' => 'BxSupportCheckerHelper',
            ),
            'inputs' => array(
                'albums' => array(
                    'type' => 'select',
                    'caption' => $sAlbumsCaption ? $sAlbumsCaption : _t('_sys_album'),
                    'name' => 'album',
                    'values' => $aAlbums,
                    'attrs' => array(
                        'onchange' => 'check_album_name_for_fields(this.value)'
                    )
                ),
                'title' => array(
                    'type' => 'text',
                    'name' => 'title',
                    'caption' => $sAlbumTitleCaption ? $sAlbumTitleCaption : _t('_sys_album_caption_capt'),
                    'required' => TRUE,
                    'value' => $this->getInstanceUploadAlbumTempName($aAlbums),
                ),
                'allow_view' => $aPrivFieldView,
                'submit' => array(
                    'type' => 'submit',
                    'name' => 'submit',
                    'value' => _t('_Continue'),
                ),
            ),
        );
        return $aForm;

 

I just haven't found where it is trying to fetch the last 10 albums created. Using my test site, I can see where it retrieves only the last 10 albums you created.

Nothing to see here
10 Mar 2015

There are several improvements that have been requested to the albums; all albums, not just photos.  One is to be able to limit the number of albums a member can create (outside of the membership actions which is not really a limit as such).  As SkyForum pointed out in his post, the way the default is on this it leads members to creating a new album each time they click on the upload button; remember that members are lazy.

Geeks, making the world a better place
10 Mar 2015

I think there is one function used to return the number of albums; be it sounds, photos, videos.  Question, are all the albums being displayed when you go to view the albums in the particular section, say when you go to view your photos albums?

Here is the function :

    function getAlbumCount ($aData = array())
    {
        $aFields = array(
            'Type' => $this->sType,
            'Status' => !isset($aData['status']) ? 'active' : $aData['status'],
        );
        if (isset($aData['owner']) && strlen($aData['owner']) > 0) {
            if ((int)$aData['owner'] == 0) {
                $iUserId = getID($aData['owner']);
                $aFields['Owner'] = $iUserId > 0 ? $iUserId : '';
            } else
                $aFields['Owner'] = (int)$aData['owner'];
        }
        $aSqlSpec = $this->_getSqlSpec($aData);

        $sqlJoin = "";
        $sqlJoinWhere = "";
        if (isset($aData['ownerStatus'])) {
            $sqlJoin = "LEFT JOIN `Profiles` ON `Profiles`.`ID`=`{$this->sAlbumTable}`.`Owner`";
            $sqlJoinWhere = "AND `Profiles`.`Status` ";
            if (is_array($aData['ownerStatus']))
                $sqlJoinWhere .= "NOT IN ('" . implode("','", $aData['ownerStatus']) . "')";
            else
                $sqlJoinWhere .= "<> '{$aData['ownerStatus']}'";
        }

        $sqlBegin = "SELECT COUNT(*) FROM `{$this->sAlbumTable}` $sqlJoin";
        $sqlCond  = "WHERE " . $this->_getSqlPart($aFields, ' AND ');
        $sqlQuery = "$sqlBegin $sqlCond {$aSqlSpec['vis']} {$aSqlSpec['def']} {$aSqlSpec['empty']} $sqlJoinWhere";
        return $GLOBALS['MySQL']->getOne($sqlQuery);
    }

Geeks, making the world a better place
10 Mar 2015

I have a question, are all the albums set to the same privacy?  Are some of the albums private?

Geeks, making the world a better place
10 Mar 2015

I am still poking around with this. But from what i can tell so far, the function that retrieves the albums does not have a limit of 10 set anywhere.

I have a feeling it has something to do with the privacy setting of the albums. I have got some more experimenting to do.

So far i am up to 30 albums, and all 30 show in the dropdown and the dropdown has a scrollbar. All 30 albums are public.

Now i am going to start messing with the albums privacy and see what happens.

https://www.deanbassett.com
10 Mar 2015

 

I am still poking around with this. But from what i can tell so far, the function that retrieves the albums does not have a limit of 10 set anywhere.

I have a feeling it has something to do with the privacy setting of the albums. I have got some more experimenting to do.

So far i am up to 30 albums, and all 30 show in the dropdown and the dropdown has a scrollbar. All 30 albums are public.

Now i am going to start messing with the albums privacy and see what happens.

Which is why I asked my question about the privacy settings to those that are seeing the issue.  Of course privacy should not caused this since the person is the owner of the albums they are uploading to; however, it could be the code is not also checking album ownership as well as privacy

Geeks, making the world a better place
10 Mar 2015

I have only a few albums on my site but one is private; I will check and report back.

Geeks, making the world a better place
10 Mar 2015

So far i have not been able to produce the problem. It's working fine on my site.

https://www.deanbassett.com
10 Mar 2015

Eight albums; all show, even the ones set to "Me Only", in the dropdown.  I could add three more to see what happens.

Geeks, making the world a better place
10 Mar 2015

Maybe we need to examine another area; is there anything about the names of the albums that don't show in the list?

Geeks, making the world a better place
10 Mar 2015

I created 10 albums plus I had 3 already (total of 13). All of the privacy levels are set to 'Public', so it's not that setting....Still looking

Nothing to see here
11 Mar 2015

Deano and I had no problem with the albums showing.  If it is not related to perhaps naming convention; then it has to be database config or server config related.  It does not appear to be code related because Deano and I are not having the problem show itself.

Geeks, making the world a better place
11 Mar 2015

You are seeing the issue and SkyForum is seeing the issue; so I would compare between you and SkyForum to try and find a correlation.

Geeks, making the world a better place
11 Mar 2015

Its not the naming convention since I have the labeled as Test 1, Test 2, Test 3, etc.

 Not the template either.

 

I have sent GG and Deano the link to test. Hopefully they can find something.

Nothing to see here
11 Mar 2015

What do your privacy group settings look like in admin?

https://www.deanbassett.com
11 Mar 2015

Yes, I saw it on your test site; it was the first album I created instead of the last.  Can you provide me with FTP access so I can make changes to files, such as dumping out arrays and such?  I am rather busy but will try to find some time.  The best way I have found for trying to figure out what is happening is to either dump variables to the standard out, or to a file on the server; otherwise, it is sort of difficult to know what is happening between point A and point Z

Geeks, making the world a better place
11 Mar 2015

In Admin Panel > Settings > Advanced Settings > Privacy Groups

I have the following checked:

- Me Only

- Public

- Members

- Friends

 

Thats it.

 

Nothing to see here
11 Mar 2015

@Zarcon, @SkyForum,

What database, name and version, are you using?  We are all using the same query; however, it is the database engine that returns the results set.

Geeks, making the world a better place
11 Mar 2015

Further testing shows that it it the older albums created that are not being listed; although at first the user's profile album stayed and the first user created one was not listed.

Geeks, making the world a better place
11 Mar 2015

I still haven't made any progress with this. Hopefully someone will be able to figure out why this is happening. Until then...the search continues..

Nothing to see here
18 Mar 2015

 

I still haven't made any progress with this. Hopefully someone will be able to figure out why this is happening. Until then...the search continues..

There is not much anyone of us can do when it is working on our sites.

Did you do as I suggested and test what is being generated by the code at various steps?

If you want to see what is in an array output to the standard out, in this case the browser;

var_dump();

die();

The die kills the script so that it stops after displaying the contents of the variable.

var_dump($aItems);

die();

Would display the contents of the array $aItems to the browser and then kill the script.  Then you can examine it to see what the array holds; another solution is to write outputs to text files.

 

So you do that at the first point and see if the array is holding the correct values, if yes, then move to the next section and test.  That is the best solution I can give for figuring out what is happening.  It could be that at the first step, the mySQL engine is not returning the complete data set for whatever reason.

Geeks, making the world a better place
18 Mar 2015

I am not sure how it's working for ya'll when it doesn't even work on the demo website. I decided to create an account to the BoonEx demo website to see if it happens there and it does...

 

When I click the Upload button next to 'My Albums'

 

When I click the drop down menu to choose an album, only the last 10 show.. I created albums Test1 - Test11 just to make sure.. Oh, and my default album isnt showing either..

 

 

So obviously, SOMETHING is only allowing the LAST 10 albums to show.

Nothing to see here
26 Mar 2015

I really do not know why i have a line in inc/classes/BxDolFilesModule.php that is different than the origional file. I even checked the patch files from the patches and they are all the same, yet mine is different.

Anyhow, try this and see if it fixes the problem

Edit inc/classes/BxDolFilesModule.php

Search for this line.

$aAlbumsList = $this->oAlbums->getAlbumList($aAlbumParams);

Edit to look like this.

$aAlbumsList = $this->oAlbums->getAlbumList($aAlbumParams, 1, $iAlbumsCount);

I still cannot determine why mine is different. I do not remember editing it myself, i am still looking through all the 7.1 full versions and patches to see if i can find one that looks like mine. The code to get the album count is in the code, yet for some reason in the current file it is not passed to the get album list function, yet in mine it is. Without it, it defaults to 10.



https://www.deanbassett.com
26 Mar 2015

I tried this in the past but for some reason this time around it worked...

$aAlbumsList = $this->oAlbums->getAlbumList($aAlbumParams, 1, $iAlbumsCount);

If any wants the line number, mine was 862.

Is the solution.  Thanks

https://dolphin-techs.com - Skype: Dolphin Techs
26 Mar 2015

It worked! Ok, Now I'm gettin excited.

I would be satisfied for now if we could just remove the capability to create a new album from that page. Instead, we could just add a footnote that says 'to create a new album, go to your photo page' or something to that effect. Then we don;t have to mess around with permission problems or anything else. Just change the name of the upload page to 'quick upload' and only allow photos to be uploaded to an existing album. Although not perfect, it would certainly be better than what's there now...

http://towtalk.net ... Hosted by Zarconia.net!
26 Mar 2015

OR..... along line 1168 or so, same file. How do we change this so it does NOT create a new name, Another way to do it would be to use a name that can be disallowed somehow throwing an error forcing them to make a name for the new album instead of that stupid date+1.... something like Enter New Album Name. K.I.S.S. is the order of the day in anything Dolphin.... Force them to make a new name really solves the problem.....

function getInstanceUploadAlbumTempName($aAlbums, $iAttempt = 1)
    {
        $sTemp = getLocaleDate(time());
        $sNewName = $iAttempt > 1 ? _t('_sys_album_caption_new', $sTemp, $iAttempt) : $sTemp;
        if (in_array($sNewName, $aAlbums)) {
            $iAttempt++;
            $sNewName = $this->getInstanceUploadAlbumTempName($aAlbums, $iAttempt);
        }
        return $sNewName;
    }

    function getInstanceUploadFormArray($aAlbums, $aPrivFieldView, $sAlbumsCaption = false, $sAlbumTitleCaption = false, $sCreateNewAlbumCaption = false)
    {
        $aAlbums[0] = $sCreateNewAlbumCaption ? $sCreateNewAlbumCaption : _t('_sys_album_create_new');
        ksort($aAlbums);
        $aForm = array(
            'form_attrs' => array(
                'id' => '_' . $this->_oConfig->getMainPrefix() . '_album_form',
                'method' => 'post',
                'onSubmit' => 'return submit_quick_upload_form("' . BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . '", $(this).serialize());'
            ),
            'params' => array (
                'db' => array(
                    'submit_name' => 'submit',
                ),
                'checker_helper' => 'BxSupportCheckerHelper',
            ),
            'inputs' => array(
                'albums' => array(
                    'type' => 'select',
                    'caption' => $sAlbumsCaption ? $sAlbumsCaption : _t('_sys_album'),
                    'name' => 'album',
                    'values' => $aAlbums,
                    'attrs' => array(
                        'onchange' => 'check_album_name_for_fields(this.value)'
                    )
                ),
                'title' => array(
                    'type' => 'text',
                    'name' => 'title',
                    'caption' => $sAlbumTitleCaption ? $sAlbumTitleCaption : _t('_sys_album_caption_capt'),
                    'required' => TRUE,
                    'value' => $this->getInstanceUploadAlbumTempName($aAlbums),
                ),
                'allow_view' => $aPrivFieldView,
                'submit' => array(
                    'type' => 'submit',
                    'name' => 'submit',
                    'value' => _t('_Continue'),
                ),
            ),
        );
        return $aForm;
    }

http://towtalk.net ... Hosted by Zarconia.net!
26 Mar 2015

Thank you very much Deano!!! That worked.

Nothing to see here
26 Mar 2015

I checked and it is not in my code and I started with 7.1.0 and went through the upgrades.

 

It not only default to 10, it is the last 10; older albums are pushed off the list.

Geeks, making the world a better place
26 Mar 2015

I think we can safely say a bug; hopefully fixed before 7.2 is released.

Geeks, making the world a better place
26 Mar 2015

I haven't tried it yet, but I would assume the same thing happens for all albums (photos, videos, sounds, files) if you have more than 10.

 

Ticket has been created:

http://www.boonex.com/trac/dolphin/ticket/3505

Nothing to see here
26 Mar 2015

 

It worked! Ok, Now I'm gettin excited.

I would be satisfied for now if we could just remove the capability to create a new album from that page. Instead, we could just add a footnote that says 'to create a new album, go to your photo page' or something to that effect. Then we don;t have to mess around with permission problems or anything else. Just change the name of the upload page to 'quick upload' and only allow photos to be uploaded to an existing album. Although not perfect, it would certainly be better than what's there now...

 

If you still have an account on my site. Check how i have mine setup. I moved the option to create a new album to the bottom of the list. I have it defaulting to using the first album instead of creating a new one.

If they do choose to create a new one, the album name is empty and if they try to submit the form with a empty name it pops up a error.

Check it out. I think you may find it acceptable. http://www.deanbassett.com

I still have a few bugs to work out on this. It's assuming photos, so i have to come up with a way to change the error message based on what upload form it is. Still working on that one.

https://www.deanbassett.com
26 Mar 2015

I decided to use a more generic error message instead of trying to figure out how to customize each one.

https://www.deanbassett.com
26 Mar 2015

Yes Yes Yes Deano! That will be perfect. Well done. Now they can't just create endless 1 image albums. Ultimately, the best of both worlds would be to set a minimum amount of photos to create a new album. Even if you set it to 2, then they would go looking for a default album to pop it into. Just a thought.

Can I have the changes so I can add them to my site? Or are you going to create a little mod?

http://towtalk.net ... Hosted by Zarconia.net!
27 Mar 2015

Very nice addition Deano.. I assume you will umm.. tell how one day :)

Nothing to see here
27 Mar 2015

Yea, i will post code soon. I have been at work at my other job, and other things i need to take care of. I'll get to it as soon as i can.

https://www.deanbassett.com
27 Mar 2015

Ok. Sorry for the delay. I was quite busy.

Here is the complete set of modifications.

Edit inc/classes/BxDolFilesModule

Look for this section starting at about line 813

    function actionUpload($sAction = '')
    {
        $sOwnerNick = getUsername($this->_iProfileId);
        $sOwnerAlbum = str_replace('{nickname}', $sOwnerNick, $this->_oConfig->getGlParam('profile_album_name'));
        if (!empty($sAction)) {
            $aRes = array('status' => 'Fail', 'error_msg' => _t('_sys_txt_sbs_error_occured'));
            $iAlbumId = (int)$_GET['album'];
            if (!$iAlbumId) {

Change line 820 from this

if (!$iAlbumId) {

to this

if ($iAlbumId == 9999999999) { // Deano. Changed from !$iAlbumId to $iAlbumId != 9999999999



Now go down a few lines to about line 873 and look for this.

$sCode = $GLOBALS['oFunctions']->transBox($sCode, TRUE);

Insert this directly above that line.

// Deano Mod Start               
$sScript = "
<script>
var oTitle = $('tr:has(input[name=title]):last');
var oPrivacy = $('tr:has(select[name=AllowAlbumView]):last');
oTitle.hide();
oPrivacy.hide();
</script>
";
                $sCode = $sCode . $sScript;
// Deano Mod End               


Now look for this at about line 1173

    function getInstanceUploadFormArray($aAlbums, $aPrivFieldView, $sAlbumsCaption = false, $sAlbumTitleCaption = false, $sCreateNewAlbumCaption = false)
    {
        $aAlbums[0] = $sCreateNewAlbumCaption ? $sCreateNewAlbumCaption : _t('_sys_album_create_new');


Change this line

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

To this.

// Deano Mod Start - Change 0 to 9999999999
$aAlbums[9999999999] = $sCreateNewAlbumCaption ? $sCreateNewAlbumCaption : _t('_sys_album_create_new');
// Deano Mod End

Then a few lines down at about line 1204 look for this.

'value' => $this->getInstanceUploadAlbumTempName($aAlbums),

And change to this.

'value' => '',


Thats it for inc/classes/BxDolFilesModule save it.

Now open inc/js/albums.js

Look for this at about line 22

function submit_quick_upload_form(sUrl, sFields) {

Add this directly under it.

    // Deano. Code Start
    aFields = sFields.split("&");
    if(aFields[0] == 'album=9999999999' && aFields[1] == 'title=') {
        alert('Error! form field cannot be empty.');
        return false;
    }
    // Deano. Code End


And that should do it.

https://www.deanbassett.com
31 Mar 2015

 

if ($iAlbumId == 9999999999) { // Deano. Changed from !$iAlbumId to $iAlbumId != 9999999999

 Can you check this Deano as there is a conflicting statement.

Geeks, making the world a better place
31 Mar 2015

 

 

if ($iAlbumId == 9999999999) { // Deano. Changed from !$iAlbumId to $iAlbumId != 9999999999

 Can you check this Deano as there is a conflicting statement.

 
The code is accurate. The comment is not. But i can't edit it now. Time expired.

https://www.deanbassett.com
31 Mar 2015

Hello everybody!

This issue was fixed long ago in ticket #3287.

Regards

10 Apr 2015

 

Hello everybody!

This issue was fixed long ago in ticket #3287.

Regards

 Not sure how it was fixed if I was able to recreate it on the BoonEx demo site.

Nothing to see here
10 Apr 2015

It would be GREAT if a group of active forum members could (because it appears BoonEx won't) maintain a subscriber list that references all forum-reported BoonEx-Dolphin bugs and (hopefully) fixes.  Dolphin developers and site admins shouldn't have to keep a constant eye on the Dolphin-related forums and/or wait for the next version release for "minor" bug fixes.  Once a bug has been reported *and* confirmed then I'd like to know about it automatically... along with updates and potential fixes.

http://pkforum.dolphinhelp.com
10 Apr 2015

Hello Zarcon!

This fix wasn't inlcuded to release yet (will appear in Dolphin 7.2.0). But it is available in current SVN.

Regards

11 Apr 2015

As the Boonex wheels turn, so do the sands of time... Hello Leonid, long time no hear from....

Deano, would that SVN he's talking about be what you are building? I am very cornfused now...

http://towtalk.net ... Hosted by Zarconia.net!
12 Apr 2015

I don't think his ticket includes the changes we made to being able to create endless 1 image albums....

I think I'm gonna just use Deanos fix. I think it's better.... Will need to make a note to watch it when 7.2 comes out ... OR ... we could convince Leonid to adopt these extra changes instead ... (wink)

http://towtalk.net ... Hosted by Zarconia.net!
12 Apr 2015

Deano. I installed the code as you described on this page. Have an issue. When I select 'Create New Album' the new text box is not added that would allow me to name it...

What did I miss?

http://towtalk.net ... Hosted by Zarconia.net!
12 Apr 2015
12 Apr 2015
 
 
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.