Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2018-03-15 18:00:33

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,293
Website GitHub

Re: Privatize content per user

FWIW, 4.8 custom fields have a family that is an arbitrary (freeform) grouping field. Core doesn’t use it, but the implication is that plugins can use this field to slice, dice and filter your CFs any way you like.

For example, a plugin might allow you to assign fields to particular areas of a panel (by using, e.g. body, sort-and-display, RealName, etc) to attach them to the (article) Body and (article) Sort & Display and (user) RealName blocks, respectively. Along with the ordinal (position – when I can get it working) this could define where custom fields appear throughout the UI.

Another plugin might use them to do per-section-fields.

Nothing to stop another plugin using the field to represent ‘private’ fields and doing something different with them, as etc suggests in custom public tags, on the admin side, or both.

Point is, the use of this CF property is at the discretion of the plugin author to use their imagination, so all manner of cool implementations might arise from it. #EverythingIsGoingToBeAlright


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#14 2018-03-15 19:41:32

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

Re: Privatize content per user

etc wrote #309962:

How all this protects from including

<txp:article_custom id="[restricted article id]">...

in another article?

@etc, you are cunning ;-)

Not a general solution for the larger problem, but in this particular situation couldn’t you disallow users to use txp:tags in articles in Admin › Preferences?


TXP Builders – finely-crafted code, design and txp

Offline

#15 2018-03-15 20:22:50

etc
Developer
Registered: 2010-11-11
Posts: 5,080
Website GitHub

Re: Privatize content per user

That’s what I meant. This basic plugin will register two “private” custom fields “Privacy” (custom_9) and “Phone” (custom_10) that will be inaccessible via <txp:custom_field /> on the public side. On the admin side, they will only be visible for the users listed in “Privacy” field (if set), plus the article author.

Important: Custom field 9 name and Custom field 10 name must be empty in Admin/Preferences/Custom fields. Edit the plugin code if you prefer to use other fields/names.

Tested very quickly, hence no guaranty applies.

# Name: etc_private_fields v0.1 
# Type: Admin/AJAX plugin
# 
# Author: 
# URL: 
# Recommended load order: 5

# .....................................................................
# This is a plugin for Textpattern CMS - http://textpattern.com/
# To install: textpattern > admin > plugins
# Paste the following text into the 'Install plugin' box:
# .....................................................................

YToxMTp7czo0OiJuYW1lIjtzOjE4OiJldGNfcHJpdmF0ZV9maWVsZHMiO3M6NjoiYXV0aG9y
IjtzOjA6IiI7czoxMDoiYXV0aG9yX3VyaSI7czowOiIiO3M6NzoidmVyc2lvbiI7czozOiIw
LjEiO3M6MTE6ImRlc2NyaXB0aW9uIjtzOjA6IiI7czo0OiJjb2RlIjtzOjQ1MToicmVnaXN0
ZXJfY2FsbGJhY2soJ2V0Y19wcml2YXRlJywnYXJ0aWNsZScsIGZhbHNlLCAxKTsNCg0KZnVu
Y3Rpb24gZXRjX3ByaXZhdGUoJGV2ZW50LCAkc3RlcCkNCnsNCglnbG9iYWwgJHR4cF91c2Vy
Ow0KDQoJaWYgKCRpZCA9IGludHZhbChncHMoJ0lEJykpKSB7DQoJCSRkYXRhID0gc2FmZV9y
b3coJ0F1dGhvcklELCBjdXN0b21fOScsICd0ZXh0cGF0dGVybicsICJJRD0kaWQiKTsNCg0K
CQlpZiAoIWVtcHR5KCRkYXRhWydjdXN0b21fOSddKSAmJiAkdHhwX3VzZXIgIT09ICRkYXRh
WydBdXRob3JJRCddICYmICFpbl9saXN0KCR0eHBfdXNlciwgJGRhdGFbJ2N1c3RvbV85J10p
KSB7DQoJCQlyZXR1cm47DQoJCX0NCgl9DQoNCglnbG9iYWwgJHByZWZzOw0KCSRwcmVmc1sn
Y3VzdG9tXzlfc2V0J10gPSAnUHJpdmFjeSc7DQoJJHByZWZzWydjdXN0b21fMTBfc2V0J10g
PSAnUGhvbmUnOw0KfSI7czo0OiJ0eXBlIjtzOjE6IjQiO3M6NToib3JkZXIiO3M6MToiNSI7
czo1OiJmbGFncyI7czoxOiIwIjtzOjQ6ImhlbHAiO2I6MDtzOjM6Im1kNSI7czozMjoiMDVh
ODk5MDExOTlhOTE5NjE3ZmFhOGRiNTYwYzFmMmQiO30=

