CMS MADE SIMPLE FORGE

Album

 

[#7383] Album don't work when using id's

avatar
Created By: MeiRieM (meiriem)
Date Submitted: Fri Dec 23 18:09:15 -0500 2011

Assigned To: Guilherme Viebig (viebig)
Version: 1.10-beta2
CMSMS Version: 1.10.2
Severity: Minor
Resolution: Won't Fix
State: Closed
Summary:
Album don't work when using id's
Detailed Description:
Hello,

When using a tag with only IDs like {cms_module module='Album' albums='13'}
nothing shows up.
I think the reason is a wrong query.

In action.default.php line 65-69:
$query = 'SELECT distinct album_id FROM
'.cms_db_prefix().'module_album_albums WHERE album_name';
    $f = 0;
    if( count($tmps) )
      {
	$query .= ' IN ('.implode(',',$tmps).')';


should be:
$query = 'SELECT distinct album_id FROM
'.cms_db_prefix().'module_album_albums WHERE';
    $f = 0;
    if( count($tmps) )
      {
	$query .= ' album_name IN ('.implode(',',$tmps).')';



History

Comments
avatar
Date: 2011-12-23 18:49
Posted By: Mark Reed (mark)

What kind of output were you looking for?

From Albums Help...

If you only want certain albums shown then use code like this, you have to have
at least 1 "name" in this call, this will show in "albums" mode:

{Album albums='one,3'}   

The code above allows you to show in a page albums whose names and IDs are 'one'
and '3' for example. If you do not provide paramater "albums", it will show all
the albums.

If you only want 1 specific album shown then use code like this, "name" of album
only, this will show in "gallery" mode:

{Album albums='album name'}

The code above allows you to show in a page an album named "album name" for
example.

In other words...

{Album albums='one,3'}   "THIS WILL SHOW JUST THE 2 SPECIFIED ALBUMS THUMBNAIL"

{Album albums='album name'}   "THIS WILL SHOW ALL OF THE SPECIFIED ALBUMS
THUMBNAILS"
      
avatar
Date: 2011-12-27 11:08
Posted By: MeiRieM   (meiriem)

I did not understand your comment until I watched the original English help. I
use a Dutch translation and there is stated that you can use {cms_module
module='Album' albums='13'}.
So, it is not really a bug.

Anyway, is it possible to use ID's in the tag instead of minimal 1 named Album?
By means of altering the query as I suggested?
      
avatar
Date: 2011-12-27 12:34
Posted By: Mark Reed (mark)

I think the other languages haven't been updated.

You can change it if you want but I can't help you if it breaks.
      
avatar
Date: 2012-10-30 18:34
Posted By: Arnd Behring (arnd)

I see that the help text states that you need to specify at least one "name",
but why exactly is this a requirement? From the code in action.default.php I
cannot deduce any reason for this restriction. (I am currently using CMSms
1.11.2.1 and Album 1.10-beta2.)

If the user only specifies numeric IDs (e.g. {Album albums='23,42'}), the code
in its current form will produce an SQL error, which is silently ignored (except
if debug mode is enabled). The album module simply displays nothing, leaving the
user clueless about what he has done wrong. The SQL statement generated in this
case reads:

SELECT distinct album_id FROM '.cms_db_prefix().'module_album_albums WHERE
album_name album_id IN (23,42)

Obviously, the WHERE clause generated by the module contains a syntax error.

The code modification suggested by MeiRieM solves this problem and allows using
just numeric IDs. I, therefore, suggest the inclusion of MeiRieM's patch into
the upstram code base.
      
Updates

Updated: 2011-12-27 12:42
resolution_id: 11 => 8
state: Open => Closed

Updated: 2011-12-27 11:08
resolution_id: => 11
severity_id: 2 => 3