Recent Topics

1 Feb 13, 2012 00:41    

My b2evolution Version: 3.x

Hey guys, I'm looking for some type of way that I can have members or non-members submit blog posts that have to first be approved by an admin before they get published, is there anything like that?

2 Feb 13, 2012 01:39

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.

3 Feb 13, 2012 02:52

Great, can you point me towards the right plugins so I can do this?

4 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 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 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 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


Form is loading...