UPDATED: news: set permission for user by category
Posted: Tue Oct 02, 2007 5:38 pm
NOTE:
I want to test this but am not sure what variable to use for USER in my list below. Is it $user_group == 'name of group'?
NOTE THE SECOND:
I did figure out the group variable: it's $group
I am running into a syntax problem with the if statement: anyone have any help? What syntax should I use? look below the original message to see what my code is like.
-----
Hi all,
I know this isn't inside the news module.
But I think it'd be easy to modify it in the following way:
I want to set a line of code in the TEMPLATE file of the ADMIN--this line says, "{if user == x}css style to hide the category that they aren't allowed to see{endif}
Meanwhile each category has it's own CSS stlye (which I hard-code in the template)
Does this make sense? I think it does. I think it will work.
Please let me know if I'm reinventing the wheel & this already exists (and I'm just not finding it) or if there is a better way. I'll be doing the same thing with CALENDAR.
Thanks,
David
----
WHERE I AM AT:
//Load the current articles
if ( $group != admin )
{
$entryarray = array();
$dbresult = '';
$query1 = "SELECT n.*, nc.long_name FROM ".cms_db_prefix()."module_news n LEFT OUTER JOIN ".cms_db_prefix()."module_news_categories nc ON n.news_category_id = nc.news_category_id ";
$query2 = "SELECT count(n.news_id) AS count FROM ".cms_db_prefix()."module_news n LEFT OUTER JOIN ".cms_db_prefix()."module_news_categories nc ON n.news_category_id = nc.news_category_id ";
$parms = array()
if ($curcategory != '')
{
$query1 .= " WHERE nc.long_name LIKE ?";
$query2 .= " WHERE nc.long_name LIKE ?";
if( $allcategories == 'yes' )
{
$parms[] = $curcategory.'%';
}
else
{
$parms[] = $curcategory;
}
}
$query1 .= ' ORDER by '.$sortby;
$query1 .= " LIMIT $startelement,$pagelimit";
this is my code right now
see it says if you aren't admin, then it does the standard article spit-out
I want to set several: one for each group that I have--that spits out only the category which is appropriate.
I feel close but need a little help. Please get back to me!
I want to test this but am not sure what variable to use for USER in my list below. Is it $user_group == 'name of group'?
NOTE THE SECOND:
I did figure out the group variable: it's $group
I am running into a syntax problem with the if statement: anyone have any help? What syntax should I use? look below the original message to see what my code is like.
-----
Hi all,
I know this isn't inside the news module.
But I think it'd be easy to modify it in the following way:
I want to set a line of code in the TEMPLATE file of the ADMIN--this line says, "{if user == x}css style to hide the category that they aren't allowed to see{endif}
Meanwhile each category has it's own CSS stlye (which I hard-code in the template)
Does this make sense? I think it does. I think it will work.
Please let me know if I'm reinventing the wheel & this already exists (and I'm just not finding it) or if there is a better way. I'll be doing the same thing with CALENDAR.
Thanks,
David
----
WHERE I AM AT:
//Load the current articles
if ( $group != admin )
{
$entryarray = array();
$dbresult = '';
$query1 = "SELECT n.*, nc.long_name FROM ".cms_db_prefix()."module_news n LEFT OUTER JOIN ".cms_db_prefix()."module_news_categories nc ON n.news_category_id = nc.news_category_id ";
$query2 = "SELECT count(n.news_id) AS count FROM ".cms_db_prefix()."module_news n LEFT OUTER JOIN ".cms_db_prefix()."module_news_categories nc ON n.news_category_id = nc.news_category_id ";
$parms = array()
if ($curcategory != '')
{
$query1 .= " WHERE nc.long_name LIKE ?";
$query2 .= " WHERE nc.long_name LIKE ?";
if( $allcategories == 'yes' )
{
$parms[] = $curcategory.'%';
}
else
{
$parms[] = $curcategory;
}
}
$query1 .= ' ORDER by '.$sortby;
$query1 .= " LIMIT $startelement,$pagelimit";
this is my code right now
see it says if you aren't admin, then it does the standard article spit-out
I want to set several: one for each group that I have--that spits out only the category which is appropriate.
I feel close but need a little help. Please get back to me!