PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

drop down with posts from certain author

  1. I have a dropdown which shows custom post titles. I would like to make a dropdown which is showing only the post titles from the custom posts that were added by the logged on user that is using the dropdown. Looked at http://pastie.org/1617402 but don't know where to go from there.
    If anyone can assist, would be much appreciated.

    Posted 12 years ago on Saturday October 6, 2012 | Permalink
  2. So, you want to limit this code to return only posts from one author, but otherwise, this code works fine for you? If that is the case, try this modified code: http://pastebin.com/46wpe9Ss

    That is unchanged from the original you linked to, other than restricting the posts to those by the logged in user. Please test and let us know how that goes.

    Posted 12 years ago on Monday October 8, 2012 | Permalink
  3. Hi thanks. Tried it but it returns no results.

    Made a few changes:
    - 'gform_pre_render' -> 'gform_pre_render_2' (2 is my form ID)
    - dropdown field for my form = 1
    - Changed the posttype from 'post' to my custom posttype 'shop' (2x)

    Also tried $post_type = 'post' and added a post, no entries found her as well. I use e-mailaddress as loginname.

    When I echo $choices it returns the word Array, shouldn't this be a list of posts?

    Hope you can determine where it's going wrong

    Posted 12 years ago on Monday October 8, 2012 | Permalink
  4. No, $choices is an array. Try print_r($choices) and see what shows up.

    Also, please post the complete code you are using to pastebin.com or pastie.org

    Posted 12 years ago on Monday October 8, 2012 | Permalink
  5. found the problem. $user_id on line 47 should be $userid. It works now

    Thanks!

    Luit

    Posted 12 years ago on Monday October 8, 2012 | Permalink
  6. You're absolutely right: my mistake. I edited the paste. I must have been trying different things with differently named variables.

    Posted 12 years ago on Monday October 8, 2012 | Permalink

This topic has been resolved and has been closed to new replies.