Forum Replies Created
-
AuthorPosts
-
March 22, 2022 at 10:26 PM in reply to: Is it Possible to Have Relationship Metabox Editable Only on One Side? #35213
[email protected]
ParticipantHi Long,
OK, I will use the code, but HOW should I do this? Do I need to remove the orginal relationship from the GUI and start from the scratch or can I use some code to change only this option separately?
Thanks
PetrMarch 22, 2022 at 1:43 AM in reply to: Is it Possible to Have Relationship Metabox Editable Only on One Side? #35185[email protected]
ParticipantHello Long,
Thank you, I'll will try it, but first I have to say, that I'm usig GUI for creating the relationship. Since there's (probably) not a field for this parameter in there, how should I update my relationship settings? Or do I have to register this relationship only by code?
Thanks
PetrMarch 21, 2022 at 6:57 AM in reply to: Is it Possible to Have Relationship Metabox Editable Only on One Side? #34689[email protected]
ParticipantHi Long,
I must be very bad at explaining my questions... I clearly stated, that I want to show the metabox in both CPTs. I only want one of them to be disabled for editing. Again, I want to SEE them both, but I don't want to EDIT one of them.
Thanks again
PetrMarch 19, 2022 at 2:20 AM in reply to: ✅How to Insert/Edit Relationship Field Manually? What's this Field ID? #34601[email protected]
ParticipantHi Long,
thanks for your reply, it seems to be working now.
Just a little additional question: is it necessary to use the $order_from and $order_to?
I'm using this code and it seems to be working fine:
MB_Relationships_API::add( $postId, $termId, 'termin-pro-prihlasku');Thanks
Petr[email protected]
ParticipantHi Long,
Today I've updated to MB 5.6.1 and it seems the diacritic is OK now.
The only item in the change log is "Fix compatibility for PHP < 7.3", could it be related?
My test site is on localhost, PHP 7.2.1 (I wasn't it using it much lately, so I was lazy to update it).
Thanks
Petr[email protected]
ParticipantHi Long,
Oh, I probably didn't make myself clear enough - the problem wasn't with the names of the posts. The issue showed up only in placeholders displaying the name of the CPTs.
Please check it out here:
https://www.blackeye.cz/metabox/placeholders.pngThanks
PetrMarch 8, 2022 at 7:12 AM in reply to: ✅How to Insert/Edit Relationship Field Manually? What's this Field ID? #34378[email protected]
ParticipantHi Long,
Well, to be honest, I did expect something more specific than a link to the superlong documentation on how to CREATE the relationship table.
Again, I wanted to EDIT the connection of already created relationship. I have created the relationship named "termin-pro-prihlasku" which interconnects 2 CTPs "courses" and "atendees".
In ACF it's quite straightforward, it's basically the same like editing all the other custom fields:
update_field('relationship_field', $value, $post_id);
After reading several pages of the documentation I've found the single line of code with very little explanation:
MB_Relationships_API::add( $from, $to, $id, $order_from = 1, $order_to = 1 );
It is based in the section here: https://docs.metabox.io/extensions/mb-relationships/#creating-connections-programmatically (in fact, this was the link, I was looking for).
Could you give me some example on how to uses it?
- Does it work only for creating the new relationships?
- What if I want to CHANGE some existing relationship?
- What are the two "$order" parameters for?Thanks again
PetrMarch 4, 2022 at 5:13 PM in reply to: ✅How to Insert/Edit Relationship Field Manually? What's this Field ID? #34304[email protected]
ParticipantHi Long,
OK, forget about the Fluent Forms.
How can I, on my own, edit the relationship field manually using PHP code?Thanks
PetrMarch 3, 2022 at 6:15 PM in reply to: ✅How to Insert/Edit Relationship Field Manually? What's this Field ID? #34266[email protected]
ParticipantOh,
I've just made a discovery about the MB Frontend form - there must not be the spaces between the multiple IDs in the shortcode, only comas. (Despite the instruction you have made here https://support.metabox.io/topic/mb-relationships-mb-frontend-submission/#post-24285).
This shortcode works fine:
[mb_frontend_form id="prihlasky,termin-pro-prihlasku_relationships_to"](Yes, it turned out, I have to use TO not FROM - this part is still a bit confusing to me, it's really unintuitive to find out, which is which).
So, at least I can do it via MB Frontend. But I would really like to use Fluent Forms, because of it's other features. Is it possible to map the relationship there? Does the relationship field have its record in the wp_postmeta table? Or am I able to at least populate it via some helper PHP function?
Thanks
PetrMarch 3, 2022 at 5:57 PM in reply to: ✅How to Insert/Edit Relationship Field Manually? What's this Field ID? #34265[email protected]
ParticipantHi Long,
I'm afraid, I cannot make it work, neither in the MB Frontend Submission form, nor in the Fluent Forms.
If my relationship ID is termin-pro-prihlasku and I want to use the From metabox, what should be the shortcode for the form?
I've tried this:
[mb_frontend_form id="prihlasky, termin-pro-prihlasku_relationships_from"]and even this (in case I didn't comprehend the instructions):
[mb_frontend_form id="prihlasky, {$termin-pro-prihlasku}_relationships_from"]But all I can see is the content of the "prihlasky" metabox.
And is it possible to access the relationship metafield directly, as I could the normal metafield for example the one with the ID course_term? I can map the normal fields in the Fluent forms, but not the relationship.
Can you please give me some further advice?
Thanks
Petr[email protected]
ParticipantHi Long,
Well I know, I can do everything you mentioned, I wanted to know, how to do it the best way possible. Let mi phrase my questions differently then:
1. More interactive connections between related CPTs
Is there a way I can add and edit records from other related CPTs within the parent CPT? Basically I want my Terms table for each Course to behave the same way like a qroup field repeater - while editing the Course I want to flawlessly add and edit its Terms.2. Differences between custom fields settings
Do these custom fields settings make any difference for the query efficency (especially concerning the group clones)?
- Save data in a custom table
- Clone as multiple3. How to output group field data in the admin table column?
As I mentioned before, I didn't succeed in outputting the group subfields to the admin column. The only output was several lines of the word "Array" (the number of lines coredponded with the group clones). How should I setup my settings?Concerning the queries: I need to query and filter almost everything:
- all courses including terms
- available terms for the course
- available places for the course
- terms and courses by the place
- atendees belonging to the course
- atendees belonging to the term of the course
- atendees belonging to the place
etc...And yes - there might be some taxonomies belonging to the terms itselves (like one-day, weekend, semestral, ...). So I should probably go with Terms as CPT, but editing them outside the parent Course would be highly confusing for the editors. How to deal with this?
Thanks
Petr[email protected]
ParticipantSorry for this post, I had some troubles posting my other topic and I wasn't sure wheather I was alowed to post a support questions here.
-
AuthorPosts