Restrict records shown to those in a specific group

5 posts by 2 authors in: Forums > CMS Builder
Last Post: March 17, 2011   (RSS)

Re: [gkornbluth] Restrict records shown to those in a specific group

By Jason - March 17, 2011

Hi Jerry,

I think the issue here is that you're not pulling out the correct exhibition record. There is nothing in your query that would pull out a record based on the number in the url. And since the number in the url has no variable name, the search won't happen automatically. That is why you're probably getting the videos associated with the last exhibition record created. Try changing your link to this:

<a href='<a href='videos.php?num=<?php echo $exhibitionsRecord['num'] ?>'>WATCH THE VIDEO FROM THIS EXHIBITION</a>

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Restrict records shown to those in a specific group

By gkornbluth - March 17, 2011 - edited: March 17, 2011

Thanks Jason.

Still almost there

The correct videos now show on the video list page, but when any other record then #1 is accessed, I get a

"Warning: Invalid argument supplied for foreach() in /hsphere/local/home/c323748/margiekelk.com/videos.php on line 96" error, instead of the page masthead image which is pulled from the single record common_information editor,

and I lose all but one of the navigation links pulled from the multi record navigation editor.

The link is http://50.6.159.105/exhibitions.php (click on an exhibition and then click on the video link.)

Thanks,

Jerry

Here's the actual get records code I'm using on the videos list page:<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php


// load viewer library
$libraryPath = 'cmsAdmin/lib/viewer_functions.php';
$dirsToCheck = array('/hsphere/local/home/c323748/margiekelk.com/','','../','../../','../../../');
foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }

// load records
list($common_informationRecords, $common_informationMetaData) = getRecords(array(
'tableName' => 'common_information',

'limit' => '1',
));
$common_informationRecord = @$common_informationRecords[0]; // get first record

// load records
list($exhibitionsRecords, $exhibitionsMetaData) = getRecords(array(
'tableName' => 'exhibitions',
));
$exhibitionsRecord = @$exhibitionsRecords[0]; // get first record
$escapedExhibitionName = mysql_real_escape_string( $exhibitionsRecord['exhibition_name'] );


// load records
list($videosRecords, $videosMetaData) = getRecords(array(
'tableName' => 'videos',
'allowSearch' => '0',
'where' => " exhibition_name = '$escapedExhibitionName' ",
));

// load records
list($navigationRecords, $navigationMetaData) = getRecords(array(
'tableName' => 'navigation',
));

?>

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [gkornbluth] Restrict records shown to those in a specific group

By Jason - March 17, 2011

Hi Jerry,

I'm not able to see that line, but based on the code I can see, I would guess that it your query getting your navigation list is being affected by the search. All we need to do here is turn off the search:

// load records
list($navigationRecords, $navigationMetaData) = getRecords(array(
'tableName' => 'navigation',
'allowSearch' => false,
));


Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Restrict records shown to those in a specific group

Wow...

It's so good that you're soooo good at this.

Thanks,

Jerry
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php