• Resolved burrebista

    (@burrebista)


    Hi,
    I created a Relationship Custom Field in PODS, where the users can see and select a post from another custom post type (for eg. products). The problem is that I have a thousands of posts and for the users it’s a bad experience to search dozens of items until finding their posts.

    Is there any solution that users should be able to see only the pots created by them?
    [IMG]http://i58.tinypic.com/258as9f.png[/IMG]

    I already put the following code in my functions.php but it’s not working for this custom field:
    function mypo_parse_query_useronly( $wp_query ) {
    if ( strpos( $_SERVER[ ‘REQUEST_URI’ ], ‘/wp-admin/edit.php’ ) !== false ) {
    if ( !current_user_can( ‘update_core’ ) ) {
    global $current_user;
    $wp_query->set( ‘author’, $current_user->id );
    }
    }
    }

    add_filter(‘parse_query’, ‘mypo_parse_query_useronly’ );

    Many, many thanks in advance!

    Regards,
    Burebista

    https://wordpress.org/plugins/pods/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Josh Pollock

    (@shelob9)

    This is something we support, through the “CustomizedWHERE” field of the Pods field editor. For a post type Pod, for your relationship field, set the value t.post_author = "@user.ID" there.

    Thread Starter burrebista

    (@burrebista)

    Hi,

    Thank you very much for your response!

    When I put this value – t.post_author = “@user.ID” – in Customized WHERE options, all the posts disappeared from the box choices in relationship field meta box.

    Any solutions?

    Many thanks!

    Regards

    Plugin Contributor Josh Pollock

    (@shelob9)

    Sorry, either I made a mistake or the code got mangled. It should have been t.post_author = "{@user.ID}"

    Thread Starter burrebista

    (@burrebista)

    Hi Josh,

    With this argument works!
    Awesome!

    Thank you very much!
    All the best!

    Regards,

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to show only the author's posts in PODS Relationship Custom Field’ is closed to new replies.