Supreme theme CPT submit button link

This topic contains 5 replies, has 2 voices, and was last updated by  Alex Rollin 6 years, 11 months ago.

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

Open Support Ticket

Tagged: ,

  • Author
    Posts
  • #407138

    Atila Iglesias
    Expired Member
    Post count: 72

    Hello sirs,

    If possible i would like the button shown in attached print screen to point to the new created formidable tab following the steps in this link, instead then pointing to the review., I did find the source of of the button in directory supreme-directory/inc/geodirectory-compatibility.php but I am not sure how to update it;

    Following is the code I added to my function to generate the tab:

    
    
    // this line tells the tabs function to run our new function to add a new tab
    add_filter('geodir_detail_page_tab_list_extend', 'geodir_detail_page_tab_list_extend');
    
    // this function adds the tab to the tabs list (but not the content)
    function geodir_detail_page_tab_list_extend($tab_array)
    {
        // the $post var contains all the listing info so we can add conditions
        global $post;
        // only add the tab if the post type is <code>gd_hotel</code> and the email field has been added to the listing
        if ($post->post_type=='gd_tours' && $post->geodir_email) {
            $tab_array['booking_form'] = array('heading_text' => 'Solicite',
                'is_active_tab' => '',
                'is_display' => 1,
                'tab_content' => '',
            );
        }
        return $tab_array;
    }
    
    add_action('geodir_after_tab_content', 'geodir_booking_form_content', 10, 1);
    
    // this function adds the content to our new tab
    function geodir_booking_form_content($tab)
    {
        //if the tab exists then we know it has passed the criteria and we can add the content
        if ($tab == 'booking_form') {
            echo do_shortcode('[formidable id=2]');
        }
    }
    
    // this action tells the form to call our function to add a new field - GeoDirectory20112017
    add_action('frm_entry_form', 'geodir_add_hidden_field');
    // this function adds our field to the form
    function geodir_add_hidden_field($form)
    {
        // our example booking form has an ID of <code>2</code> so we only want to add the field to that form
        if ($form->id == 2) {// only send if the form id is 2
            global $post;
            echo '<input type="hidden" name="gd_tours_id" value="' . $post->ID . '">';
        }
    
    }
    
    // this tells the formidable form to check our function before sending
    add_filter('frm_to_email', 'geodir_custom_set_email_value', 10, 4);
    // this function will add the listing email to the recipiants list when submitted
    function geodir_custom_set_email_value($recipients, $values, $form_id, $args)
    {
        // only run if the submited form is our booking form with ID <code>2</code>
        if ($form_id == 2 ) {// only send if the form id is 2
            //check if the place id is submitted
            $post_id = (isset($_POST['gd_tours_id']) && $_POST['gd_tours_id']) ? absint($_POST['gd_tours_id']) : '';
            if ($post_id) {
              // we found a post id so we can use it to get the place email address
              $place_email = geodir_get_post_meta($post_id, 'geodir_email');
            }
            // if we have a place email address we then add it to the list of email recipiants
            if ($place_email) {
              $recipients[] = $place_email;
            }
        }
    
        return $recipients;
    }
    
    // tell formidable to call our function when sending the form
    add_filter('frm_email_subject', 'geodir_booking_change_subject', 10, 2);
    // add the listing name to the
    function geodir_booking_change_subject($subject, $atts){
      extract($atts);
      $post_id = (isset($_POST['gd_tours_id']) && $_POST['gd_tours_id']) ? absint($_POST['gd_tours_id']) : '';
      // if form is our booking for and the post id exists
      if($form->id == 2 && $post_id){
        $place_name = get_the_title( $post_id );
        $subject = 'Booking form for: '.$place_name; //Replace Thank You with your email subject
      }
      return $subject;
    }
    #407229

    Alex Rollin
    Moderator
    Post count: 27815

    A valid license is required to view this reply.

    You may need to login

    OR

    Buy either a Membership or valid license for this product.

    Thanks, Team GeoDirectory!

    #407282

    Atila Iglesias
    Expired Member
    Post count: 72

    A valid license is required to view this reply.

    You may need to login

    OR

    Buy either a Membership or valid license for this product.

    Thanks, Team GeoDirectory!

    #407375

    Alex Rollin
    Moderator
    Post count: 27815

    A valid license is required to view this reply.

    You may need to login

    OR

    Buy either a Membership or valid license for this product.

    Thanks, Team GeoDirectory!

    #407393

    Atila Iglesias
    Expired Member
    Post count: 72

    A valid license is required to view this reply.

    You may need to login

    OR

    Buy either a Membership or valid license for this product.

    Thanks, Team GeoDirectory!

    #407465

    Alex Rollin
    Moderator
    Post count: 27815

    A valid license is required to view this reply.

    You may need to login

    OR

    Buy either a Membership or valid license for this product.

    Thanks, Team GeoDirectory!

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

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

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount