Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-11-12 06:24:50

jamiew
Archived Plugin Author
From: NYC
Registered: 2005-01-08
Posts: 74
Website

Hack: only list your own articles/images/files

I’ve fleshed out patches for an admin.list privilege that allows some user roles to only see their own articles, images, and files — super handy for multiuser sites. Originally developed by Jakob_R and discussed here. I submitted it for inclusion in core but never heard anything back, so I’m publishing it here. I use this on literally every one of my TXP installs and figured you guys might find it handy too.

Note: this is not a plugin. Modifications to your TXP core ensue.

> Download link

  1. Drop the _to_4.0.5.php in /textpattern/update (to add an ‘author’ column to txp_file… this will become outdated with future versions obviously!)
  2. Patch your install: patch -p0 -i admin-list-perms-sql.patch; patch -p0 -i admin-list-perms.patch
  3. Your admin page should throw up the “update language” screen meaning the DB has been migrated. Hooray!
  4. I believe the admin.list priv can be edited in the txp_privs table, or else it’s in lib/admin_config.php

Last edited by jamiew (2006-11-12 06:27:13)

Offline

#2 2006-11-12 18:31:45

hcgtv
Archived Plugin Author
From: Key Largo, Florida
Registered: 2005-11-29
Posts: 2,722
Website

Re: Hack: only list your own articles/images/files

This is awesome Jamie!!

I have a site I can use this on right away, had been waiting for something like this to implement multiblog functionality. I’ll install it locally and let you know how it goes.

I imagine this patch is against 4.0.4 and not what’s in SVN (r2078)?

Offline

#3 2006-11-12 18:35:57

jamiew
Archived Plugin Author
From: NYC
Registered: 2005-01-08
Posts: 74
Website

Re: Hack: only list your own articles/images/files

Patched against rev. 1991, which is very close to what became 4.0.4. I havn’t had any probs patching any kind of “recent” installs

Offline

#4 2006-11-12 18:47:02

hcgtv
Archived Plugin Author
From: Key Largo, Florida
Registered: 2005-11-29
Posts: 2,722
Website

Re: Hack: only list your own articles/images/files

The site in question is running Textpattern version: 4.0.4 (r1956), I’ll load it up on my local test server and apply the patches.

It’s a shame that this patch never made it into the core for 4.0.4, could of been a big selling point. Just to add, I had submitted a similar request to Team Textpattern, something very simple like what your patch does but we never came to any solid decision.

Offline

#5 2006-11-12 19:42:01

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,367
Website GitHub Mastodon Twitter

Re: Hack: only list your own articles/images/files

I’m with you bert
especially regarding the patch for images


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#6 2006-11-12 20:57:19

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,181
Website GitHub

Re: Hack: only list your own articles/images/files

thanks jamie for bringing it up to date. I’d submitted it too but…
I’m also using it for a mini multi-blog situation.

EDIT: jamie, is this the same as my original admin.list permissions patch plus the file authors or have you gone the whole hog since and added image.edit, image.edit.own, image.delete and corresponding file permissions?

Last edited by jakob (2006-11-12 22:28:02)


TXP Builders – finely-crafted code, design and txp

Offline

#7 2006-11-13 00:24:06

jamiew
Archived Plugin Author
From: NYC
Registered: 2005-01-08
Posts: 74
Website

Re: Hack: only list your own articles/images/files

