application/models/mobile_api/Common_model.php
/*function for make sure the  login user in tribe*/
function for make sure the  login user in tribe
function for make sure the login user in tribe
public function user_in_tribe_check($loginUserId,$searchId)
    {        
        $searchCheck = "SELECT * FROM searchcriteria s WHERE s.searchId = $searchId AND s.userId = $loginUserId";
        $result = $this->db->query($searchCheck);
        if ($result->num_rows()>0) {
            return true;
        }else{
            $sql1 = "SELECT * from tribe t where t.searchId = $searchId AND (t.touserId =$loginUserId OR t.fromuserId =$loginUserId) AND t.status = 'accept' AND t.deleteFlag != 1";
            $record = $this->db->query($sql1);
            if ($record->num_rows()>0) {
                return true;
            } 
        }
    }
public function user_in_tribe_check ( $ loginUserId , $ searchId ) { $ searchCheck = " SELECT * FROM searchcriteria s WHERE s.searchId =  $ searchId  AND s.userId =  $ loginUserId " ; $ result = $ this -> db -> query ( $ searchCheck ) ; if ( $ result -> num_rows ( ) > 0 ) { return true ; } else { $ sql1 = " SELECT * from tribe t where t.searchId =  $ searchId  AND (t.touserId = $ loginUserId  OR t.fromuserId = $ loginUserId ) AND t.status = 'accept' AND t.deleteFlag != 1 " ; $ record = $ this -> db -> query ( $ sql1 ) ; if ( $ record -> num_rows ( ) > 0 ) { return true ; } } }
function for make sure the  login user in tribe
function for make sure the login user in tribe
/*If search is created by login user then dont Check login user is in tribe */ //echo $sql1;exit();