Autoblog plugin for b2evolution New blog on new user registration
| Featured: Nice-Stats |
|---|
| Fralenuvol releases Nice-Stats Complete and leightweight website statistics written in PHP & MySQL |
Last update: 2006/12/19 -19:00
Please download again if you got the plugin before this date!
- Plugin description
- Options
- Advanced options
- Installation
- Folder Permissions
- Default values & Troubleshooting
- Download
- Author & Contact
Autoblog plugin description
Autoblog plugin is released for b2evolution, from version 1.8.5 and up.
This plugin for b2evolution creates a new blog when a new user registers. Also admins can create immediatly a blog for existing users with just one "tick and click".
Users may chose if they want their blog or not during registration. Frontend autoblog creation for new users may be switched off, in order to allow only Admin group to create Autoblogs for existing users in backoffice.
For every registration a new blog and the corresponding category in the blog will be created. Blog short name and category will have the same name as login.
All the new users will belong to the new group "Autoblog Bloggers". This group has the same rights as the "Bloggers" group plus the rights to upload files to their blog, if set in autoblog options.
The plugin handles correctly both cases in which you want a new user to validate his account upon registration or not in b2evolution App settings:
- New users must validate: New user blog is created AFTER validation, in order to prevent fake blogs.
- New users must not validate to register: New user blog is created immediatly after registration.
No new blog will be created if the validating user belongs to Admin group. After account validation the user wil be redirected to his newly created blog or, if you prefer, to the backend ready to write a new post.
This plugin is very suitable for creating your own blogs user community.
Additional Hack prevents users to change their login and blog shortname, nor to ban the main administrator.
No special configuration of .htaccess file nor mod_rewrite is necessary.
Plugin Options
The plugin has several options built in which you can configure:
- Admin group may create auto blogs in backoffice for registered users.
- User's redirection after validating his account (blog's frontend or backend)
- User's permissions to post-upload files-change settings-customize own CSS
- Default skin, descriptions and welcome messages for new bloggers
- Advanced settings for stub files, with optional user folders
- Optional global storage folder for all user (media folders may be moved inside)
- Fine tune user's post permissions (published,deprecated,protected,private,draft)
- Choose if display bloglist in new blog
- Choose if display new blog in bloglist
Plugin advanced options
Stub files
The plugin allows an advanced configuration of stub files, according to your needs and the server configuration. All stub files will include a common config file (/plugins/autoblog_plugin/_autoblog_config.php) which allows you to override globally some stub settings for all autoblogs.
You may choose if you want to use stub files or not, with or without extension, if you want to store stub files in separate directories or all in a subdirectory.
The stub files will be automatically created, and the urls will be set in correspondance:
- BASED ON INDEX.PHP
no stub file created:
Blog URL's will be: "http://pathtoblogs/index.php?blog=blog_id"
- BASED ON STUB FILES
with or without extension: -
- No extension: "/pathtoblogs/user_login_name" stub file will be created (works only if supported by your server).
Blog URL's will be: "http://pathtoblogs/user_login_name"
- With extension: "/pathtoblogs/user_login_name.php" stub file will be created.
Blog URL's will be: "http://pathtoblogs/user_login_name.php"
- No extension: "/pathtoblogs/user_login_name" stub file will be created (works only if supported by your server).
- BASED ON NEW FOLDER WITH STUB FILE
folder and stub file created: "/pathtoblogs/user_login_name/" folder will be created. The corresponding "index.php" stub file will be created and dropped inside.
Blog URL's will be: "http://pathtoblogs/user_login_name/"
(Good solution if you want clean URL's for users and the stub files don't work on your server.)
- STORAGE FOLDER
All users stub files may be stored in one single directory. Example: if your root is /blogs/ and you want to store all your stub files in /blogs/subdir/ you will set "subdir/" as Storage Folder.
(Useful if you want to store all user in one directory)
- DEFAULT SETTINGS
Default settings for stub files & folders are: Use stub files AND stub folder AND storage folder "u/".
Example: user with login mike will have his blog at the following address: www.yourblogsite.com/u/mike/
Custom CSS for autobloggers
The plugin has the option Custom CSS for autobloggers to customize own CSS Style. In this case a sample file "style.css" will be automatically created in /media/blogs/username/ folder. The styles defined here will BE ADDED (and not replace) the current chosen default style. This feature is based on b2evolution "blog css" feature. Fore more information see Customized CSS .
Regarding, the automatic "style.css" creation give your autobloggers some basic instructions on how to edit the file, seen that b2evolution 1.8.2 still does not provide the feature to edit/overwrite the css file.
Therefore autobloggers should:
- Download "style.css" fom their media folder through the files management.
- Customize the CSS file
- Delete online "style.css"
- Re-upload own "style.css" in their media folder through the files management.
Common config file for autoblogs
OPTIONAL: used ONLY IF you use stub files. This is the common config file included in all autoblogs stub files which lets you override the global settings for all autoblogs.
Don't change the default value if you don't know exactly what you are doing. (backslashes, etc..)
EXAMPLE: If you add the line: "$default_skin = 'custom';" all autoblogs will have as default skin "custom". You may use any parameters used in stub files. (Possibly not "$blog = n;", otherwise all autobloggers will have the same blog assigned! :-)
ATTENTION: Take care to chmod "autoblog_config.php" in autoblog_plugin folder to 777 if you use stub files.
Clean Urls with mod_rewrite
Allows you nice formatting of urls, removing Stub storage folder and "index.php" from your URL's. Best result is achieved using Autoblog default values: "Use stub files" AND "Use stub folder".
Autobloggers with real url like
"www.yourdomain.com/u/username/index.php"
will have as address:
"www.yourdomain.com/username/".
And URL's like:
"www.yourdomain.com/u/username/index.php/2006/09/21/first_post"
will look like:
"www.yourdomain.com/username/2006/09/21/first_post".
ATTENTION: In order to make this feature work you need:
- mod_rewrite on Apache
- enable "Use extra-path info" in Admin->App settings
- copy the content of cleanurls.htaccess provided in Autoblog Plugin folder in your own .htaccess file.
Installation
AUTOBLOG installation consists of 3 parts:
- PLUGIN INSTALL (REQUIRED)
Plugin install and configuration - FOLDER PERMISSIONS (REQUIRED)
Set write permissions to required folders - HACK (OPTIONAL)
This will set better security on what the users are allowed to do in their blog.
(takes 5 minutes)
The download also includes the pre-hacked files under the "prehacked_files/root_x.x.x/" directory, corresponding to your current b2evolution version.
You can just overwrite the original files if you prefer:
- "inc/_misc/_plugins.class.php"
- "inc/_misc/_plugin.class.php"
- "inc/_misc/_form.class.php"
Plugin install (required)
Fresh install
EXTRACT
the content of the downloaded file.
COPY:
the whole autoblog_plugin folder with its content to your b2evo plugins folder.
Go to Administration»App settings»Plugins and install Autoblog Plugin from the list of available plugins.
Upgrade
If you were previously using the plugin for 1.8.x versions, it is reccomended to perform a fresh install.
Folder permissions
You have to ensure that the following folder have write permissions: (777):
(If in your host 777 is not allowed, try with 775)
- /media/blogs/
- /plugins/autoblog_plugin/
- /plugins/autoblog_plugin/autoblog_config.php
- b2evoroot/u/ (or whatever you set as storage folder in plugin options)
If you use stub folders, the plugin will try to create the stub storage folder in b2evolution root. If your root folder is not writable you must create this folder manually and set permissions to (0777).
Plugin configuration
To configure all the autoblog plugin settings:
Go to Administration»App settings»Plugins»Actions»Edit plugin settings.
Configure everything from here. Instructions are included.
For stub fies & folders try first default values.
By default stubs are created in "storagefolder/usernamefolder/index.php".
Change the settings one by one until you get confident with the plugin.
Default values & troubleshooting
Default values
By default, new autoblogs will use stub files "index.php" inside user folder, stored in global storage folder "u/". So for user with login "mike" blog address will be: "www.yourblogsite.com/u/mike/"
Try first default values of autoblog plugin and change the settings one by one until you get confident with the plugin. Take especially care to enable "clean urls" option with mod_rewrite only once you tested the default installation.
Troubleshooting
If you get errors verify the following:
- Are folder and file permissions correctly set? Verify here.
- Does your server support stub files? If not, disable stub files in plugin settings.
- If you enabled "clean urls" in plugin settings, follow carefully this instructions.
If "clean urls" don't work on your server (server errors) disable this option.
And, if no blog is created for new users, naturally ensure you enabled user registrations in Administration»Appl settings to take advantage of Autoblog plugin ;-)
Hack (optional)
This optional Hack is security related, therefore reccomended in order to avoid:
- Duplicate Blog names
- Users to change their login/blog shortname (which could lead to duplicate Blog names)
- Take Admin Group's permission away from user's blog.
The hack takes less than 5 minutes to install. If you prefer you may overwrite the pre-hacked files included in the download.
Hack Part (optional)
This part adds the "CreateFormElement" event to disable some form fields, in order to prevent users to change their login name and blog short name.
OPEN:
inc/_misc/_plugins.class.php
FIND:
'AfterUserUpdate' => '',
AFTER ADD:
'FormCreateElement' => '',
OPEN:
inc/_misc/_plugin.class.php
FIND:
function AfterUserUpdate( & $params )
{
}
AFTER ADD:
function FormCreateElement( & $params )
{
}
OPEN:
inc/_misc/_form.class.php
FIND:
$field_params['value'] = $field_value;
IN FIRST MATCH INSIDE FUNCTION text_input() - BEFORE ADD:
global $Plugins;
FIND:
return $this->input_field( $field_params );
IN FIRST MATCH INSIDE FUNCTION text_input() - BEFORE ADD:
$Plugins->trigger_event( 'FormCreateElement', $params = array('field_params' => & $field_params, 'Form' => & $this ) );
FIND:
if( isset($field_params['lines']) )
{
BEFORE ADD:
global $Plugins;
FIND:
$input_params['id'] = $this->get_valid_id( $field_params['name'].'_radio_'.$count_options);
AFTER ADD:
$Plugins->trigger_event( 'FormCreateElement', $params = array('field_params' => & $input_params, 'loop_field_option' => & $loop_field_option, 'Form' => & $this ) );
Plugin & Hack Installation finished. Enjoy.
Download
In this ZIP file you will find:
- autoblog_plugin/ (folder you have to upload to your plugins/ directory)
- _autoblog.plugin.php
- _autoblog_config.php
- locales/ (folder with translations, at present only english and italian)
- prehacked_files/ (directory containing the pre-hacked files)
- cleanurls.htaccess (sample .htaccess if you enable "cleanurls")
- README.txt (install instructions)
Author
Francesco Castronovo
- http://www.fralenuvol.com
- Autoblog plugin thread in b2evolution forums
- Report bugs here (regarding only the plugin itself).
Credits
- Thanks to blueyed, who helped a lot in development.
- Thanks to topanga who gave precious help overall.
- Thanks to all other contributors for translations and little bug fixes.
- The script is inspired by a hack of EdB: http://forums.b2evolution.net/viewtopic.php?t=5042
