Replies
- This reply has been marked as private.
- This reply has been marked as private.
Hello Brajesh
Little reminder
If it was possible
RegardsHello Brajesh,
little reminder
have a good day
RegardsHello Brajesh,
I’m not sure I understood correctly, but I put the complete code of your add-on: BuddyPress Member Featured Expirable Membership Addon
RegardsHi Brajesh,
Ah ok thank you for all these details.
I shared the current code:
https://pastebin.com/13kNA2x8I would have liked to have a different time depending on the role WP if I activate manually clicking on the button “set featured”. If it’s too complicated, I give up this option (or I’ll put a common time for any manual activation)
RegardsHi Brajesh,
Actually, I want to assign the number of days based on the WP role and gender of the member. Why it is not possible?
If this is not possible, do you have any idea of another solution?
Regards- Hervé on September 17, 2018 at 10:04 am in reply to: [Resolved] paiement with featured Member #17421
Hi
The addition is working well now.
I am now trying to make the setting in your function function get_interval ()As the cases are spread over several days. I have a function (determine_temps_mise_en_avant) to see in debug.log if _paid_featured has changed in value.
By visiting the page where the widget is located, I execute my function and I see the value of _paid. It seems to me that it’s goodI would like in your get_interval function that I also record _paid_featured and other variables in debug.log Out of it’s empty
I think in your function I do not yet have to get the good value user_idprivate function get_interval() { ... $user_id = bp_loggedin_user_id(); $jesuis = xprofile_get_field_data($field_jesuis,$user_id ); $user_info = get_userdata($user_id); $meta_paie = get_user_meta( $user_id, _paid_featured , true); if ($meta_paie=='1'){ ... error_log ("APRES DESACTIV.". $varHD); return $nbr_jour_a_la_une * DAY_IN_SECONDS; ...
Outside this is not the case. I think in your function I do not yet have to get the good value user_id
[12-Sep-2018 09:04:58 UTC] APRES DESACTIV.user_id: 0!!!<br>jesuis: ??? <br>meta_paie: ???Regards
Hello Brajesh
Have you seen a solution to recover the settings in your function
RegardsHello Brajesh
I will try to explain better!
Overall it works.
After payment a member is deactivated after a time.
I wanted to improve the code by varying the connection time according to criteria
My problem is that I try to test the different cases and it is very long. I found it interesting to use debug.log to see variables including meta_user. Maybe still improve by sending me an email onprivate function get_interval() { $nbr_jour_a_la_une='0'; $field_jesuis = '23'; //57 $user_id = bp_loggedin_user_id(); $jesuis = xprofile_get_field_data($field_jesuis,$user_id ); $user_info = get_userdata($user_id); $user_roles = isset($user_info->roles)?$user_info->roles:array(); $meta_paie = get_user_meta( $user_id, _paid_featured , true); if ($meta_paie=='1'){ // utilisateur payant if ( ($jesuis=='Une femme') AND (in_array('membre1', $user_roles)) ){$nbr_jour_a_la_une='8'; } if ( ($jesuis=='Une femme') AND (in_array('membre0', $user_roles)) ){$nbr_jour_a_la_une='7'; } if ( ($jesuis=='Un homme') AND (in_array('membre1', $user_roles)) ){$nbr_jour_a_la_une='6'; } if ( ($jesuis=='Un homme') AND (in_array('membre0', $user_roles)) ){$nbr_jour_a_la_une='5'; } } else { if ( ($jesuis=='Une femme') AND (in_array('membre1', $user_roles)) ){$nbr_jour_a_la_une='4'; } if ( ($jesuis=='Une femme') AND (in_array('membre0', $user_roles)) ){$nbr_jour_a_la_une='3'; } if ( ($jesuis=='Un homme') AND (in_array('membre1', $user_roles)) ){$nbr_jour_a_la_une='2'; } if ( ($jesuis=='Un homme') AND (in_array('membre0', $user_roles)) ){$nbr_jour_a_la_une='1'; } } $varHD.= "user_id: ".$user_id; $varHD.= "<br>jesuis: " .$jesuis; $varHD.= "<br>meta_paie: " .$meta_paie; error_log ("APRES DESACTIV.". $varHD); return $nbr_jour_a_la_une * DAY_IN_SECONDS; // 1 jour }
In order to see if the removal of the highlight is functional, I made a function
add_action('get_header', 'determine_temps_mise_en_avant'); function determine_temps_mise_en_avant() { if (is_page(26) AND is_user_logged_in()) { $user_id = bp_loggedin_user_id(); $field_jesuis = '23'; //57 $jesuis = xprofile_get_field_data($field_jesuis,$user_id ); // $user_id ); $user_info = get_userdata($user_id); $user_roles = isset($user_info->roles)?$user_info->roles:array(); $varHD.= "user_id: ".$user_id; $varHD.= "<br>jesuis: " .$jesuis; $meta_paie = get_user_meta( $user_id, _paid_featured , true); $varHD.= "<br>meta_paie: " .$meta_paie; $nbr_jour_a_la_une='00'; if ($meta_paie=='1'){ // utilisateur payant if ( ($jesuis=='Une femme') AND (in_array('membre1', $user_roles)) ){$nbr_jour_a_la_une='8'; } // si membre de base ET une femme $user->has_cap('membre0') if ( ($jesuis=='Une femme') AND (in_array('membre0', $user_roles)) ){$nbr_jour_a_la_une='7'; } // si membre de base ET une femme $user->has_cap('membre0') if ( ($jesuis=='Un homme') AND (in_array('membre1', $user_roles)) ){$nbr_jour_a_la_une='6'; } // si membre de base ET une femme $user->has_cap('membre0') if ( ($jesuis=='Un homme') AND (in_array('membre0', $user_roles)) ){$nbr_jour_a_la_une='5'; } // si membre de base ET une femme $user->has_cap('membre0') } else { if ( ($jesuis=='Une femme') AND (in_array('membre1', $user_roles)) ){$nbr_jour_a_la_une='4'; } // si membre de base ET une femme $user->has_cap('membre0') if ( ($jesuis=='Une femme') AND (in_array('membre0', $user_roles)) ){$nbr_jour_a_la_une='3'; } // si membre de base ET une femme $user->has_cap('membre0') if ( ($jesuis=='Un homme') AND (in_array('membre1', $user_roles)) ){$nbr_jour_a_la_une='2'; } // si membre de base ET une femme $user->has_cap('membre0') if ( ($jesuis=='Un homme') AND (in_array('membre0', $user_roles)) ){$nbr_jour_a_la_une='1'; } // si membre de base ET une femme $user->has_cap('membre0') } $varHD.= "<br>nbr_jour_a_la_une: " .$nbr_jour_a_la_une; // echo $varHD; error_log ($varHD); } }
In debug.log, I see 2 things.
after deactivation, I did not contain in my variables[12-Sep-2018 09:04:58 UTC] APRES DESACTIV.user_id: 0<br>jesuis: <br>meta_paie:
after refreshing the page, I still have _paid. This one may not have been disabled by !!
[12-Sep-2018 09:04:58 UTC] AttenduTableau: user_id: 3<br>jesuis: Un homme<br>meta_paie: 1<br>nbr_jour_a_la_une: 6
I hope it helps
Regards