Just admin.list for now, since I didn’t have a pressing need for the others. Until there’s some interest from core about including this stuff I’m also a little hesistant to make the patches even bigger. :(

I’m putting the finishing touches on a plugin (and a small patch) to easily edit the permissions table and move the currently hard-coded stuff in admin_config.php to the DB (finally!)

There’s been lots of talk of overhauling the perms system elsewhere that hasn’t really led to much. I’m all for just introducing incremental changes like this, figuring it out as we go along. Don’t want to muck things too much, though. Please criticize, propose ideas, publish risky patches, etc!

Offline

#8 2006-11-22 10:43:33

jayrope
Plugin Author
From: Berlin
Registered: 2006-07-06
Posts: 721
Website Mastodon

Re: Hack: only list your own articles/images/files

oh jamie. what a great idea. i hesitate installing it now, since i only have a live site to test (4.0.4 release) – should i just… go for it?

on another notre it’ll be awesome to be able to configure new users, who’d be able to write only for specified sections (like from a section drop down menu with multiple select when configuring new user).

Last edited by jayrope (2006-11-22 10:45:36)


A hole turned upside down is a dome, when there’s also gravity.

Offline

#9 2007-07-18 16:46:44

danwoodward
Member
From: Brooklyn NY
Registered: 2006-08-06
Posts: 51
Website

Re: Hack: only list your own articles/images/files

Hi, I’d like to use this feature but will it work in 4.0.5?

Offline

#10 2007-07-18 20:23:39

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,675
GitHub Twitter

Re: Hack: only list your own articles/images/files

Jamiew.

What a very clever hack. Works fine with 4.0.5 (manual update).

Do you think it will be possible to show only article’s comments authors?

Regard,


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#11 2007-07-18 20:38:24

danwoodward
Member
From: Brooklyn NY
Registered: 2006-08-06
Posts: 51
Website

Re: Hack: only list your own articles/images/files

Could someone clue me into how I actually install the patch, specifically where I use this line of code
patch -p0 -i admin-list-perms-sql.patch; patch -p0 -i admin-list-perms.patch

Thanks in advance for any helpful hints.

Offline

#12 2007-07-19 12:13:53

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,675
GitHub Twitter

Re: Hack: only list your own articles/images/files

Some advices :

Have to run this command line on Linux (perhaps on XP, not tested) and run this line on the root of the site (put the 2 sql files on the root) ; and in 2 parts (each patch separatly).

Or, look at the 2 sql files and make your change manualy : you have a flag for the position with this couple line and column :

@@ 20,7 @@

(line 20 and column 7)

Easier on a TXP 4.0.4 version ; after use the example to make the changes manualy on a TXP 4.0.5.


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#13 2007-08-05 05:52:44

danwoodward
Member
From: Brooklyn NY
Registered: 2006-08-06
Posts: 51
Website

Re: Hack: only list your own articles/images/files

Hey Pat, Thanks for the tips, I think I have it running fine on 4.0.5, changes were made manually without too much pain.
I do however have one issue, not sure if its a result of this or something else. When I click on the help (?) button next to elements like “keywords” the help popup box appears with the appropriate help info, then at the bottom of that window this code is displayed.

any ideas?

$title"; $result = preg_replace("/>\s* <",stripslashes($html)); $result = strip_tags($html); if (preg_match_all("/\s.{0,50}".$query.".{0,50}\s/i",$result,$concat) >= 1) { $concat = implode(" ... ",$concat[0]); $concat = preg_replace("/($query)/i","$1",$concat); $output = " $h3

$concat
"; print $output; } } ?>

Offline

#14 2007-08-05 06:36:21

iblastoff
Plugin Author
From: Toronto
Registered: 2006-06-11
Posts: 1,197
Website

Re: Hack: only list your own articles/images/files

i believe there are issues with the rpc server right now. i get the same code being spat out on a non-modified txp install

Offline

#15 2007-09-20 03:12:18

fbox
Member
From: Melbourne
Registered: 2006-02-18
Posts: 42

Re: Hack: only list your own articles/images/files

Thanks Jamie – just achieved a safe mod on 4.0.5 r.2466 using manual update like Pat64 (predictably, several failed hunks if you try auto patching). Some tiny confusions due to different line numbers and some patches already being included in the file code but generally pretty straightforward, and now seemingly working fine. Encouraging for those who might be low on confidence but are wanting to give it a go. =)

Luvly.

– L.

Offline

Board footer

Powered by FluxBB