Support Forum » User Profile

Forum Replies Created

Viewing 15 posts - 1,036 through 1,050 (of 3,702 total)
  • Author
    Posts
  • 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() );
    
    Anh TranAnh Tran
    Keymaster

    Hi Ryan, the fix is available here.

    Anh TranAnh Tran
    Keymaster

    Hi Sergio,

    The problem is from is a reserved keyword for MySQL. You can't use it directly in your SQL. To get over it, you need to put it in back ticks (`). Here is the modified SQL:

    https://pastebin.com/d8RUsspx

    (Can't post the SQL here because back ticks are used to insert code in this forum)

    in reply to: Conditional logic shortcode issue #14882
    Anh TranAnh Tran
    Keymaster

    Hi Nick,

    I'm not sure about the syntax, you probably need to get help from BB team.

    But in this case, you can use the MB Beaver Builder Integration to do the same using the Conditional Logic popup. Here is what I've tested:

    https://imgur.elightup.com/zqh9715.png

    in reply to: How to save image data using custom tables? #14881
    Anh TranAnh Tran
    Keymaster

    Hi Sergio,

    The original post was about storing image data, e.g. storing full image in the DB.

    In your case, you are using image_advanced field, which stores image IDs in the DB, which is the default behavior of the plugin and is totally fine. The data is automatically serialized, that's why you see a:2:{i:0;s:0:””;i:1;i:734;}.

    The reason your helper doesn't work is because you register the meta box for users. So, you need to set the object_type for the rwmb_meta function, like this:

    $images = rwmb_meta( 'info', array( 'object_type' => 'user', 'limit' => 1 ) );

    in reply to: Invoice? #14879
    Anh TranAnh Tran
    Keymaster

    Hi, I've just sent you the invoice via email. Please check it.

    The invoice is sent manually since some company needs to fulfill their details such as address, register ID or VAT.

    Anh TranAnh Tran
    Keymaster

    Hi Ryan, I think this is a bug with the WYSIWYG field and I'll try to fix it soon.

    in reply to: Choose File in custom table #14866
    Anh TranAnh Tran
    Keymaster

    It's a bug in the MB User Meta extension and I have fixed it.

    Anh TranAnh Tran
    Keymaster

    Hi Mauro, please use this filter:

    https://docs.metabox.io/filters/#choice-fields-user-post-taxonomy-filters

    Anh TranAnh Tran
    Keymaster

    Hi Ryan, I think the problem is the validation not working properly with wysiwyg field. I tried in the back end and see the same problem. If you switch between Visual/Text mode, then TinyMCE will update the content and set the validation properly.

    in reply to: Using MB to create a restaurant menu builder #14855
    Anh TranAnh Tran
    Keymaster

    @Neil: Thanks a lot for your post! I think other people will find this useful, too!

    Anh TranAnh Tran
    Keymaster

    Hi @bodenburgc,

    Unfortunately, it's not supported. You can add a whole meta box for the product, but not for a variation.

Viewing 15 posts - 1,036 through 1,050 (of 3,702 total)