Can we hide a student profile from search results

Home Forums Legacy Support Support queries How-to & Troubleshooting Can we hide a student profile from search results

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #371116
    Adam
    Spectator
    For example, a student is subscribed to an instructor's course and the instructor can search that student and easily find him/her. This is working. But is it possible, if a student hide from search engine and then noone will find him only the courses he subscribed/purchased then only those instructors can find him? Currently in extended profile tab in user profile in wordpress dashboard, we can hide/show few fields of each user for example, sex, email, phone etc. But we dont see any option to completely hide the profile from public search or if anyone searches from PWA dashboard. Our site is: https://www.hublearn.com/
    #371120
    MrVibe
    Keymaster
    if you can share screenshots on which all places you need exclusion then we can give you a fix.
    #371145
    Adam
    Spectator
    https://screencast-o-matic.com/watch/crQYQvV6F6f
    #371260
    Anshuman Sahu
    Keymaster
    Yes you are right the profile field visibility settings are not saving . Adding to issue log : https://trello.com/c/Ool5gqYB actually the profile field visibility settings saves automatically when you change its value . that save changes button is just for email and password update . The search and select the zoom meeting form is there when you want to share meeting with specific persons and for that , that search is provided .It has nothing to do with the profile field visibility settings . We have to check if we can limit the search results or not checking the visibility .
    #371272
    Adam
    Spectator
    What we want is if I hide my profile then no one can find me. From profile settings, if i hide myself then in meeting search field if someone types my name, name shouldnt be found. Is it possible ?
    #371445
    Anshuman Sahu
    Keymaster
    please try adding this given code in your wplms-customizer.php file in wplms customizer plugin :
    
    add_Action('template_redirect',function(){
      $user_id = bp_displayed_user_id();
      $meta = get_user_meta($user_id,'bp_xprofile_visibility_levels',true);
      if(!empty($meta) && !empty($meta[1]) && $meta[1]=='adminsonly'){
        wp_die('Profile cannot be accessed');
      }
    },1);
    #371454
    Adam
    Spectator
    Can I add this code in functions.php file of our child theme ?
    #371475
    Anshuman Sahu
    Keymaster
    Yes that will also do the trick and on updates your code wont lost .
    #371505
    Adam
    Spectator
    I tested the code but it does not work as we wanted. What it does it blocked to view the user profile but their name can be searched. In PWA dashboard in profile field visibility settings, we can set the name: Only me. It means only that profile can view their profile whick works. https://www.awesomescreenshot.com/image/13977949?key=fc87f5604db705b68e3c14a20e8f3b45 But when we search by their name from the admin/instructor PWA dashboard, for example in zoom meeting section, their name shows up when we type their name. It means their name is public. We don't want that. Can you please have a look ?
    #371669
    Anshuman Sahu
    Keymaster
    Please also add this code : please try adding this given code in your wplms-customizer.php file in wplms customizer plugin :
    
    add_filter('vibe_zoom_search_sharing_values',function($return,$request){
        if(!empty($return['values'])){
            $args = json_decode($request->get_body(),true);
            if(!empty($args['shared_type'])){
                $scope = $args['shared_type'];
                if($scope=='shared'){
                    $new_results = [];
                    foreach($return['values'] as $k=> $v){
                        $meta = get_user_meta($v,'bp_xprofile_visibility_levels',true);
                        if(!empty($meta)){
                            if(!empty($meta) && !empty($meta[1]) && $meta[1]=='adminsonly'){}else{
                                $new_results[] =  $v;
                            }
                        }
                    }
                    $return['values'] = $new_results;
                }
            }
        }
    
        return $return;
    },10,2);
    #371685
    Adam
    Spectator
    this code even hide all users from zoom (shared with) field. Can't find any user when typing their names. After I remove the above code, then i can find all users even the user name is private. So its not working.
    #371727
    Anshuman Sahu
    Keymaster
    sorry please try this code ,I tested this :
    add_filter('vibe_zoom_search_sharing_values',function($return,$request){
        if(!empty($return['values'])){
            $args = json_decode($request->get_body(),true);
            if(!empty($args['shared_type'])){
                $scope = $args['shared_type'];
                if($scope=='shared'){
                    $new_results = [];
                    foreach($return['values'] as $k=> $v){
                        $meta = get_user_meta($v['id'],'bp_xprofile_visibility_levels',true);
                        if(!empty($meta) && !empty($meta[1]) && $meta[1]=='adminsonly'){}else{
                            $new_results[] =  $v;
                        }
                    }
                    $return['values'] = $new_results;
                }
            }
        }
    
        return $return;
    },10,2);
    #371731
    Adam
    Spectator
    Thank You its now working.
    #371780
    Veronica
    Moderator
    good to know closing this one
Viewing 14 posts - 1 through 14 (of 14 total)
  • The topic ‘Can we hide a student profile from search results’ is closed to new replies.