Issues with CPT Featured Image & Taxonomies

Issue #14 resolved
Former user created an issue

Hey Jake,

First of all, really appreciate you running with and updating Gravity Forms Update Post.

I've been having some issues when editing posts from custom post types with taxonomy inputs (multiselect, checkbox, drop) not showing what is currently selected / saved, and same with the featured image input as well.

I am also using the Gravity Forms + Custom Post Types plugin. Happy to help you troubleshoot, just let me know how I can help. Thanks!

Versions: * WordPress: 3.6.1 * Gravity Forms: 1.7.11

Comments (21)

  1. Ryan Urban

    These fields seem to save correctly in the admin, they are just not indicated in my editing form in the front-end.

    Lastly, also getting this:

    Notice: Undefined index: inputType in /Users/ryanurban/Desktop/Git Repos/launch-pgh/content/plugins/jupitercow-gravity-forms-update-post/gravityforms-update-post.php on line 541

  2. Ryan Urban

    Been exploring some more. Still get the notice, but I just realized that the featured image and taxonomies show fine if this form is output on the post page, and not on my custom edit page.

    When I wrap:

    gform_update_post::setup_form(); gravity_form( 1, false, false, false, '', true ); in a query, I see the featured image, but still not the taxonomies. I'm assuming that the form is maybe still looking for the taxonomies associated to the page that I'm outputting the form on?

    Any tips would be appreciated. Thanks!

  3. Jacob Snyder repo owner

    When you use it on the post's page, you can use:

    <?php gform_update_post::setup_form(); gravity_form( 1, false, false, false, '', true ); ?>
    

    But when you use it on your edit page, you need to use it like this:

    <?php gform_update_post::setup_form( $post_id ); gravity_form( 1, false, false, false, '', true ); ?>
    

    Perhaps you are doing that, but just want to be sure. I am looking at the error now.

  4. Ryan Urban

    Hmm, yeah that's what I was using, which gives that notice, and doesn't show the post featured image or taxonomies, I'm probably missing something simple:

    <?php
    /**
     * Page: Resources (Edit Posts)
     *
     * Template Name: Resources (Edit) Template
     */
    get_header(); ?>
    
        <section id="content" role="main">
    
            <?php // Resources: Edit Posts
    
            // Form
            gform_update_post::setup_form( 2350 ); 
            gravity_form( 1, false, false, false, '', true );       
    
            ?>
    
        </section><!-- main -->
    
    <?php get_footer(); ?>
    

    Thanks for getting back to me so quickly!

  5. Ryan Urban

    Hey Jake,

    I know you're a busy man and this is not it. I'd be willing to pay you for your time in helping me solve the above issues. I'm up against a deadline and need to get this knocked out asap.

    I appreciate it, and let me know if that would work for you.

    Ryan

  6. Jacob Snyder repo owner

    Yes! Sorry. I am looking at this now. Lets see if we can get this working as soon as we can. Sorry I got sidetracked there with some stuff. I would definitely like to feel like this things is working correctly. WIll update soon tonight.

  7. Ryan Urban

    No worries man, I know you're busy. I'm on all night, so let me know how I can help. As I mentioned, I'm totally good with paying you for some time to get things working.

    Thanks Jack!

  8. Ryan Urban

    It seems almost as if it's just not properly grabbing the post ID specified or something for the taxonomy and featured image. The title and content work fine.

  9. Jacob Snyder repo owner

    So I am seeing a problem with the images when editing on a separate page. I am not seeing an issue with taxonomy exactly... How are you adding taxonomy? Or what do you mean by taxonomy?

  10. Ryan Urban

    Using a typical WordPress taxonomy and then using a checkbox gravity field with that taxonomy mapped to it.

    All the terms are output fine, but when I go to edit a post it doesn't properly show which taxonomy items have been checked.

    Though it does seem to work fine in the post page.

  11. Jacob Snyder repo owner

    I have a fix for the featured image. I am surprised that hasn't come up sooner. It was a dumb mistake. I will start concentrating on the taxonomies after I upload this.

  12. Jacob Snyder repo owner

    Whew. Man. Definitely never used the custom taxonomies feature on custom post types plugin. The problem is that that plugin ONLY adds taxonomy. It doesn't actually replace taxonomy, so you can't ever delete taxonomy. I added a filter to completely delete the taxonomy before custom post type adds them. This works awesome when editing the post on the actual post's page, but everything to do with categories and taxonomy is broken when editing on another page. trying to fix that now.

  13. Jacob Snyder repo owner

    Ok. Updated. This should fix your issues, but let me know if you find any bugs. A lot of that category stuff was still left over from the original plugin which didn't handle categories very well, and while it tried, didn't support taxonomies at all apparently...

  14. Ryan Urban

    Nice, you rock Jake. Things appear to be working great now. The only thing I'm seeing left is this:

    Notice: Undefined index: inputType in /Users/ryanurban/Desktop/Git Repos/launch-pgh/content/plugins/jupitercow-gravity-forms-update-post/gravityforms-update-post.php on line 520

    I have a featured image input but otherwise no file upload, do we need to be checking for the existence of it in the form?

    Thanks again so much for working on this and putting in a late night, it is hugely appreciated.

  15. Ryan Urban

    It's this line:

    elseif ( 'fileupload' == $field['inputType'] && ! empty($field['defaultValue']) )

    Does it need to be this:

    elseif ( 'fileupload' == $field['type'] && ! empty($field['defaultValue']) )

    Seems like it, when I do that, this notice goes away and it mirrors the if statement above it:

    if ( 'post_image' == $field['type'] && ! empty($field['postFeaturedImage']) )

  16. Ryan Urban

    Thanks so much again Jake. You can close this issues at this point as resolved. I accidentally created it when not logged in, so I'm not able to close it.

    Also do you have a Paypal account or somewhere I can make a donation for your help?

  17. Jacob Snyder repo owner

    I made an update to check for the existence of the array key first. This should fix that.

    My paypal is jacobsnyder@gmail.com. Thanks for you help making this a better plugin!

  18. Ryan Urban

    Awesome, works perfect. You're very welcome Jake, and thank you for your work on this. I will get you some money in the next couple weeks.

    Thanks!

  19. Log in to comment