Hack wordpress and Pods
-
hi!
I am a developer who has been discovering wordpress for some time now but I am not an engineer so I try to manage as I can as I learn and discover wordpress. So I tinker as much as I can to achieve my goals
My problem is quite simple.
I have to develop a slightly special sponsorship system because I have to respect certain constraints…
One person can sponsor another and both benefit from a 50€ discount. only his 50€ are cumulative for the sponsor and are unlocked when the godchild has booked and exceeded the legal cancellation and withdrawal periods.
I use the event manager eventmanagement plugin that I have already adapted a lot to my needs. this plugin has a very simple discount coupon system that I use to make people benefit from its 50th discount. only you can’t use several discount coupons when booking…
If I want to allow the sponsor to accumulate on a single discount voucher several referral referrals, and benefit from a greater discount when booking a training course, I am obliged to develop a separate system.
So that the sponsor can send his discount voucher to a godchild, I use a formidablesforms form.
This allows you to save the entries of this form while also saving them in a CPT. This allows me to record other data for each entry of the form.
When validating this form, I wrote a script in php that creates a record in the discount coupon table of the eventsmanager plugin.
After the legal cancellation and withdrawal periods, I run a script in php that looks for the discount coupons used by godchildren, and I look for whether a discount coupon already exists for the godchild’s godfather.
If this is the case and if it has not already been used, I add this amount to the amount of the discount coupon found.
Otherwise, in any case, I create a new one.This is where I need to create another CPT that allows me to store the coupons generated by this script with other information to allow me to link the discount coupon assigned to the sponsor, to the discount coupons that he sent to his godchildren… this in order to keep a history of operations!
I can do all this very well except that when I want to save a value for the link menu popup with the first CPT, it does not appear as an element selected in the popup menu…
No matter how much I search the wordpress database, I can’t find what would make this link appear well in the ppopup menu.I noticed that the item selected in the popup field was saved in the postmeta table with as meta_value, a serialization with the ID of the CPT record (for example {i:0;i:1049;} ).
I also noticed that the link between the fields of the two CPTs was recorded in the podsrel table.
All this does not change the fact that when I open one of the records of the second cpt, the link field does not automatically select the corresponding record of the first…
Is there anything more mysterious I would have to do to make it work?
The topic ‘Hack wordpress and Pods’ is closed to new replies.