Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Private page for a few persons
#1
I have a question.
I can set page as private.
I don't see this on website, but only on backend.
How I can show this only for a few persons, who visit my website?
I want to create login menu and a few persons can login on website and I want show them private pages.
Not for everybody.
How I can do this?
Zdravim vsechny!
Reply
#2
You may be able to do what you need with the Frontend User Login Multi User plugin. I suppose you can create users and disable their access to everything (but they still would be able to view private pages).

If not, I can post a small plugin I made some time ago, that lets you define (in gsconfig) a list of admin users. Admins have access to the backend, anyone else is redirected to a page (defined in gsconfig) when they log in and can only browse private pages. But you have to create users manually (or whatever method), it's very simple.
Reply
#3
(2014-02-23, 18:23:22)Carlos Wrote: You may be able to do what you need with the Frontend User Login plugin. I suppose you can create users and disable their access to everything (but they still would be able to view private pages).
Hmm, I can't find this plugin.
On my website I have Multi User and SA GS Admin Toolbar plugins.
But if I create account and block it to admin access and back to website I still can't view a private pages.
Zdravim vsechny!
Reply
#4
Sorry, I meant the Multi User plugin (also known as User Management)

I've just tried with it, I've created an user and disabled access to everything, and he can view private pages.
The problem is that when he logs in, he enters an infinite loop while trying to be redirected to admin/pages.php - it seems the plugin requires that all users have access to at least one backend page.

Here's my quick 'n dirty Frontend Users plugin, just in case it's helpful:

Code:
<?php

// register plugin
$thisfile = basename(__FILE__, ".php");
register_plugin(
    $thisfile,
    'Frontend users',
    '0.1',
    'Carlos Navarro',
    'http://www.cyberiada.org/cnb/',
    '...'
);

#define('FEU_URL','http://example.com/somepage');
#define('FEU_ADMINS','admin,admin2,admin3');

add_action('admin-pre-header','frontendusers');

function frontendusers() {
  global $USR;
  $admins = (defined('FEU_ADMINS')) ? explode(',',FEU_ADMINS) : array();
  if (!in_array($USR, $admins)) {
    if (defined('FEU_URL'))
      redirect(FEU_URL);
    else
      redirect('404');
  }
}

// end

- Save it as frontendusers.php and upload to your plugins folder
- Add these lines to your gsconfig.php file:
Code:
define('FEU_ADMINS','admin,admin2,admin3');
define('FEU_URL','http://example.com/somepage/');

FEU_ADMINS is a comma-separated list of users that must have access to the backend
FEU_URL is the URL of the page where non-admins must be redirected just after logging in (can be a private page)

- finally, activate the plugin.
Reply
#5
I have done this with front end user also, but it required much more custom code than that solution.
I was protecting special sections, subpages etc
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply




Users browsing this thread: 3 Guest(s)