Page 1 of 1

Private blog

Posted: Sat Mar 05, 2016 1:16 pm
by lmmarkus
Hey,

Can some1 help me and give some tips how to get sessions work in bluddit ?(without database)
Have been trying and nothing seems to work.
I need simple login ja make full blog private(only logged in people can see)(login details can also be in same file).
I can't get sessions to work.
phpinfo session settings
Image

Re: Private blog

Posted: Sat Mar 05, 2016 7:36 pm
by Fred
Hi,
Use the defaut session Bludit dashboard.
In your theme (php/head.php) replace this code:

Code: Select all

<?php
	Theme::charset('utf-8');
by

Code: Select all

<?php
	// Private Bludit
	if($Login->role()!=='admin' && $Login->role()!=='editor') {
		Alert::set($Language->g('you-do-not-have-sufficient-permissions'));
		Redirect::page('admin', 'dashboard');
	}
	
	Theme::charset('utf-8');
Work like charm :)
Only editors and admins can access on all site.

Re: Private blog

Posted: Sat Mar 05, 2016 8:59 pm
by lmmarkus
Thanks, that works well but only problem is that now, these users aren't admins or editors. They should not get access to admin panel.
It should redirect to site not to admin panel.
Any change to change editors to normal users and redirect them to blog and if admin login then redirect to admin panel(will also be able to access site) ?

Re: Private blog

Posted: Sat Mar 05, 2016 9:08 pm
by lmmarkus
well actualy i think easyest way to do that is to add new usergroup ? or will it be hard ? they dont need any special access, only to access blog and redirect to blog site after logging in.

something like that ? :D

Code: Select all

<?php
   // Private Bludit
   if($Login->role()!=='admin' && $Login->role()!=='editor' && $Login->role()!=='user') {
      Alert::set($Language->g('you-do-not-have-sufficient-permissions'));
      if($Login->role()=='user'){
      	Redirect::page('admin', 'dashboard');//change to redirect to blog index.php
      }else{
      	Redirect::page('admin', 'dashboard');
      }
   }
   
   Theme::charset('utf-8');

Re: Private blog

Posted: Mon Mar 07, 2016 10:56 am
by Fred
Wait Diego if feature new usergroup...
Or make a plugin for this.

Re: Private blog

Posted: Tue Mar 08, 2016 11:51 am
by DawidXT
yap, the subject returns to user registration or at least new user group with one password access for everyone.

Re: Private blog

Posted: Tue Mar 08, 2016 3:49 pm
by lmmarkus
well i dont need user registration :) i just need private blog where 20-30 people login with same username and password.
And dont have edit rights :)
But i guess it will be hard to add that in bludit system :) i so just try to tell them not to use edit option and just redirect editor status to blog and admin to admin panel instead

is there any better way to redirect blog site like that
Redirect::page('admin', 'dashboard');
or should just use address redirect ?

Re: Private blog

Posted: Tue Mar 08, 2016 4:49 pm
by lmmarkus
Simple and unsecure way untill someone comes up with better idea or plugin :)

it check if login user isn't admin and editor, it will redirect back to login page and displays error message
in public_html\themes\pure\php\head.php (big thanks to fred for that code)

Code: Select all

 // Private Bludit
if($Login->role()!=='admin' && $Login->role()!=='editor') {
	Alert::set($Language->g('you-do-not-have-sufficient-permissions'));
	Redirect::page('admin', 'dashboard');
}
This code checks on admin dashboard page where editor and admins are redirected after login. It checks if editor has logged in and redirects to spesific address.(Note that editors dosent have any options on blog site, they can also edit in admin dashboard only, since no1 will know that admin dashboard, it seems to work like normal user)
in public_html\kernel\admin\controllers\dashboard.php

Code: Select all

      if($Login->role()=='editor'){
	echo'
		<script type="text/javascript">
			window.location.href = "UrlToRedirect";
		</script>
	';
}
Now only have to add logout to blog theme.
I guess it will be redirect to YourBlogURL/admin/logout
simple html link

Code: Select all

<a href="YourBlogUrl/admin/logout">Logout</a>
Not perfect solutsion but it seems to be working temporarily.

Use on your own risk :)