How to show "hidden" records
            4 posts by 2 authors in: Forums > CMS Builder
Last Post: June 26, 2015   (RSS)          
By gversion - June 24, 2015
Hello,
I would like to use the in-built function "hidden" to hide listings at the front-end of my website however I would like to be able to show these "hidden" listings in the user control panel. When a user decides to set their listing live they can untick "hidden" and then the listing will be displayed. The problem currently is that I can't show the listing to the user in their control panel because it's hidden!
Is there a way I can show "hidden" listings in the user control panel but keep them hidden at the front-end?
It seems that if I try displaying listings `WHERE hidden = 1` (as shown below) then it still does not display hidden records.
list($listingsRecords, $listingsMetaData) = getRecords(array(
 'tableName' => 'listings',
 'limit' => '5',
 'loadUploads' => true,
 'allowSearch' => false,
 'where' => "hidden = 1",
 ));
If this is simply not possible then any simple suggestions for a workaround would be greatly appreciated.
Thank you,
Greg
By Damon - June 25, 2015
Hi Greg,
Can you try adding this to show hidden records:
 'ignoreHidden'            => true,
Let me know if this does it.
Thanks!
Damon Edis - interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
By gversion - June 25, 2015
Hi Damon
Thank you for your suggestion, which has worked great!
Did I miss this in the documentation?
Thanks,
Greg
By Damon - June 26, 2015
Hi Greg,
It's not in the documentation but you can see all the Viewer Options in the top of the /lib/viewer_functions.php file:
/*
  list($records, $details) = getRecords(array(
    'tableName'           => 'listings', // REQUIRED, error if not specified, tableName is prefixed with $TABLE_PREFIX
    'where'               => '',         // optional, defaults to blank
    'orderBy'             => '',         // optional, defaults to $_REQUEST['orderBy'], or table sort order
    'limit'               => '',         // optional, defaults to blank
    'offset'              => '',         // optional, defaults to blank (if set but no limit then limit is set to high number as per mysql docs)
    'perPage'             => '',         // optional, number of records to show per page
    'pageNum'             => '',         // optional, page number to display defaults to $_REQUEST['page'] or 1
    'allowSearch'         => '',         // optional, defaults to yes, adds search info from query string
    'requireSearchMatch'  => '',         // optional, don't show any results unless search keyword submitted and matched
    'requireSearchSuffix' => '',         // optional, search fields must end in a suffix such as _match or _keyword, original field=value match search is ignored
    'loadUploads'         => '',         // optional, defaults to yes, loads upload array into upload field
    'loadCreatedBy'       => '',         // optional, defaults to yes, adds createdBy. fields for created user
    'loadListDetails'     => '',         // optional, defaults to yes, adds $details with prev/next page, etc info
    'loadPseudoFields'    => false,      // optional, defaults to yes, adds additional fields for :text, :label, :values, etc
    'orWhere'             => '',         // optional, adding " OR ... " to end of where clause
    'useSeoUrls'          => false,      // optional, use SEO urls, defaults to no
    'leftJoin'      => array(        // Note: leftJoins require you to use fully qualified fieldnames in WHERE and ORDER BY, such as tablename.fieldname
      'grocery_aisle' => 'aisleNum', // foreign table => local field (that matches num in foreign table)
      'brands'        => 'brandNum',
      'otherTable'    => 'ON mainTable.foreignKey = foreignTable.num',
    ),
    'ignoreHidden'            => false,  // don't hide records with hidden flag set
    'ignorePublishDate'       => false,  // don't hide records with publishDate > now
    'ignoreRemoveDate'        => false,  // don't hide records with removeDate < now
    'includeDisabledAccounts' => true,   // include records that were created by disabled accounts.  See: Admin > Section Editors > Advanced > Disabled Accounts
    'addSelectExpr'           => 'NOW() as _currentDate',   // add expression to SELECT, useful for generating pseudo-fields or calculated values
    'groupBy'                 => '',                        // optional, defaults to blank
    'having'                  => '',                        // optional, defaults to blank
    'useCache'      => true,       // use cache - requires cache plugin
    'debugSql'      => false,      // optional, display SQL query, defaults to no
  ));
*/
Damon Edis - interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/