Support Forum » User Profile

Forum Replies Created

Viewing 15 posts - 1 through 15 (of 32 total)
  • Author
    Posts
  • in reply to: Relationships search functionality #46922
    EliodataEliodata
    Participant

    Hi,

    I finally use this snippet to display a metabox in my cpt with a link to the related user. The link display the billing company field, but you can use any other user field.

    // MODIFIER AFFICHAGE CHAMP relationnel clients-wp-bdd METABOX.IO cote BDD clients
    add_action( 'add_meta_boxes', 'add_link_to_wp_user_meta_box' );
    
    function add_link_to_wp_user_meta_box() {
        add_meta_box(
            'link_to_wp_user_meta_box',     // ID unique
            'Lien vers le compte utilisateur WP', // Titre de la metabox
            'display_link_to_wp_user_meta_box',  // Fonction callback pour afficher le contenu
            'client',  // Le CPT auquel cette metabox est liée
            'side',    // Position de la metabox
            'high'     // Priorité de l'affichage
        );
    }
    
    function display_link_to_wp_user_meta_box( $post ) {
        global $wpdb;
    
        // Récupérer l'ID de l'utilisateur associé au CPT via la relation 'clients-wp-bdd'
        $client_id = $post->ID;
        $user_id = $wpdb->get_var( $wpdb->prepare(
            "SELECT <code>from</code> FROM {$wpdb->prefix}mb_relationships WHERE <code>to</code> = %d AND <code>type</code> = 'clients-wp-bdd'",
            $client_id
        ));
    
        if ( !empty( $user_id ) ) {
            // Récupérer les informations de l'utilisateur WP
            $user = get_userdata( $user_id );
            $billing_company = get_user_meta( $user_id, 'billing_company', true );
            $edit_link = get_edit_user_link( $user_id );
    
            // Afficher un lien cliquable vers la page d'édition de l'utilisateur WP
            if ( !empty( $billing_company ) ) {
                echo '<p>Société : <a href="' . esc_url( $edit_link ) . '">' . esc_html( $billing_company ) . '</a></p>';
            } else {
                echo '<p>Aucun champ "billing_company" trouvé pour cet utilisateur.</p>';
            }
        } else {
            echo '<p>Aucun utilisateur lié trouvé.</p>';
        }
    }
    in reply to: File field, overwrite if exist #45784
    EliodataEliodata
    Participant

    Hi,
    Thank you! I finally created my own metabox:

    https://codeshare.io/4YjY78

    best regards

    in reply to: Relationships search functionality #44455
    EliodataEliodata
    Participant

    Thank you for the quick answer. Hope they will find something.
    If you give some clues maybe I could on my side.
    Best regards

    in reply to: Default value for datetime picker #43551
    EliodataEliodata
    Participant

    Thank you!

    in reply to: Default value for datetime picker #43543
    EliodataEliodata
    Participant

    Hello,
    Ok I understand what you mean. The default value is displayed when I clone the field.
    In my case this is a group of datetime fields. I don't clone the datetime field but all the group.
    I checked the "clone default value" at the group level and now it works. Many thanks!

    Is it possible to limit the available time slots (disable useless hours)?

    in reply to: Default value for datetime picker #43536
    EliodataEliodata
    Participant
    EliodataEliodata
    Participant

    Hello. It works, thank you! I had to enable this option for all the 60 fields but now I can see and edit them all.
    Best regards

    EliodataEliodata
    Participant

    Hi, thank you for the quick answer!

    dropdown
    Group settings
    admin column view
    Post view

    EliodataEliodata
    Participant

    Hello,
    It works. Any idea why it wasn't a problem the 2 last years?

    Thank you!

    EliodataEliodata
    Participant

    Thank you for the quick answer.
    Same problem when I activate the "save field value" option. Any change in the custom fields or the settings erase the content...
    You can see the issue in video here:

    https://eliodata.com/fstest/metabox-issue.mov

    in reply to: Problem unresolved, wooc orders custom field and relationnal #38964
    EliodataEliodata
    Participant

    Hi,
    sorry to bother you with this, but do you think there is a chance to solve this problem? I really need this feature...
    Best regards

    in reply to: Render custom post type custom field - Woocommerce #37313
    EliodataEliodata
    Participant

    Hi,
    Thank you for the support. Could you find the solution?
    Regards

    in reply to: Render custom post type custom field - Woocommerce #37008
    EliodataEliodata
    Participant

    I have the same issue using relationships addon. I tried bidirectionnal relationship between CPT and shop_order but still can't see order in the metabox select field.

    I installed posts 2 posts plugin (by scribu) with the same settings and it works. But I don't want to use another plugin. And I the relationship to work with admin column plugin, as metabox.io does.

    Do you have an idea to make this work please?

    in reply to: Render custom post type custom field - Woocommerce #36894
    EliodataEliodata
    Participant

    Hello,
    Thank you for the quick answer!

    I tried two snippets:

    
    add_action('init', 'wc_orders_public');
    function wc_orders_public() {
            global $wp_post_types;
            $wp_post_types['shop_order']->public = true;
    }
    

    and:

    
    add_action('init', 'wc_orders_public');
    function wc_orders_public() {
            global $wp_post_types;
            $wp_post_types['shop_order']->public = true;
            $wp_post_types['shop_order']->publicly_queryable = true;
            $wp_post_types['shop_order']->exclude_from_search = false;
            $wp_post_types['shop_order']->rewrite = true;
            $wp_post_types['shop_order']->query_var = 'shop_order';
    }
    

    But still doesn't work.

    Regards

    in reply to: Dynamic uploaded filename #34428
    EliodataEliodata
    Participant

    It's ok, thank you again!
    Last question... each time I send a file wordpress creates a new post with attached file. Is it possible to skip this?
    And the the uploaded file is renamed with the extension. myfile.png becomes username_myflie.png.png

Viewing 15 posts - 1 through 15 (of 32 total)