Hello Brajesh,
Sorry I’m coming back to you because I want to use a payment form. I’m in contact with the developer but it seems like there may be an init or something missing for it to work properly
In connection with the post https://buddydev.com/support/forums/topic/featured-member-time-limit-option/page/3/bp_featured_members () -> add_user (18);
yes works outside the function
no does not work in the functiondo_action( 'super_after_paypal_ipn_payment_verified', 'ajout_membre_a_la_une_apres_paiement'); function ajout_membre_a_la_une_apres_paiement(){ $custom = $_POST['custom']; $custom = explode('|', $custom); $form_id = $custom[0]; $user_id = absint($custom[5]); // get_current_user_id () ne fonctionnera pas, car ce n'est pas une requête provenant de l'utilisateur, mais du serveur paypal. // if ( ($form_id==4769) && (page(3579)) ){ // super-forms: paiement pour mise à la une membre ET page: tableau de bord bp_featured_members()->add_user(18); // $user_id // bp_featured_members()->add_user(get_current_user_id()); // } }
Hi,
Excerpts from our last 2 exchanges with the developer of paypal payment which also works:
…
dev:
Ok so in both situations the email was sent, which is good,
So I just believe that the BP function is not initialized at that moment / point in time.I think you should test the code with a prefixed user ID, and see if it works outside of the hook itself.
So something like this directly in the functions.php but most likely you have to do it in a “init” hook (not sure I would check BP docs for this).bp_featured_members () -> add_user (1234);
But it is working, except the bp_featured_members () function itself.
…Me:
bp_featured_members () -> add_user (18);
yes works outside the function
no does not work in the functiondev:
…
It means that the function is defined at that stage.The hook is triggered by “parse_request” action of wordpress core.
It is triggered probably before that function is defined.
Hi Herve,
I am sorry but I don’t understand the question.
If you are asking whether the function ‘bp_featured_members’ is available on ‘parse_request’ action, then I can assure that it is.
‘parse_request’ is not an early action, the function is available from very early action(anything after ‘plugins_loaded’ ).
If you are using get_current_user_id() then it is only available on init(which means, It will work fine on parse_request).
Please post me the error log if you have and I can get some idea.
Regards
BrajeshHi Brajesh,
Thank you for answering me. I do not see any errors in the logs, unfortunately.
Objective: the member pays with paypal IPN.
At the end of the payment, it is automatically switched to “featured member”What works
payment with tag “paid in the payment plugin
the passage has “featured member” outside the function of the payment pluginThe developer (after several days of advice) asks me to see you.
I hope you have an ideaHi Herve,
Can you please point me to the code and the hook that is being used to process the IPN. I am sure it is an issue with the payments plugins. Most probably they are either doing it too early or not even loading WordPress.
Please link me and I will assist.
Thank you
BrajeshHi Herve,
I have received it. I will check it tonight/tomorrow and assist you latest by Monday(or before).Thank you
BrajeshSorry, I did not read your code earlier.
The other plugin is fine.
You should change this
do_action( 'super_after_paypal_ipn_payment_verified', 'ajout_membre_a_la_une_apres_paiement');
to
add_action( 'super_after_paypal_ipn_payment_verified', 'ajout_membre_a_la_une_apres_paiement');
In your code and it will work.
Hi Brajesh,
In progress 🙂
It works after payment if I put:
bp_featured_members()->add_user(18));
It does not work by automating:
a) bp_featured_members()->add_user(get_current_user_id());
OR
b)
$user_id = absint($custom[5]);
bp_featured_members()->add_user($user_id);Regards
add_action( 'super_after_paypal_ipn_payment_verified', 'ajout_membre_a_la_une_apres_paiement'); function ajout_membre_a_la_une_apres_paiement(){ $custom = $_POST['custom']; $custom = explode('|', $custom); $form_id = $custom[0]; // $user_id = absint($custom[5]); // get_current_user_id () ne fonctionnera pas, car ce n'est pas une requête provenant de l'utilisateur, mais du serveur paypal. // if ( ($form_id==4769) && (page(3579)) ){ // super-forms: paiement pour mise à la une membre ET page: tableau de bord //bp_featured_members()->add_user($user_id); // $user_id bp_featured_members()->add_user(get_current_user_id()); // } }
The topic ‘ [Resolved] paiement with featured Member’ is closed to new replies.