Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Private page for a few persons
#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


Messages In This Thread
Private page for a few persons - by kasztelan - 2014-02-23, 03:16:02
RE: Private page for a few persons - by Carlos - 2014-02-23, 18:23:22
RE: Private page for a few persons - by kasztelan - 2014-02-23, 20:49:17
RE: Private page for a few persons - by Carlos - 2014-02-24, 03:39:50
RE: Private page for a few persons - by shawn_a - 2014-02-24, 08:19:57



Users browsing this thread: 2 Guest(s)