Private blog

Post Reply
lmmarkus
Ssr. Bludit
Posts: 14
Joined: Fri Jan 08, 2016 8:36 am

Sat Mar 05, 2016 1:16 pm

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
User avatar
Fred
Legend Bludit
Posts: 236
Joined: Wed Jun 24, 2015 2:14 pm
Location: France
Contact:

Sat Mar 05, 2016 7:36 pm

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.
Last edited by Fred on Sun Mar 06, 2016 9:25 am, edited 1 time in total.
╰☆╮Bludit╰☆╮ is a open source and community contributions are essential to project success!
You are looking for a light forum based Json? Try my project Flatboard, it is free. ;)
Sorry for my little english, i'm french :oops:
lmmarkus
Ssr. Bludit
Posts: 14
Joined: Fri Jan 08, 2016 8:36 am

Sat Mar 05, 2016 8:59 pm

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) ?
lmmarkus
Ssr. Bludit
Posts: 14
Joined: Fri Jan 08, 2016 8:36 am

Sat Mar 05, 2016 9:08 pm

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');
User avatar
Fred
Legend Bludit
Posts: 236
Joined: Wed Jun 24, 2015 2:14 pm
Location: France
Contact:

Mon Mar 07, 2016 10:56 am

Wait Diego if feature new usergroup...
Or make a plugin for this.
╰☆╮Bludit╰☆╮ is a open source and community contributions are essential to project success!
You are looking for a light forum based Json? Try my project Flatboard, it is free. ;)
Sorry for my little english, i'm french :oops:
DawidXT
Sr. Bludit
Posts: 38
Joined: Wed Jul 15, 2015 3:56 pm

Tue Mar 08, 2016 11:51 am

yap, the subject returns to user registration or at least new user group with one password access for everyone.
lmmarkus
Ssr. Bludit
Posts: 14
Joined: Fri Jan 08, 2016 8:36 am

Tue Mar 08, 2016 3:49 pm

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 ?
lmmarkus
Ssr. Bludit
Posts: 14
Joined: Fri Jan 08, 2016 8:36 am

Tue Mar 08, 2016 4:49 pm

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 :)
Post Reply