Two CPT

This topic contains 11 replies, has 4 voices, and was last updated by  Samantha 4 years, 2 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #534917

    Samantha
    Full Member
    Post count: 33

    Hi There,

    We have two CPT that are linked together. We need the user to be able to link them prior to the primary listing being published and live. Is there some sort of coding we can add that allows the secondary CPT to be linked to the first CPT even though it’s not live?

    Secondly, My solution for this was to auto-publish the primary listing but we use offline payment so it appears that even though it tries to ‘auto-publish’ it’s not publishing because payment hasn’t been marked as complete.

    Anything you can think of that would help us accomplish this?

    Thanks,

    Sam

    #534918

    Samantha
    Full Member
    Post count: 33
    This reply has been marked as private.
    #534939

    Kor
    Moderator
    Post count: 16516

    Hi Misty,

    Thanks for your post. To link CPT’s, you can refer to this section of the documentation https://wpgeodirectory.com/docs-v2/addons/custom-post-types/#link . Let us know how it goes.

    #534975

    Samantha
    Full Member
    Post count: 33

    Thank you. We have them linked. The problem I’m having is that when the user submits one, it has to wait to be approved before they can then go to the 2nd CPT and link it to the first. I need the user to be able to connect the CPT and submit their listings before it’s approved.

    This is the current flow:
    – Submit 1 CPT
    – Wait to be approved
    – Submit 2nd CPT and select the first CPT to link to

    I need to eliminate that middle step. I tried to set it to auto-approve but since payment isn’t complete since we do an offline payment, it doesn’t get approved and published so they’re unable to submit the 2nd CPT and link it to the first.

    I need to be able to do one of two things:
    – Either be able to auto-publish listings, regardless of payment
    – Or, allow the 2nd CPT to link to pending listings from the 1st CPT

    #535045

    Guust
    Moderator
    Post count: 29970

    Have a look at the advanced settings of the packages, and change the publishing option to always publish.

    Thanks

    #535142

    Samantha
    Full Member
    Post count: 33

    Yes, the packages are set to publish. I also have the settings in GeoDirectory to publish by default.

    New listing default status: Published
    Paid Listing Status: Published

    Yet, still when the user submits the listings are pending.

    #535157

    Kor
    Moderator
    Post count: 16516

    Hi Misty,

    Thanks for your reply. Could you supply your WP admin login URL here in private reply?

    #535168

    Samantha
    Full Member
    Post count: 33
    This reply has been marked as private.
    #535177

    Guust
    Moderator
    Post count: 29970
    This reply has been marked as private.
    #535186

    Samantha
    Full Member
    Post count: 33

    Yes, thank you.

    #535375

    Kiran
    Moderator
    Post count: 7069

    Hello Misty,

    Try following PHP snippet to link pending posts.

    
    
    /**
     *
     * Allow to link pending posts.
     */
    function gd_snippet_search_include_pending_posts( $where ) {
    	$search = "p.post_status = 'publish'";
    	$replace = "( p.post_status = 'publish' OR p.post_status = 'pending' )";
    
    	$where = str_replace( $search, $replace, $where );
    
    	return $where;
    }
    add_filter( 'geodir_cp_search_posts_query_where', 'gd_snippet_search_include_pending_posts', 20, 1 );
    add_filter( 'geodir_cp_check_link_post_query', 'gd_snippet_search_include_pending_posts', 20, 1 );

    Regards,
    Kiran

    #535473

    Samantha
    Full Member
    Post count: 33

    Yes, that worked. Thank you Kiran!

Viewing 12 posts - 1 through 12 (of 12 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket