Support » Plugins and Hacks » [Resolved] Relationship fields not in Mysql database?

[Resolved] Relationship fields not in Mysql database?

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Scott Kingsley Clark


    Can you explain what you’d like to know beyond what I sent as a reply to that topic?

    First, what did you mean by “It’s in pods/ui/input_fields.php”? I can’t find any file with the name “input_fields.php” under ui. I have installed the helpers.

    Second,”Then at top, use PHP to set $value = implode(‘,’, $value)”. You mean that I should put “$value = implode(‘,’, $value)” at the top of “input_fields.php”?

    Third, “adjust code to use in_array instead of the ‘active’ check”, can you tell me where I do this and how? Do I need some codes?


    Plugin Author Scott Kingsley Clark


    Those previous notes were from references to Pods 1.x, they are incompatible with Pods 2.x

    Is this a meta-based Post Type?

    No, Scott, I use Pods table based type.
    I think if the relationship fields can be inserted into database like a text field, my early question about how to display the right information of relationship field by “Codepress Admin Columns” can also be solved.

    Plugin Author Scott Kingsley Clark


    We’ve got some additional fixes in place for Codepress Admin Columns in Pods 2.3, there’s no ETA on release yet, we’re still deep in development of it.

    The only way you can accomplish text-based relationships, results in relationships not functioning as normal. So your code will be entirely in-charge of outputting it the way you need and saving it. You’ll need a combination of an input override and a pre-save action.

    In Pods 2.3, there’s a new filter: pods_form_ui_field_{$type}_override which you can return true on if you want to override the field input. It’s passed 6 variables: false, $name, $value, $options, $pod, $id, once you return true, it will then run the action pods_form_ui_field_{$type}, but you can always just output in the override filter itself (just remember to return true at the end).

    For now, in Pods 2.2, you’ll need to do one of the following:

    • Use a Relationship field, set it to Custom Simple for what it’s related to, and you’ll be able to set the values you want to define there
    • Define a custom field type, documentation is lax right now but we’ve hired a writer to revamp all of our docs this month
    • Use an Input Helper

    For Custom Simple relationships, there’s a filter you can apply to override the values that are used called pods_form_ui_field_pick_custom_values, which is passed these 6 values: $custom, $field[ 'name' ], $value, $options, $pod, 0

    Scott, thank you very much for your patience.
    Inserting relationship into database is very important for me not only because I want to show it at admin column accurately, but also because I hope I can output the complete records from MySQL. For now, the relationship field in database is missed.
    I’m looking forward to Pods 2.3 but I appreciate it if you can tell me how to achieve this function in Pods 2.2 step by step by using Input helper or custom simple. Here is what I would like to achieve,

    1. I have two table based custom types called “Type A” and “Type B”.
    2. “Type A” has a plain text custom field called “Field A” and “Type B” has a relationship field called “Field B”. And “Field B” gets values from “Field A”.

    I want “Field B” to go on getting values from Field A automatically while inserting the selected value from Field A into database just as a text field.

    If it involves in some codes, can you write it directly? For I know little about PHP and MY SQL.


    You mention “Use a Relationship field, set it to Custom Simple for what it’s related to, and you’ll be able to set the values you want to define there”, do you mean that I can add some variables to Custom Defined Options instead of concrete labels and values? If so, how should I do it? Can you give me some examples based on my requirement above?

    Plugin Author Scott Kingsley Clark


    This stackoverflow post talks about how to take over the values for relationship fields:


    Unfortunately, for what you’re wanting, that will require some PHP work. I’ve fixed some bugs I found during testing with CodePress Admin Columns and those are included with Pods 2.3, so that should resolve the main issue you’re needing it to be stored in the table itself instead.

    Thanks, Scott, I will ask my friends who understand the php better to help me. When PODs is going to be released by your estimation?

    Plugin Author Scott Kingsley Clark


    There is currently no ETA on Pods 2.3

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘[Resolved] Relationship fields not in Mysql database?’ is closed to new replies.