WordPress.org

Ready to get started?Download WordPress

Forums

Pods - Custom Content Types and Fields
[resolved] Relationship fields not in Mysql database? (11 posts)

  1. greattest
    Member
    Posted 1 year ago #

    Hi, Scott, Can you explain more about this link? http://podsframework.org/forums/topic/relationship-fields-not-in-mysql-database/
    I have similar requirement but I'm not a programmer

    Thansk

    http://wordpress.org/extend/plugins/pods/

  2. Scott Kingsley Clark
    Member
    Plugin Author

    Posted 1 year ago #

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

  3. greattest
    Member
    Posted 1 year ago #

    OK.
    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?

    Thanks

  4. Scott Kingsley Clark
    Member
    Plugin Author

    Posted 1 year ago #

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

    Is this a meta-based Post Type?

  5. greattest
    Member
    Posted 1 year ago #

    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.

  6. Scott Kingsley Clark
    Member
    Plugin Author

    Posted 1 year ago #

    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

  7. greattest
    Member
    Posted 1 year ago #

    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.

    Thanks

  8. greattest
    Member
    Posted 1 year ago #

    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?

  9. Scott Kingsley Clark
    Member
    Plugin Author

    Posted 1 year ago #

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

    http://stackoverflow.com/questions/14259179/how-to-change-output-of-a-certain-pods-field

    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.

  10. greattest
    Member
    Posted 1 year ago #

    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?

  11. Scott Kingsley Clark
    Member
    Plugin Author

    Posted 1 year ago #

    There is currently no ETA on Pods 2.3

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic