Page 1 of 1

how to display in admin panel news only one category?

Posted: Wed Sep 19, 2007 7:59 am
by piotr22
hi.

I created several users and they can add news.

user - editor(group) -  see and add or edit only "category1" news,
user2 - designer(group) - see and add or edit only "category2" news,
user3 - nextgroup(group) - see and add or edit only "category3" news,
user4 - editor(group) - see and add or edit only "category1" news,
...


help me please
it's very important too me
and I thinsk that different people will be very happy with solve this problem

I'm sorry for my english

Re: how to display in admin panel news only one category?

Posted: Wed Sep 19, 2007 1:00 pm
by calguy1000
News doesn't support this at this time.  If you have rights to add news articles, you have rights to add news articles to any category.

Re: how to display in admin panel news only one category?

Posted: Wed Sep 19, 2007 4:08 pm
by piotr22
ok but is anybody who can help me  change code and solve this problem.

I sugest

when we create new user we can insert his login the same like category name in news.
and we can equal this values

if login(user) is equal category(news) then user can see, edit or delete only his category articles.

maby it is solution.

what do you think about it.
where and what could I changing in php code.
I install last wersion cms 1.1.2

help me please
thx

Re: how to display in admin panel news only one category?

Posted: Fri Sep 21, 2007 11:06 am
by piotr22
help me please

I don't know where to find this code

maby somebody have similar solution

thanks

Re: how to display in admin panel news only one category?

Posted: Mon Sep 24, 2007 6:25 am
by piotr22
maby somebody told me how to find variable with login user name

I am in action.defaultadmin.php file and I would like to display login name and category (news) name.


I think,  when I find this variables I solve my problem

thank you very much

Re: how to display in admin panel news only one category?

Posted: Mon Sep 24, 2007 10:54 am
by alby
piotr22 wrote: maby somebody told me how to find variable with login user name

I am in action.defaultadmin.php file and I would like to display login name and category (news) name.


I think,  when I find this variables I solve my problem

thank you very much
Use:
$login_user_name = $_SESSION['login_user_username'];

In action.defaultadmin.php, in this array (about #110) you have the list of categories:
$categorylist[$row['long_name']] = $row['news_category_id'];


Alby

Re: how to display in admin panel news only one category?

Posted: Mon Sep 24, 2007 11:52 am
by piotr22
thank you very much alby

but when I change in action.defoultadmin.php :

  $categorylist = array();
    $query = "SELECT * FROM ".cms_db_prefix()."module_news_categories ORDER BY hierarchy";
    $dbresult = $db->Execute($query);
    $login_user_name = $_SESSION['login_user_username'];

    while ($dbresult && $row = $dbresult->FetchRow())
      {
$categorylist[$row['long_name']] = $login_user_name;
# $categorylist[$row['long_name']] = $row['news_category_id'];
      }

nothink was change and I don't know why ?

could you tell me what is wrong.

thx

Re: how to display in admin panel news only one category?

Posted: Mon Sep 24, 2007 12:19 pm
by alby
piotr22 wrote:   $categorylist = array();
    $query = "SELECT * FROM ".cms_db_prefix()."module_news_categories ORDER BY hierarchy";
    $dbresult = $db->Execute($query);
    $login_user_name = $_SESSION['login_user_username'];

    while ($dbresult && $row = $dbresult->FetchRow())
      {
$categorylist[$row['long_name']] = $login_user_name;
# $categorylist[$row['long_name']] = $row['news_category_id'];
      }

nothink was change and I don't know why ?
No, in this way  ;)
  $categorylist = array();
    $query = "SELECT * FROM ".cms_db_prefix()."module_news_categories ORDER BY hierarchy";
    $dbresult = $db->Execute($query);
    $login_user_name = $_SESSION['login_user_username'];

    while ($dbresult && $row = $dbresult->FetchRow())
      {
if ($row['long_name'] != $login_user_name) continue;
$categorylist[$row['long_name']] = $row['news_category_id'];
      }
Alby

Re: how to display in admin panel news only one category?

Posted: Mon Sep 24, 2007 12:57 pm
by piotr22
sorry it's me again ???

I'm so iritate this problem.
still somethink is wrong.

the worst is that I can't nothink to change, nothing to display in news admin panel

could you send me code with this changes.
please

thx

Re: how to display in admin panel news only one category?

Posted: Mon Sep 24, 2007 4:26 pm
by alby
piotr22 wrote: sorry it's me again ???

I'm so iritate this problem.
still somethink is wrong.

the worst is that I can't nothink to change, nothing to display in news admin panel

could you send me code with this changes.
please
Tested 1.1.2  8)
admin user: modify ALL in News, user: articles in category with your login name only

Backup your News folder.
Download attach files.
Rename to php and overwrite your files in folder News.

Exercise: hack action.addarticle.php and action.editarticle.php (for view category with your login name only)!

Alby

Re: how to display in admin panel news only one category?

Posted: Tue Sep 25, 2007 9:07 am
by piotr22
ALBY  thank you very very much :)
I'm testing now, but I think that news work fine.

but when I try to add new news I see all category in category field
ti is possible to change code and display only one category in category field (the same category like user login)


thx

Re: how to display in admin panel news only one category?

Posted: Tue Sep 25, 2007 12:03 pm
by alby
piotr22 wrote: but when I try to add new news I see all category in category field
ti is possible to change code and display only one category in category field (the same category like user login)
alby wrote: Exercise: hack action.addarticle.php and action.editarticle.php (for view category with your login name only)!
add new and modify this article :)

Alby

Re: how to display in admin panel news only one category?

Posted: Tue Sep 25, 2007 12:56 pm
by piotr22
ups  :D  sorry  my fault

thx