Features / Usability

Features / Usability

Limit Article Editing to Owner and Admin

posts: 37


I'm assigning each of my students a single article to complete a project write up. I'd like to create the article as an admin, then reassign the owner to the indi. student.
The problem I'm facing is I can seem to set the edit on or off. Either a student can edit everyone's article or no articles at all.

I'm pretty sure this might require a template change (I'm guessing the tiki-read_article one), stating the edit button works when the options is checked && the person logged in matches the article owner.


posts: 758 United States

Hello Jennifer,
I am just throwing this out there as a possibility, I am not sure if it would work though but it's worth a try.
You could create a group for each student, create the article, and in the articles individual permission set, assign editing capabilities to that group (student) only.
I have not tried it, but I can give it a try this weekend when I get a couple hours and report back here for you.

posts: 3665 United States

I'm not sure this is how the owner field works in Articles (but I could be wrong). I think you'll need to use category/group permissions, similar to what John mentions. That will definately work.

If you prefer to hard-code a customization, you'll need to edit the article.tpl template file. Look around line 28... in this line:

Copy to clipboard
{if $tiki_p_edit_article eq 'y'}....

You'll need to add a check for the article's owner, such as:

Copy to clipboard
{if ($tiki_p_edit_article eq 'y') and ($user eq $author)}....


- Rick | My Tiki Blog | My Tiki UserPage

Why be a dummy? Get smarty! TikiForSmarties.com
Tiki for Smarties, your source for the best (and only) Tiki books, guides, and tutorials.
posts: 37

Perfect, thank you. The idea of making 20+ groups every semester was silly (no offense John! You idea would have worked if I only had one or two to do).

To be specific with what I did:

  1. The edit action is is article_trailer.tpl, not article.tpl (for anyone else who looks to do this)
  2. In order to keep edit rights for the admin as well as the student, I added a new if statement at line 28 : {if $user eq $author} ,
  3. and and elseif at line 86, {elseif $user eq admin} (or whatever the admin username actually is), the copied all of the lines in between and pasted them again, since the admin rights and the user rights will pass different tests, then finishing with
  4. an else statement and a closing if before the closing div tags (3): {else}{tr}No Available Actions{/tr} {/if}

I've attached a .txt of what I have . It seems to work. I can assign an article to the username of my instructor account, can edit from there, can edit with my admin account, but cannot edit with my test student user account.

posts: 2428 Czech Republic

but I can see a little issue with that: since the field is just plain text editable field to put any author name one needs to be careful to write the username correctly with no typos otherwise it will not match. Also if the student accidentally changes it, they will loose access to editing the article after saving...

Just my 2 c ;)


posts: 37

Absolutely true. I made that mistake with my test account. But when you assign the author and type the first letter of the student's name (I assigned all my students with a firstname.lastname account), tiki will (at least in mine) try to populate the field with a student name with that letter. I let it look up the values and click the suggestion to complete to assure a perfect fit.

As for losing edit access, I've marked the box that disallows a non-admin from re-assigning the article to another. And since I have overall write access, I can help them out with things they are confused about or have "messed up"