Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2024-12-06 10:42:42

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

Plugin to change author on write tab

Does anyone know of an already existing plugin that does this?

There was ajw_admin_workflow but I can’t find a copy of it and the author’s page (or at least the plugins part) is excluded from the waybackmachine. Does anyone have that knocking around on a hard disk somewhere?

EDIT: Found it, but see instead the replacement plugin below

I don’t need the send mail functionality, just the ability to set an alternative author when I am editing a client site. Presently I save as draft, then change the author in the list view, then go back to the article to set it live. Often I forget and then I appear as an author on their site.


TXP Builders – finely-crafted code, design and txp

Offline

#2 2024-12-06 10:50:13

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

Re: Plugin to change author on write tab

We might have it in the plugins backup we were given ages ago. I’m not at my machine right now. If nobody else has a chance to skim through the plugin textplosion before I do, I’ll have a look for you later.


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

Online

#3 2024-12-06 12:13:06

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

Re: Plugin to change author on write tab

I didn’t find it in that archive but I found a copy of it in an old safety sql dump I took of a site prior to upgrading from txp 4.0.8 and was able to extract its parts from the db. It requires some edits to hook into DOM nodes in the current UI but works in principle.

That said, it uses its own js to insert the fields and effect the change and I imagine one can do this better now with pluggable_ui and perhaps also txp’s built-in async, which probably didn’t exist when the plugin was written. It shows a transfer-to dropdown, so in a two-author setup you see the other user’s name in the dropdown, not the article owner’s. I just imagined having a user-dropdown much like the category and section dropdowns, that shows whatever the current owner is.


TXP Builders – finely-crafted code, design and txp

Offline

#4 2024-12-06 13:53:03

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

Re: Plugin to change author on write tab

That sounds much easier to do now with pluggable_ui, you’re right. Hardly any need for the JavaScript shenanigans, although the user may be hard coded on save so I’m not sure how successful it will be to just add an author drop-down widget and hope it is sent along for the ride.

Didn’t gocom have a plugin that altered the Write workflow. Rah_wrach was it? Anything you can steal from that plugin that might help? Maybe a pre-write screen that allows you to pick the author before you start editing.


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

Online

#5 2024-12-08 17:45:17

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

Re: Plugin to change author on write tab

Okay, I gave this a whirl and made a very simple plugin that adds an “Author” region with a corresponding select dropdown to the Write tab’s sidebar beneath the “Sort and Display” block. Use it to set the author just like you would a section or a category.

Note: It only shows if your site has more than one author.

jcr_writetab_author – GitHub Repo
jcr_writetab_author – txt installer file


TXP Builders – finely-crafted code, design and txp

Offline

#6 2024-12-08 18:26:06

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

Re: Plugin to change author on write tab

A very handy one, thanks Julian! But it really should require admin.list and article.php privileges.

Offline

#7 2024-12-08 21:53:46

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

Re: Plugin to change author on write tab

etc wrote #338451:

A very handy one, thanks Julian! But it really should require admin.list and article.php privileges.

Thanks for the pointer. I guess this prevents lesser users from escalating their article privileges by assigning their article to a higher level user.

I’ve updated the plugin (please advise if incorrect) and removed the past release.


TXP Builders – finely-crafted code, design and txp

Offline

#8 2024-12-09 07:44:19

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

Re: Plugin to change author on write tab

jakob wrote #338452:

I guess this prevents lesser users from escalating their article privileges by assigning their article to a higher level user.

Yes, that’s the main point.

I’ve updated the plugin (please advise if incorrect) and removed the past release.

You might even put this check on if ($event === 'article') level, to avoid unnecessary class load.

Offline

#9 2024-12-09 08:14:32

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,540
Website GitHub Twitter

Re: Plugin to change author on write tab

Hi Jakob

Nice plugin, i will give it a try.

Thanks.

Offline

#10 2024-12-09 08:38:52

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,243
Website

Re: Plugin to change author on write tab

Nice plugin

Is there a way to insert the field lower –I was thinking after the Categories block? I tried to change the code, and to figure it out by looking at txp_article.php but got nowhere.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#11 2024-12-09 10:35:55

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

Re: Plugin to change author on write tab

etc wrote #338458:

You might even put this check on if ($event === 'article') level, to avoid unnecessary class load.

Thanks and noted. The plugin is updated.

PS: It’s very nice to be able to able compile straight from the Plugin panel on the latest 4.9.dev. Thanks Stef!

phiw13 wrote #338461:

Is there a way to insert the field lower –I was thinking after the Categories block?

I hear you, especially as on txp v.4.8.8 it ends up being added above the “expand all / collapse all” buttons. However, as far as I can tell sort_display is the only instance of pluggable_ui(…) that is a complete collapsible region in the sidebar. I originally had it just as a select dropdown plus label after “Section” within the “Sort and Display” section. It’s more succinct but gives it a rather important position, and does setting the author really fit under the heading “Sort and Display”.

I tried to change the code, and to figure it out by looking at txp_article.php but got nowhere.

If you replace sort_display with categories, it gets inserted at the end of the categories region (within it rather than after it). If you want to have it within an existing region (after all, having a region with twister dropdown all to itself feels a bit extreme), you could strip the wrapRegion function out of the article_author_select() function, leaving just the inputLabel bit. But where does it fit best? Perhaps in the “Meta” region somewhere?

The other two options that occur to me are extend_col_1, which places the entire Author dropdown right at the end. Some other plugins such as jcr_writenav_buttons use the same hook, and I’m not sure which order they are processed in. That could mean the author dropdown might appear after the nav buttons, which would be strange.
Finally, there’s also the option markup, which is noted as unused in core but left for legacy plugins. That creates an “Advanced options” region at the end of the sidebar, but a) I’m not sure how long that hook will remain in the core, and b) I don’t think it’s a particularly good fit, especially as you can’t change the region’s title. In short, I don’t think users would intuitively find the author option there.

Further options?

  • Add another pluggable_ui hook to the core to allow insertion after the category region? That would resolve the problem but then the plugin would be for txp 4.9+ only.
  • Relocated the block after insertion with javascript/jQuery. That would give you positioning freedom at the expense of (unnecessary?) code.

Any other suggestions?


TXP Builders – finely-crafted code, design and txp

Offline

#12 2024-12-09 11:48:47

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

Re: Plugin to change author on write tab

jakob wrote #338463:

Thanks and noted. The plugin is updated.

Thanks! There is a small quirk: when editing a new article, the first (not the current) author is selected from the list. I guess you should check whether $rs['AuthorID'] is empty and then select the current user by default.

PS: It’s very nice to be able to able compile straight from the Plugin panel on the latest 4.9.dev. Thanks Stef!

+1

Offline

Board footer

Powered by FluxBB