1 foozer Feb 13, 2012 00:41
3 foozer Feb 13, 2012 02:52
Great, can you point me towards the right plugins so I can do this?
4 sam2kb Feb 13, 2012 04:23
Take look at /plugins/test_plugin/_test.plugin.php
There's a method "AlternateAuthentication". You can use it in your own plugin.
/**
* Automagically login every user as "demouser" who is not logged in and does not
* try to currently.
*
* To enable/test it, change the "if-0" check below to "if( 1 )".
*
* @see Plugin::AlternateAuthentication()
*/
function AlternateAuthentication()
{
if( 0 ) // you should only enable it for test purposes, because it automagically logs every user in as "demouser"!
{
global $Session, $Messages;
$UserCache = & get_UserCache();
if( $demo_User = & $UserCache->get_by_login('demouser') )
{ // demouser exists:
$Session->set_User( $demo_User );
$Messages->add( 'Logged in as demouser.', 'success' );
return true;
}
}
}
You can easily create your new plugin based on /plugins/skeleton.plugin.php , just add the above method (hook) in it. Also you need to create a guest user and replace "demouser" with your newly created user login.
5 sam2kb Feb 13, 2012 04:26
Don't forget that the Guest user must have minimal possible permissions, and maximum security checks. Create a separate group for it and take a look at group settings.
6 foozer Feb 13, 2012 05:08
OK great, but I guess the ability for guests to make blog posts which don't publish without my approval is out of the question?
7 sam2kb Feb 13, 2012 05:34
That's exactly what we are going to accomplish. Guests will be authenticated as "Guest" user on the fly, and that Guest user will be able to create posts with "draft" status only.
You will need to manually publish all draft posts
Welcome to the forums!
If non-members are your blog visitors, then the only way to get it working is to write a plugin that will authenticate all visitors as user "Guest", and then assign special blog permissions for that user.