Support Forum » User Profile

Forum Replies Created

Viewing 15 posts - 1,051 through 1,065 (of 3,958 total)
  • Author
    Posts
  • in reply to: Bought Metabox and can't download it #14994
    Anh TranAnh Tran
    Keymaster

    Hi Engo,

    I've just updated the link for MB Builder 3.0.0-RC1. It's a RC-version and the link is temporary. I'll release the final version when it's fully tested.

    in reply to: Rest API Post to Custom Tables not work #14956
    Anh TranAnh Tran
    Keymaster

    Hi, I've just tested the plugin and it works fine to me. Here is the video I made for that:

    https://youtu.be/YMjAIZLUeF4

    Update 1: I replied too fast. I didn't notice you were talking about custom table. Let me check that again.

    Update 2: I've just pushed a fix to the plugin here. Can you please try it?

    in reply to: Hide/Show fields on select type #14955
    Anh TranAnh Tran
    Keymaster

    Hi Dave,

    I've just push a fix for MB Conditional Logic extension. Now that works for elements outside cloneable groups.

    The update for Meta Box AIO will come later.

    Anh TranAnh Tran
    Keymaster

    Hi Jefferson,

    We have 2 extensions for front-end forms: MB Frontend Submission (for submitting posts) and MB User Profile (for editing user details). If your forms have some similarity, then you can use them.

    in reply to: Showing Taxonomies on the frontend form #14940
    Anh TranAnh Tran
    Keymaster

    Hi @SWS,

    You're right about creating taxonomies in 2 places. I've just added a commit that adds remove_default param for taxonomy field, which helps removing the default WordPress taxonomy meta box (it's enabled by default). Please try it.

    in reply to: Field image_upload stop to works after last update #14934
    Anh TranAnh Tran
    Keymaster

    Hi @Jefferson, I've fixed this bug here. Please try it.

    in reply to: Showing Taxonomies on the frontend form #14933
    Anh TranAnh Tran
    Keymaster

    Ah, I got it.

    To show the taxonomy on the front end, you need to create a field with the field type taxonomy or taxonomy_advanced.

    The meta box for the taxonomy field on the right is the default WordPress's meta box, which won't show on the front end.

    Anh TranAnh Tran
    Keymaster

    Sorry, please try this code for the 2nd step:

    add_filter( 'do_shortcode_tag', function ( $output, $tag, $attr ) {
        if ( $tag !== 'mb_frontend_form' || $attr['id'] !== 'my_form' ) {
            return $output;
        }
    
        // Check if current user is the post author.
        $post_id = filter_input( INPUT_GET, 'rwmb-post-id', FILTER_SANITIZE_NUMBER_INT );
        if ( ! $post_id ) {
            return $output;
        }
        $post = get_post( $post_id );
        if ( $post->post_author != get_current_user_id() ) {
            return 'You are not allowed to edit this post';
        }
    
        return $output;
    }, 10, 3 );
    in reply to: Field image_upload stop to works after last update #14907
    Anh TranAnh Tran
    Keymaster

    Hi @Jefferson,

    Can you post the code of the gallery field and do you know why the first item is empty?

    Anh TranAnh Tran
    Keymaster

    If you try to edit the existing posts, then only admin can edit them. Because their post author is the admin (technically when submitting posts, the plugin doesn't set the post author, and that falls back to the admin).

    This code will work with new submitted posts, where the code in the step 1 sets the proper post author.

    For the existing posts, you need to set the post author manually. Then the code will work properly.

    in reply to: MB Custom Table & WooCommerce #14905
    Anh TranAnh Tran
    Keymaster

    Hi Brian,

    Can we actually do this with WooCommerce & the MB Custom Table or was this just a hypothetical example?

    I'm afraid we can't. This involves a lot of the internal logic in WooCommerce. Modifying the data will break the logic and make it not working.

    in reply to: Cannot hide relationship #14901
    Anh TranAnh Tran
    Keymaster

    Hi @ecurtain,

    Can you try the latest version on Github? I've fixed that here.

    in reply to: Showing Taxonomies on the frontend form #14900
    Anh TranAnh Tran
    Keymaster

    Hi @SWS,

    Did you mean that you're using a field type taxonomy and it shows terms on the back end but not front end?

    Can you send some screenshots?

    Anh TranAnh Tran
    Keymaster

    Hi,

    This is an interesting question. After checking around, this is the solution I found:

    Step 1: set the post author when submitting

    add_filter( 'rwmb_frontend_insert_post_data', function( $data, $config ) {
        if ( $config['id'] !== 'my_form' || ! is_user_logged_in() ) {
            return $data;
        }
    
        // Set current post ID as the author of the post.
        $data['post_author'] = get_current_user_id();
        return $data;
    }, 10, 2 );

    Step 2: check if the current user is the post author

    add_filter( 'do_shortcode_tag', function ( $output, $tag, $attr ) {
        if ( $tag !== 'mb_frontend_form' || $attr['id'] !== 'my_form' ) {
            return $output;
        }
    
        // Check if current user is the post author.
        $post_id = filter_input( INPUT_GET, 'rwmb-post-id', FILTER_SANITIZE_NUMBER_INT );
        $post = get_post( $post_id );
        if ( $post->post_author != get_current_user_id() ) {
            return 'You are not allowed to edit this post';
        }
    
        return $output;
    }, 10, 3 );
    in reply to: How to save image data using custom tables? #14898
    Anh TranAnh Tran
    Keymaster

    Hi Sergio,

    I know why. You need to pass the user ID to the function as the 3rd param. By default, the function takes the current post ID. So the code should be:

    $images = rwmb_meta( 'avatar', ['object_type' => 'user', 'limit' => 1], get_current_user_id() );
    
Viewing 15 posts - 1,051 through 1,065 (of 3,958 total)