How to get more info to a relationship n:m

Support MB Relationships How to get more info to a relationship n:m

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #48391
    MKDevMKDev
    Participant

    HI!

    I have 2 cpts: teachers and courses with n:m relation.

    The teachers have different duties on different courses. So Mr. X has course 1 and is "Main Coordinator" and has course 2 where he is "Contact Person".

    How can I achieve that in Meta Box since afaik there is no further information to a relation possible?

    Only way I see is to have a n:m relation for each duty and have a query on the courses for all relations needed.

    #48394
    PeterPeter
    Moderator

    Hello,

    I understand that you want to display all the connection course posts of Mr. X teacher. You can use the function get_connected() to get the connection based on Mr. X post ID.

    Please follow the documentation https://docs.metabox.io/extensions/mb-relationships/#getting-connected-items

    Let me know if it helps.

    #48400
    MKDevMKDev
    Participant

    Hi, doesn't help me. Courses and teachers are already connected and it works fine. My problem are to link to the different duties they have in the different courses.

    I need a value for the relation and as far as i know MB can't. So I am looking for the best workaround to solve the problem.

    Table

    #48401
    MKDevMKDev
    Participant

    https://ibb.co/TqH5rLYC

    #48413
    PeterPeter
    Moderator

    Hello,

    Thanks for the details. I understand it based on the screenshot that you shared. Currently, the relation between two objects doesn't have extra value. It just has a connection A <-> B.

    If you want to set the extra value like that, I suggest you create a new CPT and set the connection between them. Refer to this topic https://support.metabox.io/topic/displaying-2-custom-post-types-via-a-relationship-custom-post-type/

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.