Offline

#16 2018-03-15 20:25:58

etc
Developer
Registered: 2010-11-11
Posts: 5,080
Website GitHub

Re: Privatize content per user

jakob wrote #309971:

Not a general solution for the larger problem, but in this particular situation couldn’t you disallow users to use txp:tags in articles in Admin › Preferences?

Not that I know, only <txp:php /> is configurable. Could be an option in some future version.

Offline

#17 2018-03-15 23:30:46

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,293
Website GitHub

Re: Privatize content per user

etc wrote #309973:

etc_private_fields v0.1…

Damn, that’s clever.

I wonder if we could formalise something like this in core’s custom fields implementation for 4.8.0?


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#18 2018-03-16 09:10:58

etc
Developer
Registered: 2010-11-11
Posts: 5,080
Website GitHub

Re: Privatize content per user

Bloke wrote #309978:

I wonder if we could formalise something like this in core’s custom fields implementation for 4.8.0?

The hiding mechanism is elementary, but I’m not sure we can easily formalize all possible criteria.

Offline

#19 2018-03-16 18:38:02

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

Re: Privatize content per user

etc wrote #309973:

Tested very quickly, hence no guaranty applies.

etc, impressive.

Few caveats: With your plug i can allow/disallow users to certain custom field content on a per-article base, no?
That’s nice, if there is very few articles only to be treated and individually treated.

What, if – version #2 – i want to broadly allow certain custom fields to certain users instead? I guess this would require an author-specific admin panel, where i as an author could mark certain custom fields for privacy sensitive content and then allow access to them on a per-author base.

So i would have a list of custom fields, each associated with different authors, for myself, my own needs. If another author would want to treat their privacy settings differently, then they should be able to.

Last edited by jayrope (2018-03-16 18:39:55)


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

Offline

#20 2018-03-16 19:20:16

etc
Developer
Registered: 2010-11-11
Posts: 5,080
Website GitHub

Re: Privatize content per user

@jayrope then I would say create a hidden “template” article, fill the fields you need and duplicate it every time you write a new article. Hope we’ll find something less hacky in 4.8.

Offline

#21 2018-03-16 22:14:48

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: Privatize content per user

I’ve got something (adi_minimalism) that might help. In one of those strange Textpattern coincidences I mentioned it here

You set it up via an admin tag on a per user or private basis.

It’s all smoke & mirrors though – I’m simply “displaying none” admin fields.

It’s a bit rough & ready but helped me at the time. Unfortunately can’t differentiate between different glz_custom_fields. Haven’t tested on 4.6 or 4.7 either … caveats, caveats!

Offline

#22 2018-03-16 22:35:32

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

Re: Privatize content per user

gomedia wrote #310041:

I’ve got something … Unfortunately can’t differentiate between different glz_custom_fields. Haven’t tested on 4.6 or 4.7 either … caveats, caveats!

Ai! Unfortunately i use glz_cf on 4.6.2 … Thanx!

Last edited by jayrope (2018-03-16 22:35:44)


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

Offline

#23 2018-03-16 22:42:09

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

Re: Privatize content per user

etc wrote #309987:

The hiding mechanism is elementary, but I’m not sure we can easily formalize all possible criteria.

note: for 4.8.
Is there a release roadmap, also for 4.7? Wrong thread i know, but it’s good news, that it is possible!

If glz_cf gets updated for 4.7, eventually it is more simple to incorporate this into the plugin instead of the core.
If the plugin had two more entry sections in the database,
essentially marking first, if a certain CF is generally private or not, clickable by a tick next to the custom field in the write form,
and then extends to a per-author panel in admin allowing individual authors to provide access to individual other users, then most is accomplished already.


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

Offline

#24 2018-03-16 22:44:13

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

Re: Privatize content per user

etc wrote #310031:

@jayrope then I would say create a hidden “template” article, fill the fields you need and duplicate it every time you write a new article. Hope we’ll find something less hacky in 4.8.

etc, i suppose that wouldn’t work long. It smells like too many double entries for the same content in the database all too soon – here on a multi-user site basically sharing content of partly mutual artist or business or press connections.

Last edited by jayrope (2018-03-16 22:45:18)


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

Offline

Board footer

Powered by FluxBB