BuddyDev

Search

Replies

  • Participant
    Level: Enlightened
    Posts: 126
    Hervé on in reply to: filter the buddypress members in the list of members #13061

    Hello Brajesh,
    Have I explained better?
    Regards

  • Participant
    Level: Enlightened
    Posts: 126
    Hervé on in reply to: filter the buddypress members in the list of members #13014

    Hello Brajesh

    As in a dating site, each member has an xprofile field like “I am” and an xprofile field like “I’m looking for”
    Example Toto is a man and is looking for a woman
    It is necessary “right” in the query to extract the values ​​of the field I search =”F” (value of the field I am of the other members)
    Regards

  • Participant
    Level: Enlightened
    Posts: 126
    Hervé on in reply to: filter the buddypress members in the list of members #13012

    Hello,
    A little reminder because I can not do it and it becomes urgent
    Regards

  • Participant
    Level: Enlightened
    Posts: 126

    Hi,

    https://wordpress.org/plugins/activity-reactions-for-buddypress/
    I disabled this plugin that blocked me the display of page

  • Participant
    Level: Enlightened
    Posts: 126
    Hervé on in reply to: [Resolved] automatic change of type with Member Types Pro #11989

    Hi Brajesh

    1 / super

    2 / I understood that :-). My request was to put a variable in place to put at the beginning of the file, all my variables. Is it correct ?

    3 / when everything is good, there is a change of state of the member (role, type and plan). I did not say it at first because I thought to adapt my initial code. But it seems to me that this is the right place to put a do_action . Is it
    correct ?

    4 / I look at this. Probably I will need help to finalize the code … by paying

    Regards

  • Participant
    Level: Enlightened
    Posts: 126
    Hervé on in reply to: [Resolved] automatic change of type with Member Types Pro #11981

    Oups
    Sorry, I think the code on the forum is not working well.
    I copied it in https://gist.github.com/sbrajesh/238153f70f770f957fd1c4b2ba60be77

  • Participant
    Level: Enlightened
    Posts: 126
    Hervé on in reply to: [Resolved] automatic change of type with Member Types Pro #11980

    Hello Brajesh,

    Wow 🙂 , I did not expect such a complete program!!

    
    Some questions:
    1/ if there will be no conflict using the BP force profile plugin at the same time?
    
    It's a pretty different programming. To avoid breaking the code, I want to know where to put my codes
    
    2/ where put in variable of the type of member (not to forget it and ... no problem):
    $member_type_unique_name='membre0'; // ??????? OK ????????
    class BuddyDev_Profile_Field_Completion_Helper {
    ...
    public function set_custom_member_type( $user_id ) {
    		$append = false; // set it to true if you just want to append this member type.
    		bp_set_member_type( $user_id, $member_type_unique_name, $append ); 
    	}
    ...
    
    3/ when I switch from member type, I have to switch also with the armember plugin:
    	public function check_on_update( $user_id ) {
    		if ( $this->has_incomplete_profile( $user_id ) && $this->has_required_field_data( $user_id ) && $this->has_uploaded_avatar( $user_id ) ) {
    			$this->mark_complete_profile( $user_id );
    			do_action( 'buddydev_bp_user_profile_completed', $user_id );
    do_action( 'arm_apply_plan_to_member', 2, $user_id); // ??????? OK ????????
    		}
    	}
    
    4/ where put my message for mandatory fields not entered:
    public function has_required_field_data( $user_id ) {
    ...
    // not all fields are set.
    		if ( $count != count( $required_fields ) ) {
    			// unset flag.
    			delete_user_meta( $user_id, '_has_required_field_data' );
    ***********// ??????? OK ????????
                    $message = '[su_shadow style="horizontal"][su_note note_color="#ff6668" radius="5"]' .'(' . $xprofile_fields_count . __(' donnée(s) manquante(s)', 'bp-force-profile') . __('). Merci de compléter votre profil pour 						 devenir membre et accéder à toutes les fonctionnalités du site.', 'bp-force-profile') .'<br />Sauvegardez avant de passer à un autre onglet.';
                    $message .= '<ul">';
                    /*if (empty($picture)) {
                        $message .= '<li>Photo de profil</li>'; Texte de la note
                    }*/
                    if ($xprofile_fields_count > 0) {
                        foreach ($xprofile_fields as $field) {
                        	 $message .= '<li>' . $field->field_name . ' (Onglet: ' .$field->group_name . ') </li>';
                        }
                    }
                    $message .= '</ul>';                
                    echo  $message . '[/su_note][/su_shadow]';
    ***********
    

    Regards

    • This reply was modified 5 years ago by Brajesh Singh. Reason: updated to use backtick
  • Participant
    Level: Enlightened
    Posts: 126
    Hervé on in reply to: [Resolved] automatic change of type with Member Types Pro #11918

    Hello Brajesh,
    little reminder to see when you will be able to do it and if that can help me solve my problem ?
    Regards

  • Participant
    Level: Enlightened
    Posts: 126
    Hervé on in reply to: [Resolved] automatic change of type with Member Types Pro #11829

    Good evening Brajesh

    If there are few interested members, I do not know if it is necessary to make another plugin!
    In this case I would rather just need a function because my need is rather simple.
    I want to automatically change member type / role when the new member has a profile photo AND enter all required fields.
    [Otherwise, he does not have access to buddypress pages (and a wordpress page) but to all other pages, articles …]

    For now I use your plugin and the following code to display a message :

    `
    add_filter( ‘bp_force_profile_photo_skip’, ‘buddydev_skip_redirect_on_non_bp_pages’ );
    function buddydev_skip_redirect_on_non_bp_pages( $skip ) {/* voir plus tard si beson d’autoriser les membre0 a ne pas avoir de photos */
    if ( !is_buddypress() ) { // OR !is_page(‘tableau-de-bord’) NE FONCTIONNE PAS
    $skip = true;
    }
    return $skip;
    }

    add_action(‘bp_before_member_body’, ‘my_bp_before_member_body’, 10, 0);
    function my_bp_before_member_body()
    {
    if (is_user_logged_in())
    {
    $user_id = wp_get_current_user()->ID;

    if($user_id == bp_displayed_user_id())
    {
    global $wpdb;
    $bp_prefix = bp_core_get_table_prefix();
    $xprofile_fields = $wpdb->get_results(“SELECT xf.name field_name, xg.name group_name FROM {$bp_prefix}bp_xprofile_fields xf”
    . ” join {$bp_prefix}bp_xprofile_groups xg on xg.id = xf.group_id”
    . ” WHERE parent_id = 0 AND is_required = 1 AND xf.id NOT IN (SELECT field_id FROM {$bp_prefix}bp_xprofile_data WHERE user_id = {$user_id} AND value IS NOT NULL AND value != ”)”);
    $xprofile_fields_count = count($xprofile_fields);
    /*$picture = get_user_meta($user_id, ‘picture’);

    if (empty($picture)) {
    $xprofile_fields_count++;
    }*/

    if ($xprofile_fields_count > 0 ) { //|| empty($picture)
    $message = ‘[su_note note_color=”#ff6668″ radius=”5″]’ .'(‘ . $xprofile_fields_count . __(‘ donnée(s) manquante(s)’, ‘bp-force-profile’) . __(‘). Merci de compléter votre profil pour devenir membre et accéder à toutes les fonctionnalités du site.’, ‘bp-force-profile’) .'<br />Sauvegardez avant de passer à un autre onglet.’;
    $message .= ‘<ul”>’;
    /*if (empty($picture)) {
    $message .= ‘<li>Photo de profil</li>’; Texte de la note
    }*/
    if ($xprofile_fields_count > 0) {
    foreach ($xprofile_fields as $field) {
    $message .= ‘<li>’ . $field->field_name . ‘ (Onglet: ‘ .$field->group_name . ‘) </li>’;
    }
    }
    $message .= ‘</ul>’;
    echo $message . ‘[/su_note]’;
    }
    }
    }
    }
    `

  • Participant
    Level: Enlightened
    Posts: 126
    Hervé on in reply to: bp-featured-members #11828

    re
    Sorry but by connecting, I posted in the wrong category