Support Forum ยป User Profile

Forum Replies Created

Viewing 5 posts - 241 through 245 (of 245 total)
  • Author
    Posts
  • in reply to: Author meta just showing numbers #33910
    YasmineYasmine
    Participant

    But the above is from the post field on the custom fields form. I also created a relationship between the user and university. And was actually not sure if this part was needed or not and how to tie it in:

    <?php
    add_action( 'mb_relationships_init', 'your_prefix_function_name' );
    
    function your_prefix_function_name() {
        MB_Relationships_API::register( [
            'id'         => 'relationship_user_university',
            'reciprocal' => true,
            'from'       => [
                'object_type' => 'user',
                'post_type'   => 'post',
                'taxonomy'    => 'category',
                'meta_box'    => [
                    'title' => 'user_to_university_relationship',
                ],
                'field'       => [
                    'name' => 'User to University Relationship',
                ],
            ],
            'to'         => [
                'object_type' => 'post',
                'post_type'   => 'university',
                'meta_box'    => [
                    'title' => 'university_to_user_relationship',
                ],
                'field'       => [
                    'name' => 'University to User Relationship',
                ],
            ],
        ] );
    }
    in reply to: Author meta just showing numbers #33909
    YasmineYasmine
    Participant

    Hi Long, yes of course (I deleted the other custom fields in group as was too long for this message to send)

    <?php
    add_filter( 'rwmb_meta_boxes', 'your_prefix_function_name' );
    
    function your_prefix_function_name( $meta_boxes ) {
        $prefix = '';
    
    $meta_boxes[] = [
        'title'  => __( 'Academic: Profile', 'your-text-domain' ),
        'id'     => 'academic_profile_group',
        'type'   => 'user',
        'fields' => [
            [
                'name'          => __( 'University', 'your-text-domain' ),
                'id'            => $prefix . 'academics_university',
                'type'          => 'post',
                'post_type'     => ['university'],
                'field_type'    => 'select_advanced',
                'required'      => true,
                'admin_columns' => [
                    'position'   => 'after',
                    'sort'       => true,
                    'searchable' => true,
                    'filterable' => true,
                ],
                'columns'       => 1,
            ],
    return $meta_boxes;
    }
    in reply to: Author meta just showing numbers #33900
    YasmineYasmine
    Participant

    Hello - I just wanted to elaborate a little further. As it is still not working, and I thought it would be easier to give a fuller picture:

    '<div>get_the_title( $university );
    $academics_university = rwmb_meta( 'academics_university' ); //maybe do I have to write its a custom field here?
    $academics_university = get_the_title( $university )</div>'

    To explain the above: $university is my custom post type. $academics_university is a custom relational post field saved to the user. I created one relationship between user and university too. It works on the backend.

    But I am trying to get the $university to show next to the author of a different cpt ($research). The author creates these posts and these posts are also connected to the user and to the university cpt. I believe I need to use the author meta option (on elementor pro template) with the meta key 'academics_university' - as the related post is saved to the user.

    Right now, the post ID shows. But I cannot get the university to show and link to the selected $university.

    I would really appreciate your advice how to do this! I am not a developer in any way (you can probably tell)

    in reply to: Author meta just showing numbers #33896
    YasmineYasmine
    Participant

    For example, would I write: get_the_title('university' $post) in the author meta option ?

    in reply to: Author meta just showing numbers #33895
    YasmineYasmine
    Participant

    Thanks - and do I add into the php code - or do I need to include into the shortcode on my template. Sorry - not sure where to add it!

Viewing 5 posts - 241 through 245 (of 245 total)