Replies
- Hervé on March 29, 2018 at 1:26 pm in reply to: filter the buddypress members in the list of members #14159
Hello Brajesh
form#profile-edit-form div.editfield.field_503 {display:none!important} /* masque le champ 503 (onglet apparence) */ tr.field_503 {display:none!important}
I think I css them are good!?
I submit the change. It must be understood that your code works well. This is your warning that I would not want to have a problem later
Regards
add_action( ‘bp_pre_user_query_construct’, ‘buddydev_filter_members_list_herve’, 0 ); function buddydev_filter_members_list_herve( $query ) { if ( bp_is_members_directory() ) { ////////////////////// bp_is_members_directory() if ( ! is_user_logged_in() ) { return; } ... /* EX buddy a $user_id = get_current_user_id(); // get the value for the field. // Use field id for better performance. $searching_for = xprofile_get_field_data( ‘I search’, $user_id, ‘comma’ ); */ if ( empty( $recherche_de ) ) { return; } /////////////////////////////******************if ( bp_is_user_friends() ) { return;// do not filter on the friends page. It will be problemetic as it won’t filter the widget/shortcode on the friends page. } *********************//////////////////////// $xprofile_query = isset( $query->query_vars[‘xprofile_query’] ) ? $query->query_vars[‘xprofile_query’] : array(); $xprofile_query[] = array( ‘field’ => $field_jesuis, ‘value’ => $recherche_de, ‘compare’ => ‘=’, ); //photo_priorite $xprofile_query[] = array( ‘field’ => ‘photo_priorite’, ‘value’ => 3, ‘compare’ => ‘>=’, ‘type’ => ‘NUMERIC’, ); if ( ! empty( $xprofile_query ) ) { $query->query_vars[‘xprofile_query’] = $xprofile_query; } return $query; } ////////////////////// bp_is_members_directory() END }
- Hervé on March 28, 2018 at 12:09 pm in reply to: [Resolved] automatic change of type with Member Types Pro #14142
Thank you for this help too
Previous post to delete because I was wrong wire - Hervé on March 28, 2018 at 12:08 pm in reply to: filter the buddypress members in the list of members #14141
Hello Brajesh
Another big thank you for the help given.
For the masking of the field, it is only possible to restrict the display of the field to “me” (to my knowledge with buddypress). There is a plugin (obsolete) https://fr.wordpress.org/plugins/buddypress-admin-only-profile-fields/ so that the administrator is the only person who sees it but I still have the masking by css
For the filling, I’m looking but not sure that I can do it with a single request!
As I did not understand in the code, the warning that there could be a problem “do not filter on the friends page. It will be problemetic as it won’t filter the widget/shortcode on the friends page”. I wonder if this could improve the code
add_action( ‘bp_pre_user_query_construct’, ‘buddydev_filter_members_list_herve’, 0 );
function buddydev_filter_members_list_herve( $query ) {
if ( bp_is_members_directory() ) { ////////////////////// bp_is_members_directory()
if ( ! is_user_logged_in() ) {
return;
}$user_id = get_current_user_id();
$field_jesuis = ’57’;
$field_jerecherche = ’60’;
$recherche_de = xprofile_get_field_data( $field_jerecherche, $user_id );/* EX buddy a $user_id = get_current_user_id();
// get the value for the field.
// Use field id for better performance.
$searching_for = xprofile_get_field_data( ‘I search’, $user_id, ‘comma’ ); */if ( empty( $recherche_de ) ) {
return;
}/////////////////////////////******************if ( bp_is_user_friends() ) {
return;// do not filter on the friends page. It will be problemetic as it won’t filter the widget/shortcode on the friends page.
} *********************////////////////////////$xprofile_query = isset( $query->query_vars[‘xprofile_query’] ) ? $query->query_vars[‘xprofile_query’] : array();
$xprofile_query[] = array(
‘field’ => $field_jesuis,
‘value’ => $recherche_de,
‘compare’ => ‘=’,
);//photo_priorite
$xprofile_query[] = array(
‘field’ => ‘photo_priorite’,
‘value’ => 3,
‘compare’ => ‘>=’,
‘type’ => ‘NUMERIC’,
);if ( ! empty( $xprofile_query ) ) {
$query->query_vars[‘xprofile_query’] = $xprofile_query;
}
return $query;} ////////////////////// bp_is_members_directory() END
}Regards
- Hervé on March 26, 2018 at 1:32 pm in reply to: filter the buddypress members in the list of members #14111
Hello Brajesh
Great 🙂 , it seems to work on the test site.
I need on the production site to create a xprofle field and fill it for everyone to 3 (I mean by sql!?) Because otherwise it does not workSince this is not a member-managed field.
How can I hide this field for members when viewing their profile?Regards
- Hervé on March 23, 2018 at 2:12 pm in reply to: [Resolved] automatic change of type with Member Types Pro #14062
Hello Brajesh
Ok, it’s not very urgent because it works for now. It is not worth working on a big development to solve this problem.
If there is not a simple function to hide the “delete my photo” button, I will set up a css
Regards - Hervé on March 21, 2018 at 4:17 pm in reply to: filter the buddypress members in the list of members #14002
Hello Brajesh
little reminder
Thank you - Hervé on March 21, 2018 at 4:15 pm in reply to: [Resolved] automatic change of type with Member Types Pro #14001
Hello Brajesh
Is there a possibility to hide the “remove” button by program (hook)?
otherwise I look to do it with css (less well I do)!
Regards - Hervé on March 19, 2018 at 3:05 pm in reply to: [Resolved] automatic change of type with Member Types Pro #13965
Hello Brajesh
Yes I understand. I explain the context:
I want to force a new member to fill out mandatory fields and upload a profile picture.
* If ok role change: member0 (plan0 with another plugin)
* Otherwise role subscriberWith a member management plugin:
* If role subscriber: he can not have access to some pages (including groups, activity …)If he changes his picture no change to the wordpress role
If it removes the photo back to the subscriber roleI have an error:
Parse error: syntax error, unexpected ‘public’ (T_PUBLIC), expecting end of file in/
public function log_deleted( $args )I submitted last version on gist
If too difficult, is there a way to remove with a hook the button “delete the photo” if not by css
Regards
- Hervé on March 19, 2018 at 10:54 am in reply to: [Resolved] automatic change of type with Member Types Pro #13955
Hi Brajesh,
OK it works, unfortunately if the member deletes his picture, his role is not changed to “subscriber”
Is it possible to tell when a member changes their photo or deletes their photo?
If it’s not possible, I stay with this mofiication
Regards - Hervé on March 16, 2018 at 4:51 pm in reply to: [Resolved] automatic change of type with Member Types Pro #13881
Re
I believe this comes from the code, to handle the case where the member removes his photo :public function mark_incomplete_profile( $user_id ) { do_action( 'arm_apply_plan_to_member', 1, $user_id); // 10/01/18: HD AJOUT pour rejoindre plan sans profil finalisé (& role: subscriber) return delete_user_meta( $user_id, '_has_complete_profile' ); }
If a member changes their profile picture, does buddypress use an event believing that the profile picture has been deleted?
This request is more important than my other request because there are several people who have seen their role / plan changed abnormally
Regards