Here's what I have.
- latest version of cmsms
- latest version of uploads, feu, self-regi etc.
- users and groups setup and functional
- register and login functional
Here's what I'm looking to do.
When a user logs in, they have access to 2 pages that all logged in users see (this is functional). Then, they have one page that is only for that user.
Inside of uploads, I have the groups setup and they are tied to feu. But, currently, to make this work, I have an individual page for each user with the uploads tag set to show them their files. I'd like it to be more dynamic, and less intensive from a setup standpoint. So, we have the one page that changes to their uploads group listing, based on the user who's logged in.
Any thoughts on how to set this up are most appreciated.
Thx,
Jeff T.
Uploads / FEU / Smarty - One Dynamic Page
Uploads / FEU / Smarty - One Dynamic Page
Mmmmm... Tasty.
Re: Uploads / FEU / Smarty - One Dynamic Page
I'm not sure I understand exactly what you want to achieve, but maybe this can be useful.
I previously made an UDT called feu_upload_cats which returns the list of FEU uploads categories a FEU user has access to. A slightly modified version looks like this:
This could be used in a page like this:
I previously made an UDT called feu_upload_cats which returns the list of FEU uploads categories a FEU user has access to. A slightly modified version looks like this:
Code: Select all
# UDT to return the list of FEU uploads categories a FEU user has access to, (or not).
#$params['userid']; # The numeric FEU user id.
#$params['permit']; # 1 -> return permitted categories, 0 -> return not permitted categories.
#$params['prefix'] ; # An optional prefix to add to each returned category name.
$gCms = cmsms();
$smarty =& $gCms->GetSmarty();
$db =& $gCms->GetDb();
$ug = array(); #List of groups the user belongs to.
$cg = array(); #List of groups having access to a category.
$test = array(); #The intersection of ug and cg.
$cn = array(); #List of categories the user has access to, (or not).
$permit = $params['permit']; #1 -> return permitted categories, 0 -> return not permitted categories.
#Find all groups the user belongs to.
$sql = 'SELECT groupid FROM cms_module_feusers_belongs WHERE userid="' . $params['userid'] .'";';
$dbresult =& $db->Execute($sql);
while ($dbresult && $row = $dbresult->FetchRow()) {
$ug[] = $row['groupid'];
}
#Find all category names and the list of groups having access to each category.
$sql = 'SELECT upload_category_name,upload_category_groups FROM cms_module_uploads_categories WHERE upload_category_listable="1";';
$dbresult =& $db->Execute($sql);
#For each category, match the list of groups having access with the list of groups the user belongs to.
while ($dbresult && $row = $dbresult->FetchRow()) {
$cg = split( '[,]', $row['upload_category_groups']);
$test = array_intersect( $ug, $cg);
if ( (count($test) > 0 && $permit > 0) || (count($test) == 0 && $permit == 0) ) {
$cn[] = $params['prefix'] . $row['upload_category_name'];
}
}
if ( empty($params['assign']) ) {
echo join( $cn, ','); #Return list of categories as a string.
} else {
$smarty->assign( $params['assign'], $cn); #Return list of categories as an array.
}
Code: Select all
{if $ccuser->loggedin()}
{feu_upload_cats userid=$customcontent_loggedin permit='1' assign='myArray'}
{foreach from=$myArray item=cat}
{cms_module module="Uploads" category=$cat mode="summary"}
{/foreach}
{else}
Login...
{/if}