Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2014-07-30 05:13:11

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

Prepopulating article fields

Does anybody know a way of prepopulating article fields in the Write tab?

Specifically from a link. For example:

.../textpattern/index.php?event=article&title=something&body=somesuch

which would take the user to the article write tab and fill in the fields accordingly, but would not actually create the article.

Or might there be another way?

Your ideas would be gratefully received.

Offline

#2 2014-07-30 10:40:33

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,303

Re: Prepopulating article fields

Hi Adi, there’s a replacement for the now broken upm_savenew, yab_copy_to_new. Can you make use of it somehow?


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#3 2014-07-30 10:52:32

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

Re: Prepopulating article fields

Hi Uli, thanks for the reply.

uli wrote #282527:

… there’s a replacement for the now broken upm_savenew … Can you make use of it somehow?

Not really, the links would be dynamically generated (probably in an smd_tabber page) and there could be many of them, each with slightly different “seed” data. And I don’t want any articles created until the user fills in a bit more data & then clicks Publish.

The idea behind this is to make data entry easier and more reliable.

Offline

#4 2014-07-30 10:53:05

trenc
Plugin Author
From: Amsterdam
Registered: 2008-02-27
Posts: 571
Website GitHub

Re: Prepopulating article fields

gomedia wrote #282520:

Does anybody know a way of prepopulating article fields in the Write tab?

Specifically from a link. For example:

.../textpattern/index.php?event=article&title=something&body=somesuch

Write the GET vars with upper-case first letter

.../textpattern/index.php?event=article&Title=something&Body=somesuch

Offline

#5 2014-07-30 11:09:15

trenc
Plugin Author
From: Amsterdam
Registered: 2008-02-27
Posts: 571
Website GitHub

Re: Prepopulating article fields

Btw. You can use every input name.

Prefilled article image? Use ...&Image=12
Article Status Draft? Use ...&Status=1

etc. pp.

Offline

#6 2014-07-30 11:20:51

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,303

Re: Prepopulating article fields

Very useful! Thanks!! (glz_cf seems to be the party pooper, btw, only works for cfs without the installed plugin)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#7 2014-07-30 12:03:04

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

Re: Prepopulating article fields

Yes, very handy. Bear in mind it only works for single-line content, as far as I can recall. For example:

?event=article&Title=Wizard of Oz&Body=Somewhere over the rainbow%0ABluebirds fly

doesn’t put the line break in. \n and \r don’t work, nor does <br>.

There might be some clever way to encode it which does work, I’ve never really put much effort into it.

EDIT: And, yes, the way glz_cf is coded means it overwrites any custom field URL-based payload, which is a shame.


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

#8 2014-07-30 12:40:05

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

Re: Prepopulating article fields

trenc wrote #282529:

Write the GET vars with upper-case first letter

.../textpattern/index.php?event=article&Title=something&Body=somesuch

Thanks very much … that was the first thing I tried (or so I thought) but it didn’t work for me … working now, hurrah! Must’ve been fInGeR trouble.

Offline

#9 2014-07-30 13:15:08

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

Re: Prepopulating article fields

… or perhaps it wasn’t me after all – I’ve got glz_custom_fields installed where I need to do this. Highs & lows!

Offline

#10 2014-08-06 01:42:17

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

Re: Prepopulating article fields

Not being able to do without glz_cfs, I’ve come up with a plugin solution (in conjunction with smd_tabber) which also seems to do line breaks. If anyone feels the need, give me a shout.

Offline

Board footer

Powered by FluxBB