Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1009 2012-06-22 15:11:03

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: glz_custom_fields

@progre55

Since you are doing a commercial site, maybe offer to pay for Bloke’s services in bringing your plugin to fruition? I did just that when I needed some calendar work from him on a client’s site and he did a great job.

Offline

#1010 2012-06-22 15:13:08

progre55
Member
Registered: 2006-05-02
Posts: 668

Re: glz_custom_fields

philwareham:

Thanks for the suggestion — Bloke rocks and I know he would do a great job.

Bloke let me know if your schedule permits and if you would be willing to throw some magic together. I do not think it would be too complicated — but let me know your thoughts —-

In taking a look — I think your http://stefdawson.com/sw/plugins/smd_multi_choice

May be part of the solution —- but let me know if you would be willing to pull it together for some compensation —-

UPDATE: I found this post which I think should help point me in the right direction: http://forum.textpattern.com/viewtopic.php?id=36485

progre55

Last edited by progre55 (2012-06-27 19:10:05)

Offline

#1011 2012-06-28 01:51:16

nardo
Member
From: tuvalahiti
Registered: 2004-04-22
Posts: 743

Re: glz_custom_fields

Is it possible to have a dropdown select that is automatically populated with articles from a given section?

And is it possible to reference fields from an article selected in this way?

The use case is as follows – we have articles in a section venues that hold the name, address, lat/long & other details relating to a venue. When we enter an event in section events, we want to choose the venue from a dropdown. We also want to access a number of venue article fields when displaying the event page.

Thank you.

Offline

#1012 2012-06-28 21:48:56

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

Re: glz_custom_fields

nardo wrote:

Is it possible to have a dropdown select that is automatically populated with articles from a given section?

yes

And is it possible to reference fields from an article selected in this way?

Yes

I would just nest a second article_custom call from within the events article form. It’s sole purpose is to list the venue fields. So when you are putting in a new “event” article you’d use a glz scripted select to tell it to associate with the selected venue article. Just like using an article image really.

This sucker should create a select that lists all non-sticky articles in the venue section and return the url-title. Throw it in your glz_custom_fields folder

Edit: Actually returns the url-title not article ID, but just replace instances of url_title with whatever database field (see below) you’d like the field to return. Also note, the first script will produce a select and the second will produce a multi-select. Read comments to see how

Possible Article Fields

  • ID
  • Posted
  • Expires
  • AuthorID
  • LastMod
  • LastModID
  • Title
  • Title_html
  • Body
  • Body_html
  • Excerpt
  • Excerpt_html
  • Image
  • Category1
  • Category2
  • Annotate
  • AnnotateInvite
  • comments_count
  • Status
  • textile_body
  • textile_excerpt
  • Section
  • override_form
  • Keywords
  • url_title
  • custom_1-20
  • uid
  • feed_time

Select that lists article titles and returns article url titles from the “venues” section

<?php
function my_venues($custom_field, $custom_id, $custom_value) {
  $titles = array();
  $query = safe_rows('url_title, title', 'textpattern', "section like 'venues' AND status !=5");
  $titles[] = '&nbsp;';
  foreach ($query as $title) 
    $titles[$title['url_title']] = $title['title'];

  // for a multi-select allowing multiple values change "2" to "1" and add ", true" without quotes after it.
  return glz_selectInput($custom_field, $custom_id, $titles, $custom_value, "2"); 
  }

?>

faux unlimited categories multi-select (restricted to children of a “my_parent_cat”)

<?php
function my_wine_cats($custom_field, $custom_id, $custom_value) {
  $titles = array();
  $query = safe_rows('name, title', 'txp_category', "parent like 'my_parent_cat' AND type like 'article' order by title asc");
  $titles[] = '&nbsp;';
  foreach ($query as $title) 
    $titles[$title['title']] = $title['title'];

  // for a select allowing only a single value change "1" to "2" and remove ", true" without quotes after it.
  return glz_selectInput($custom_field, $custom_id, $titles, $custom_value, "1", true);
}

?>

Last edited by mrdale (2012-06-29 15:23:07)

Offline

#1013 2012-06-28 21:58:42

nardo
Member
From: tuvalahiti
Registered: 2004-04-22
Posts: 743

Re: glz_custom_fields

Thanks for that mrdale, we’ll give it a bash

Offline

#1014 2012-08-01 13:03:08

wornout
Member
From: Italy
Registered: 2009-01-20
Posts: 256
Website

Re: glz_custom_fields

Does anyone know how fix GLZ_CF for working with Textpattern 4.5?

Offline

#1015 2012-08-05 03:49:57

robbiia
New Member
From: New York
Registered: 2012-08-05
Posts: 8
Website

Re: glz_custom_fields

Nope. Didn’t seem to “fully work” when I tested – before I screwed something up on my Mamp – install of beta 4.5
If my memory serves me well (which it rarely does) – there was some issue with the fields at the top not being visible or something. It looked like some cels went wonky. You have to look at it for yourself though cause I ain’t reinstalling.

I was like. Check —-> it don’t work yet.
NEXT!!!!

but maybe i test further in future.

Offline

#1016 2012-09-04 19:25:05

photonomad
Member
Registered: 2005-09-10
Posts: 290
Website

Re: glz_custom_fields

After upgrading a site to 4.5, I tested to see what types of glz_custom_fields work or fail:

Text Input = works
Checkbox = fails
Radio = works
Select = works
Multi-Select = fails
Text Area = works
Date Picker = fails (little calendar icon appears to right of image, so it may just be a styling issue for the calendar pop-up)
Time Picker = fails (not little icon appears for the picker)
Custom script = didn’t test

If you click Save or Publish when when a cf checkbox is checked or a selection is made in a cf multi-select area, the following error will pop up and you won’t be able to save the article:
“Sorry, the form could not be submitted Please try again later.”

The only appearance/styling issue I found on the glz_custom_fields extension/settings page occurs when using the Hive theme. There is an overlap of the “Add new custom field” title bar covering the top half of the Name input field.

The “Configure glz_custom_fields” link that appears to the right of the “Type” field on the plugin’s extension page when multi-select, or any of the “Special” types is selected is broken.

Last edited by photonomad (2012-09-04 20:50:30)

Offline

#1017 2012-09-05 07:56:57

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: glz_custom_fields

Gerhard is currently fixing glz_custom_fields for use in Textpattern 4.5, so just be patient – it will happen.

Offline

#1018 2012-09-05 10:15:22

joebaich
Member
From: DC Metro Area and elsewhere
Registered: 2006-09-24
Posts: 507
Website

Re: glz_custom_fields

philwareham wrote:

Gerhard is currently fixing glz_custom_fields for use in Textpattern 4.5, so just be patient – it will happen.

I’m not sure I got such a warm fuzzy feeling as that from Gerhard’s recent emails. He said that he was ‘dragging his heels’ mostly because PHP didn’t ‘light his fire’ any more (I paraphrase, having deleted the emails and am unable to recall his precise terminology). The replies to his survey indicated that more than 90% of his plug-in users wanted GLZCF capabilities incorporated into Textpattern and he announced that he would enter negotiations with the TXP Devs about that. That is the right answer to the wrong question isn’t it? As I understand it, that incorporation is an aspiration for TXP 4.6 and not before. In these circumstances, don’t we just want him to fix his plug-in to work with the current TXP version one more time and then he can be done with it.

I’m sure popular plug-ins do become albatrosses around the necks of TXP plug-in developers when they move on. I understand completely where Gerhard is coming from, so I still love him to bits

Last edited by joebaich (2012-09-05 11:27:06)

Offline

#1019 2012-09-05 10:29:42

jpdupont
Member
Registered: 2004-10-01
Posts: 752

Re: glz_custom_fields

On a fresh new 4.5, I install the last glz_custom_fields. Don’t work because the table custom_fields is not created. I created it with phpmyadmin and in my particular case (I need a custom script), it work.

I’m creating 4 new sites actually with 4.4.1 because I need rss_unlimited_categories … and glz_custom_fields. Sad … So 4.5 is a fine/wonderful release but plugins prevent migration

Offline

#1020 2012-09-05 10:43:38

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

Re: glz_custom_fields

joebaich wrote:

The replies to his survey indicated that more than 90% of his plug-in users wanted GLZCF capabilities incorporated into Textpattern

For full disclosure, I should mention I was one of them :-)

Although still at an embryonic stage, my gut feeling is that we may just improve the database table structure, and put the infrastructure around to permit different data types (radio buttons, textareas, blah blah); probably along with some nice tag improvements and API to allow plugin authors to go to town without all the massive overhead that Gerhard had to go through to bring glz_cf to us. Whether we put a CF management interface into core is not something I have an answer to right now. It may be necessary, it may be prudent, it may be “easy”, so we might do it. And we’ll of course do it as quickly as we can.

In the meantime I’m not sure what to suggest. I don’t think it’s a huge job to patch glz_cf to work in 4.5.0. The fact that some non-text fields are failing is probably down to the new constraints built into core (just guessing). Raising a callback on the article constraints (article_ui / validate_save) and augmenting the allowable set may help (oh, and changing the plugin type to 5 of course). A hook for the article_ui / partials_meta callback is probably also needed. That should at least stop the javascript warnings when saving.

Same sort of thing applies to rss_unlimited_categories, btw.


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

Board footer

Powered by FluxBB