Support Forum » User Profile

Forum Replies Created

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • in reply to: frontend form shortcode to exclude certain custom fields #30992
    dpdp
    Participant

    the reason for above - the shortcodes can be placed in templates/scopes where the different customized conditions are already set by builders like oxygen, etc

    in reply to: frontend form shortcode to exclude certain custom fields #30991
    dpdp
    Participant

    nice but that would involve creating more forms, which can be hard to manage. Would ur development team consider something like this.. for a better UX management? Just suggesting, hope u dun mind or what're ur thoughts?

    eg. form with 10 custom fields - [mb_frontend_form id='advice-form']
    - form [mb_frontend_form id='advice-form' fields='-cf1,-cf3'] to dynamically display 8 custom fields,
    - another form [mb_frontend_form id='advice-form' fields='-cf8,-cf9,-cf0'] to dynamically display 7.

    in reply to: frontend form shortcode to exclude certain custom fields #30982
    dpdp
    Participant

    just tested but i realize that's done in the frontend to hide the fields (which can still be edited). What i actually meant is to exclude the specified custom fields from the backend, rather than hide using jquery and css

    eg. ref -> like [mb_frontend_form id="meta-box-id"] has post_title and post_content omitted from the bkend [mb_frontend_form id="meta-box-id" post-fields="title,content"]

    in reply to: Prepopulate relationship field with current post id #30322
    dpdp
    Participant

    thank you for ur patience. it works. i had the ajax on. thank you again Long

    in reply to: Prepopulate relationship field with current post id #30307
    dpdp
    Participant

    The function get_queried_object_id() get the current page ID that show the frontend form as well.

    - yes tried it but returns 0. (pls see my reply #30264)

    Do you add the frontend shortcode to the events page directly? Or add through a builder template?

    - tested frontend shortcode on page directly and in builder template, no difference

    Or just add the fixed ID of the events page like this
    MB_Relationships_API::add( 1234, $post_id, 'events_to_posts', $order_from = 1, $order_to = 1 );

    - yes, i understand this will definitely work but this is what im trying to get -> pls see my reply #30176 ps- frontend form will be on every CPT page with different ID

    thank you

    in reply to: Prepopulate relationship field with current post id #30295
    dpdp
    Participant

    yes but by doing that, im creating a relationship from the submited post_id to the submited post_id; which isnt what im looking for and redundant

    in reply to: Prepopulate relationship field with current post id #30286
    dpdp
    Participant

    so close, hate to give up 🙁

    so any idea how to get the current post id for me to insert into the $to

    do_action( 'mb_relationships_add', $post_id, $to, $id, $order_from, $order_to );

    thanks Long

    in reply to: Prepopulate relationship field with current post id #30274
    dpdp
    Participant
    do_action( 'mb_relationships_add', $from, $to, $id, $order_from, $order_to );
    

    so from the documentation -> the submitted post is $post_id, but my question is how do i get the current post id $to when get_the_ID() and get_queried_object_id() doesnt work

    do_action( 'mb_relationships_add', $post_id, $to, $id, $order_from, $order_to );
    
    in reply to: Prepopulate relationship field with current post id #30264
    dpdp
    Participant

    trying to get the current post id with get_queried_object_id() but nothing gets registered into the db. Also tried get_the_ID().

    https://pasteimg.com/image/screenshot-2021-08-15-103629-am.c3PIn

    here's the code
    MB_Relationships_API::add( $post_id, get_queried_object_id(), 'events_to_posts', $order_from = 1, $order_to = 1 );

    in reply to: Prepopulate relationship field with current post id #30195
    dpdp
    Participant

    hi long,

    im confused. 1) where can i find the field_id. i created using the relationship builder.

    2) thank you for ref 🙂 but will the set-meta work for the related post also, since post-meta and the relationship values are saved in different db.

    in reply to: Prepopulate relationship field with current post id #30176
    dpdp
    Participant

    The backend will not need to set the relationship as well because the 'current post' (which the form is on), should automatically be the 'related' post to their 'submission'.

    eg. frontend form is on ./post-69. User fill up and submit this form. This submitted entry automatically is related to ./post-69.

    in reply to: Prepopulate relationship field with current post id #30144
    dpdp
    Participant

    yes, the user will not need to set the relationship as the post they are on (when they fill the form), should be the related post

    dpdp
    Participant

    resolved. pls close this

    dpdp
    Participant

    I created a relationship between post to expert (post cpt). Author will create a expert that will link/relate to a post.

    I'm trying to display the linked/related posts on the author archive page.

    Im using the tutorial from metabox doc but getting a Invalid argument supplied for foreach() error.

    sample

    <?php
    
    $auid = get_the_author_meta( 'ID' );
    
    $args = array(
        'author' => '$auid',
        'post_type' => 'post'
        );
    
    $my_query = new WP_Query( $args );
    
    MB_Relationships_API::each_connected( [
        'id'   => 'expert-challenge',
        'to' => $my_query->posts, // Set to $my_query.
    ] );
    
    while ( $my_query->have_posts() ) : $my_query->the_post();
    
        // Display connected pages
        foreach ( $post->connected as $p ) :
          echo $p->post_title;
    
            // More code here.
        endforeach;
    
          echo '<pre>'; var_dump($my_query->posts) ; echo '</pre>';
          
    endwhile;
    //wp_reset_postdata();
    
    
Viewing 14 posts - 1 through 14 (of 14 total)