XP Publish doesn't show public albums to users XP Publish doesn't show public albums to users
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

XP Publish doesn't show public albums to users

Started by ErisDS, July 25, 2007, 12:52:48 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ErisDS

Hi,

I have followed as many instructions as I could find, tried different combinations of settings and followed all of the troubleshooting steps and cannot find out why this is happening.

My Site Details
My site is here: foulds50 dot adella dot co dot uk (spoiled jic).
Test user: test
Test pass: tester

Result of Upload Troubleshoot
I have set my settings to debug for all and 1 upload as per the instructions.
Everything worked as expected, and all public albums were listed as options for both admin and user.

Problem Description
My problem is only with the Web Publishing Wizard, and only for standard users. The problem comes with step 8 as per the docs:

4.11.3.2 XP Web Publishing Wizard: Uploading pictures
    * From the "Welcome username" window you have an option of uploading your picture(s) into one of the existing albums or starting a new album. Click "Next" when you are ready.

If I am logged into my administrator account, this works fine and I am presented with all of my albums. (I have 1 album in a category, and 4 under no category all set to allow visitor uploads as per the screenshot below).

However, if I am logged in as a normal user I am only given the option to create a new album.
This isn't the case if I upload via the "Upload Files" button on the website, only in the XP Publish Wizard.

Originally I had "users can have personal galleries" turned off, and thus I got the message "Sorry but there is no album where you are allowed to upload pictures with this wizard".

I do not want every user creating a new gallery, I want them to use the already created public galleries!!

Screenshots of My Settings
I have checked all my settings. There are a series of screenshots here to show you what I have done.
Album Settings (Same for all)
(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.adella.co.uk%2Falbum-ss.jpg&hash=71e2cec4ae3361ffe14bec52c66d8cfdbf6ce850)
Group Settings
(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.adella.co.uk%2Fgroups-ss.jpg&hash=50f87d284a5aafb50b8c9d6ba3bb0aa2c3b42955)
Config - User Settings
(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.adella.co.uk%2Fusersettings-ss.jpg&hash=1a3feae1b2901cf1fcc76808f6ba94c34918a88b)
Config - Files and Thumnails Advanced Settings
(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.adella.co.uk%2Ffiles-ss.jpg&hash=99971dd28f67965ed1e6d40fe8115e16f8974b73)

I apologise if there really is just a missing setting and I am wasting your time. I have followed all the instructions to the best of my ability!

Thanks,
Eris

Nibbler

This is intentional, users may only use the publisher for their personal albums.

ErisDS

May I ask why? Or is it written somewhere?

Is there a *mod* I can do, a line of code that can be changed?
If not could you point me in the direction of the right file?

You see I am trying to set up an album for family.. people who struggle with turning their computers on. And we want to have a global gallery that everyone can add their pictures to from a special weekend.

These people will get confused if everyone has a separate album!

Thanks,
Eris

Nibbler

xp_publish.php


    if (USER_IS_ADMIN) {
        $public_albums = cpg_db_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category < " . FIRST_USER_CAT . " ORDER BY title");
        if (mysql_num_rows($public_albums)) {
            $public_albums_list = cpg_db_fetch_rowset($public_albums);
        } else {
            $public_albums_list = array();
        }
    } else {
        $public_albums_list = array();
    }


remove the admin check, like so


    //if (USER_IS_ADMIN) {
        $public_albums = cpg_db_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category < " . FIRST_USER_CAT . " ORDER BY title");
        if (mysql_num_rows($public_albums)) {
            $public_albums_list = cpg_db_fetch_rowset($public_albums);
        } else {
            $public_albums_list = array();
        }
    //} else {
    //    $public_albums_list = array();
    //}

ErisDS


ErisDS

Sorry for the double post, I can't edit my last post..

In order to get it to work if "Personal gallery upload allowed" is turned off you also need to comment out these lines:


xp_publish.php (line 611)
  if (!(USER_CAN_CREATE_ALBUMS || USER_IS_ADMIN)) {
        template_extract_block($template_select_album, 'existing_albums');
        template_extract_block($template_select_album, 'create_album');

        $params = array('{WELCOME}' => sprintf($lang_xp_publish_php['welcome'], USER_NAME),
            '{NO_ALBUM}' => $lang_xp_publish_php['no_alb'],
            );

        echo template_eval($template_select_album, $params);

        $WIZARD_BUTTONS = "false,false,false";
    } else if (!$alb_count) {

Remove first if condition:
/*  if (!(USER_CAN_CREATE_ALBUMS || USER_IS_ADMIN)) {
        template_extract_block($template_select_album, 'existing_albums');
        template_extract_block($template_select_album, 'create_album');

        $params = array('{WELCOME}' => sprintf($lang_xp_publish_php['welcome'], USER_NAME),
            '{NO_ALBUM}' => $lang_xp_publish_php['no_alb'],
            );

        echo template_eval($template_select_album, $params);

        $WIZARD_BUTTONS = "false,false,false";
    } else
*/
if (!$alb_count) {


This makes the album list show up if the user is not allowed to create personal albums.

Hope this is ok and doesn't cause other problems.

Eris


ErisDS

Ok, so this is a little more complicated than first thought.
I have got it working the way that I want now, and am posting this in case anyone else wants to do the same as me in future.

To enable users to upload to a public album this check also has to be commented out:

xp_publish.php (line 729)

   if (!USER_IS_ADMIN) {
        $result = cpg_db_query("SELECT category FROM {$CONFIG['TABLE_ALBUMS']} WHERE aid='$album' and category = '" . (USER_ID + FIRST_USER_CAT) . "'");
        if (mysql_num_rows($result) == 0) simple_die(ERROR, $lang_db_input_php['unknown_album'], __FILE__, __LINE__);
        $row = mysql_fetch_array($result);
        mysql_free_result($result);
        $category = $row['category'];
    } else {


comment out the lines as shown

   if (!USER_IS_ADMIN) {
     //   $result = cpg_db_query("SELECT category FROM {$CONFIG['TABLE_ALBUMS']} WHERE aid='$album' and category = '" . (USER_ID + FIRST_USER_CAT) . "'");
     //   if (mysql_num_rows($result) == 0) simple_die(ERROR, $lang_db_input_php['unknown_album'], __FILE__, __LINE__);
    //    $row = mysql_fetch_array($result);
    //    mysql_free_result($result);
   //     $category = $row['category'];
   // } else {


Otherwise it goes through the publish wizard but doesnt actually add the photos.

If you have turned off public albums and want to get rid of the form that allows them to create a new album you also need to change these lines:

xp_publish.php (line 641)

} else {
        template_extract_block($template_select_album, 'no_album');

        if (!USER_IS_ADMIN) template_extract_block($template_select_album, 'select_category');

        $params = array('{WELCOME}' => sprintf($lang_xp_publish_php['welcome'], USER_NAME),
            '{UPLOAD}' => $lang_xp_publish_php['upload'],
            '{ALBUM}' => $lang_xp_publish_php['album'],
            '{SELECT_ALBUM}' => $html_album_list,
            '{CATEGORY}' => $lang_xp_publish_php['category'],
            '{SELECT_CATEGORY}' => $html_cat_list,
            '{CREATE_NEW}' => $lang_xp_publish_php['create_new'],
            '{POST_ACTION}' => trim($CONFIG['site_url'], '/') . '/' . $_SERVER['PHP_SELF'] . '?cmd=create_album',
            );

        echo template_eval($template_select_album, $params);

        $ONNEXT_SCRIPT = 'create_alb_or_use_existing();';
        $ONBACK_SCRIPT = 'window.external.FinalBack();';
        $WIZARD_BUTTONS = 'true,true,false';
    }


change to:


} else {
        template_extract_block($template_select_album, 'no_album');
template_extract_block($template_select_album, 'create_album');

       // if (!USER_IS_ADMIN) template_extract_block($template_select_album, 'select_category');

        $params = array('{WELCOME}' => sprintf($lang_xp_publish_php['welcome'], USER_NAME),
            '{UPLOAD}' => $lang_xp_publish_php['upload'],
            '{ALBUM}' => $lang_xp_publish_php['album'],
            '{SELECT_ALBUM}' => $html_album_list,
           // '{CATEGORY}' => $lang_xp_publish_php['category'],
           // '{SELECT_CATEGORY}' => $html_cat_list,
          //  '{CREATE_NEW}' => $lang_xp_publish_php['create_new'],
            '{POST_ACTION}' => trim($CONFIG['site_url'], '/') . '/' . $_SERVER['PHP_SELF'] . '?cmd=create_album',
            );

        echo template_eval($template_select_album, $params);

        $ONNEXT_SCRIPT = 'startUpload();';
        $ONBACK_SCRIPT = 'window.external.FinalBack();';
        $WIZARD_BUTTONS = 'true,true,false';
    }


This disables the display of the form, and makes the next button go straight to upload without trying to create a new album.

This is a very rough and ready fix. Other things probably need to be done to make it behave properly in all cases.

Eris

Nibbler


skidpics

I edited the code to match this from Nibbler:


Quote//if (USER_IS_ADMIN) {
        $public_albums = cpg_db_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category < " . FIRST_USER_CAT . " ORDER BY title");
        if (mysql_num_rows($public_albums)) {
            $public_albums_list = cpg_db_fetch_rowset($public_albums);
        } else {
            $public_albums_list = array();
        }
    //} else {
    //    $public_albums_list = array();
    //}

and this from ErisDS :
Quote
   if (!USER_IS_ADMIN) {
     //   $result = cpg_db_query("SELECT category FROM {$CONFIG['TABLE_ALBUMS']} WHERE aid='$album' and category = '" . (USER_ID + FIRST_USER_CAT) . "'");
     //   if (mysql_num_rows($result) == 0) simple_die(ERROR, $lang_db_input_php['unknown_album'], __FILE__, __LINE__);
    //    $row = mysql_fetch_array($result);
    //    mysql_free_result($result);
   //     $category = $row['category'];
   // } else {

and with that, xp publisher will not work. I want the users to be able to upload to the public albums and create user albums.  Did I miss something somewhere?

dolomites

Quote from: Nibbler on July 25, 2007, 01:16:25 PM
xp_publish.php


    if (USER_IS_ADMIN) {
        $public_albums = cpg_db_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category < " . FIRST_USER_CAT . " ORDER BY title");
        if (mysql_num_rows($public_albums)) {
            $public_albums_list = cpg_db_fetch_rowset($public_albums);
        } else {
            $public_albums_list = array();
        }
    } else {
        $public_albums_list = array();
    }


remove the admin check, like so


    //if (USER_IS_ADMIN) {
        $public_albums = cpg_db_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category < " . FIRST_USER_CAT . " ORDER BY title");
        if (mysql_num_rows($public_albums)) {
            $public_albums_list = cpg_db_fetch_rowset($public_albums);
        } else {
            $public_albums_list = array();
        }
    //} else {
    //    $public_albums_list = array();
    //}





If, like in the web version, you want enable user uploads only in the albums where you have set "users can upload pictures", you have to change

$public_albums = cpg_db_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category < " . FIRST_USER_CAT . " ORDER BY title");

to

$public_albums = cpg_db_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category < " . FIRST_USER_CAT . " AND uploads='YES' ORDER BY title");

else the wizard shows all albums and not only open albums.