Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-06-12 13:34:35

creed_nmd
New Member
From: Nottingham, UK
Registered: 2005-10-16
Posts: 4
Website

Only show author's own articles in admin section

Is it possible to only show an author’s own articles under the articles tab in the admin area?

If so, how do you do it?

I have a site I’m working on where I’m a full ‘Publisher’ and have access to all articles, whereas the client is a ‘Staff Writer’, and should only have those articles listed that they can edit, to avoid confusion.

Thoughts?

TIA

Last edited by creed_nmd (2006-06-12 13:35:59)


Andy Warwick
Creed New Media Ltd.

Offline

#2 2006-06-12 15:30:15

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

Re: Only show author's own articles in admin section

Andy,

Sorry, I don’t know how to force TXP to do that automatically other than a hack or a plugin. But you can craft a url like this to do what you’re after: http://*your-site-here*/textpattern/index.php?event=list&method=author&crit=*author-id-here*

Last edited by net-carver (2006-06-12 15:31:09)


Steve

Offline

#3 2006-06-12 15:44:57

creed_nmd
New Member
From: Nottingham, UK
Registered: 2005-10-16
Posts: 4
Website

Re: Only show author's own articles in admin section

Steve,

That certainly works, thanks, but quickly breaks as the user moves between tabs.

If there isn’t any other, easy way, I could always edit the default link for the article tab to do that, passing in the currently logged in user.

Is that the sort of thing a plug-in could do, or changing core code like that beyond their scope?

(Just getting used to Textpattern, having only used it on this one site so far…)

/eek :)

Cheers


Andy Warwick
Creed New Media Ltd.

Offline

#4 2006-06-12 16:01:42

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

Re: Only show author's own articles in admin section

Andy,

like I said, sorry I can’t really help out on this one other than a few pointers. Hopefully one of the core dev team will pick up on this. You could try posting in the troubleshooting forum to get more visibility. (Forget that, Senser often replies to this forum!)

If there isn’t any other, easy way, I could always edit the default link for the article tab to do that, passing in the currently logged in user.

That’s the way I’d go (gut instinct, sometimes wrong!)

Is that the sort of thing a plug-in could do, or changing core code like that beyond their scope?

I think a plugin could do it by modifying the DOM after it’s been output by the core. A hack is probably quicker, if potentially less portable over versions.

Last edited by net-carver (2006-06-12 16:04:05)


Steve

Offline

#5 2006-06-12 16:51:34

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,856
Website GitHub

Re: Only show author's own articles in admin section

I’d be interested in a solution to this too and have asked about it before. I imagine it would have to be altered in the core. Would not modifying the DOM afterwards mean that posts from other authors get transmitted too (and then you could look up the links in the source)?

Also if it’s only a modified link, would this affect all users, i.e. also the main admin? Could a potentially wily author also manually change the link and show the other author’s entries?

It would also be good if files and images could be filtered by author too, particularly as I believe it is still possible to delete other author’s images. AFAIremember, files are not yet attached to authors either.


TXP Builders – finely-crafted code, design and txp

Offline

#6 2006-06-12 18:46:22

creed_nmd
New Member
From: Nottingham, UK
Registered: 2005-10-16
Posts: 4
Website

Re: Only show author's own articles in admin section

I’d be interested in a solution to this too and have asked about it before. I imagine it would have to be altered in the core.

I would certainly imagine so; problem is I’m v. new to Textpattern, so doing that scares the heck out of me, as well as being unsure of where to start.

Would not modifying the DOM afterwards mean that posts from other authors get transmitted too (and then you could look up the links in the source)?

Not sure what you mean by that.

Also if it’s only a modified link, would this affect all users, i.e. also the main admin? Could a potentially wily author also manually change the link and show the other author’s entries?

Without a doubt, but the goal is to cut down on the user’s confusion from seeing all the articles, rather than any security issues per se. It’s nothing more than pre-filtering like Steve pointed out, but doing so auto-magically rather than manually. It’s not like anyone who has access to the admin area is un-trusted in this instance.

It would also be good if files and images could be filtered by author too, particularly as I believe it is still possible to delete other author’s images. AFAIremember, files are not yet attached to authors either.

A full solution would want to do that I agree, but that’s a little overkill in my particular instance; and, as you point out, I’m not sure files are attached to authors.

If I (or anyone else) can figure out where to hack it in this instance that would do, short of a full plug-in to do it properly.

Last edited by creed_nmd (2006-06-12 18:47:07)


Andy Warwick
Creed New Media Ltd.

Offline

#7 2006-06-12 23:15:16

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: Only show author's own articles in admin section

Hopefully one of the core dev team will pick up on this.

Rights and Permissions Workgroup

Offline

#8 2006-06-12 23:24:53

creed_nmd
New Member
From: Nottingham, UK
Registered: 2005-10-16
Posts: 4
Website

Re: Only show author's own articles in admin section

Jakob/Steve

The hack I’ve ended up using is adding the following code between lines 54-56 of ‘textpattern/include/txp_list.php’ (line above and below shown for reference):

<code>
if ($dir == “desc”) { $linkdir = “asc”; } else { $linkdir = “desc”; }
// Start added code; pre-filter article list to currently logged in user if no other filter
global $txp_user;
if (!$crit AND !$method) {
$crit = $txp_user;
$method = ‘author’;
}
// End added code
if ($crit) {
</code>

<br />

Seems to do the trick, if not exactly easy to cope with for future updates :)

Cheers


Andy Warwick
Creed New Media Ltd.

Offline

#9 2006-06-13 00:28:56

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

Re: Only show author's own articles in admin section

Mary
Thanks for the pointer.

Andy
Glad you got that sorted out.


Steve

Offline

#10 2006-07-08 17:30:49

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,856
Website GitHub

Re: Only show author's own articles in admin section

another option is described here


TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB