how to display in admin panel news only one category?

Do something cool with CMS? Show us ...
This board is for 'Answers', and the discussion of answers... Not for questions.
Locked
piotr22
Forum Members
Forum Members
Posts: 53
Joined: Wed Nov 29, 2006 6:58 am

how to display in admin panel news only one category?

Post 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
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

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

Post 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.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
piotr22
Forum Members
Forum Members
Posts: 53
Joined: Wed Nov 29, 2006 6:58 am

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

Post 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
piotr22
Forum Members
Forum Members
Posts: 53
Joined: Wed Nov 29, 2006 6:58 am

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

Post by piotr22 »

help me please

I don't know where to find this code

maby somebody have similar solution

thanks
piotr22
Forum Members
Forum Members
Posts: 53
Joined: Wed Nov 29, 2006 6:58 am

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

Post 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
alby

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

Post 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
Last edited by alby on Mon Sep 24, 2007 10:56 am, edited 1 time in total.
piotr22
Forum Members
Forum Members
Posts: 53
Joined: Wed Nov 29, 2006 6:58 am

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

Post 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
alby

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

Post 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
piotr22
Forum Members
Forum Members
Posts: 53
Joined: Wed Nov 29, 2006 6:58 am

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

Post 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
alby

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

Post 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
Attachments

[The extension mpg has been deactivated and can no longer be displayed.]

[The extension mpg has been deactivated and can no longer be displayed.]

piotr22
Forum Members
Forum Members
Posts: 53
Joined: Wed Nov 29, 2006 6:58 am

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

Post 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
alby

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

Post 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
piotr22
Forum Members
Forum Members
Posts: 53
Joined: Wed Nov 29, 2006 6:58 am

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

Post by piotr22 »

ups  :D  sorry  my fault

thx
Locked

Return to “Tips and Tricks”