export e-mails

Home Forums Legacy Support 4.0 Bugs & Issues export e-mails

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #367062
    Zelimhan_46
    Participant
    I want to export the emails of students in a particular education. The solution in the link below does not work. https://wplms.io/support/knowledge-base/add-email-field-in-course-stats-to-download/ I will write the login information in the next message.
    #367063
    Zelimhan_46
    Participant
    This reply has been marked as private.
    #367094
    Veronica
    Moderator
    hi try to use exactly this one:
    
    add_action('wplms_course_stats_process','process_custom_course_stat',10,8);
    add_filter('wplms_course_stats_list','add_custom_course_stat');
    
     function add_custom_course_stat($list){
       $new_list = array(
                        'Identity Number'=>'Identity Number'
                         );
       
       $list=array_merge($list,$new_list);
        return $list;
    }
              
    function process_custom_course_stat(&$csv_title, &$csv,&$i,&$course_id,&$user_id,&$field,&$ccsv,&$k){
      if($field != 'Identity Number') // Ensures the field was checked.
         return;
    
        $title=__('Identity Number','wplms');
        if(!in_array($title,$csv_title))
         $csv_title[$k]=array('title'=>$title,'field'=>'Identity Number');
            $ifield = 'Identity Number'; 
        if(bp_is_active('xprofile'))
            $field_val= bp_get_profile_field_data( 'field='.$ifield.'&user_id=' .$user_id );
        if(isset($field_val) &&  $field_val){
          
                $csv[$i][]= $field_val;
                $ccsv[$i]['Identity Number'] =  $field_val;
           
        }else{
    
          $csv[$i][]= 'NA';
          $ccsv[$i]['Identity Number'] = 'NA';
        }
        
    
     }
    change Identity number with your field
    #367114
    Zelimhan_46
    Participant
    Hey Veronica, How can i find Identity number? can you help me with this too?
    #367162
    Zelimhan_46
    Participant
    Also, I guess there is no mail data in xprofile. It would be more correct to pull this mail data from wordpress's own system.
    #367207
    Veronica
    Moderator
    hi I said to change the Identity number with your field name like if you want to show email there then use this now:
    add_action('wplms_course_stats_process','process_custom_course_stat',10,8);
    add_filter('wplms_course_stats_list','add_custom_course_stat');
    
     function add_custom_course_stat($list){
       $new_list = array(
                        'email'=>'Email'
                        //add another element like same above 'user_field3'=>'Gender'
                         );
       
       $list=array_merge($list,$new_list);
        return $list;
    }
              
    function process_custom_course_stat(&$csv_title, &$csv,&$i,&$course_id,&$user_id,&$field,&$ccsv,&$k){
      if($field != 'email') // Ensures the field was checked.
         return;
    
        $title=__('Email','wplms');
    	if(!in_array($title,$csv_title))
    	 $csv_title[$k]=array('title'=>$title,'field'=>'Email');
    		$ifield = 'Email'; 
    		$user = get_user_by('id',$user_id);
    		
      	$field_val = $user->data->user_email;
       		
    	if(isset($field_val) &&  $field_val){
    	  
       		$csv[$i][]= $field_val;
          	$ccsv[$i]['Email'] =  $field_val;
    	   
        }else{
    
          $csv[$i][]= 'NA';
          $ccsv[$i]['Email'] = 'NA';
        }
    	
    
    }
    also refer: https://wplms.io/support/forums/topic/student-registration-2/
    #367251
    Zelimhan_46
    Participant
    it's working. I love you, team!
    #367286
    Veronica
    Moderator
    Hey, We aim to improve the usability of our customer’s web-sites and we are glad to have made a contribution. If you find our information to be helpful & you wouldn’t mind leaving a review, we would really appreciate that! Here: https://themeforest.net/item/wplms-learning-management-system/reviews/6780226 Thanks & Regards
Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘export e-mails’ is closed to new replies.