Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)

  • howsepa
    Participant

    @howsepa

    Sorry should have included full function…

    
    //Catch messages on successful login
        function login_action($user_login)
        {
    
            $userdata = get_user_by('login', $user_login);
    
            $uid = ($userdata && $userdata->ID) ? $userdata->ID : 0;
    
            $data[$this->data_labels['login']] = ( 1 == $this->login_success ) ? $this->data_labels['Successful'] : $this->data_labels['Failed'];
            if ( isset( $_REQUEST['redirect_to'] ) ) { $data[$this->data_labels['login Redirect']] = esc_attr( $_REQUEST['redirect_to'] ); }
            $data[$this->data_labels['User Agent']] = esc_attr( $_SERVER['HTTP_USER_AGENT'] );
    
            $serialized_data = serialize($data);
    
            //get user role
            $user_role = '';
            if( $uid ){
                $user = new WP_User( $uid );
                if ( !empty( $user->roles ) && is_array( $user->roles ) ) {
                    $user_role = implode(', ', $user->roles);
                }
            }
    		$current_user = wp_get_current_user();
    		$user_email = $user->user_email;
    	
    
    		$real_client_ip_address = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? esc_attr($_SERVER['HTTP_X_FORWARDED_FOR']) : esc_attr($_SERVER['REMOTE_ADDR']);
    		
    
    		$guest_ip   = $visitor_location['IP'];
    		$guest_country = "";
    		$guest_city  = "";
    		$guest_state = "";
    		$user_info = get_userdata($uid);
            $USErname =  $user_info->first_name .  " " . $user_info->last_name;
            
    		
    
    			
    		global $bp;
    		
    		$group =  get_group_ids( bp_loggedin_user_id() );
            
    		$values = array(
                'uid'           => $uid,
                'user_login'    => $user_login,
                'user_role'     => $user_role,
    			'user_email'		=> $user_email,
                'time'          => current_time('mysql'),
                'ip'            => isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? esc_attr($_SERVER['HTTP_X_FORWARDED_FOR']) : esc_attr($_SERVER['REMOTE_ADDR']),
    			'country'       => $guest_country,
    			'city'			=> $guest_city,
                'login_result'  => $this->login_success,
                'data'          => $serialized_data,
    			'name'			=> $USErname,
    			'group'			=> $group
                );
    
            $format = array('%d', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s','%s','%s');
    
            $this->save_data($values, $format);
        }
    

    howsepa
    Participant

    @howsepa

    Another option….

    If this wont work – i could also use custom fields in the extended profile feature of buddypress and set up a field to contain this ‘category’ information.

    Either would work.. but need to store a category for each user and capture this as they log in.


    howsepa
    Participant

    @howsepa

    Thanks very much That appears to have done the trick.

    Checking the DB, the activity is still logged (an avatar change for example still ends up in the DB) however it does not appear on the activity log or in the RSS Feed. which is ideal!.

    Thanks again for that.
    Paul

Viewing 3 replies - 1 through 3 (of 3 total)
Skip to toolbar