2016-08-22 5 views
0
$groupadmin ='1'; 
if ($this->ion_auth->in_group($groupadmin)) 
{ 
    $this->session->set_flashdata('message', 'You must be part of the group 1 to view this page'); 
    redirect('dashboard'); 
}else 
{ 
    $this->session->set_flashdata('message', 'You must be part of the group 2 to view this page'); 
    redirect('test'); 
} 

グループID = 1、ユーザのリダイレクトダッシュボードとグループID = 2の場合、ユーザーはあなたがintergerにあなたのコードのgroupadmin変数を変更することができ、テストコントローラが、ログインユーザーの両方が、テストコントローライオン認証グループベースのログイン

+0

があなたの 'in_group()'関数のコードを表示し、あなたの参考のために、このURLにアクセスすることができます。 –

+0

私はcodeigniterのためにBen Edmunds Ion Authライブラリを使用しています –

答えて

0

をリダイレクトリダイレクトのみ。

$groupadmin = 1; 
if ($this->ion_auth->in_group($groupadmin)) 
{ 
    $this->session->set_flashdata('message', 'You must be part of the group 1 to view this page'); 
    redirect('dashboard'); 
} else { 
    $this->session->set_flashdata('message', 'You must be part of the group 2 to view this page'); 
    redirect('test'); 
} 

あなたはhttp://benedmunds.com/ion_auth/#in_group

+0

ありがとうNikunj –

+0

他の人にとって有益なことがあるので、この回答を承認してください。 –

+0

良い。答えを受け入れてください:)。 –