I am trying to develop a plugin. When I activate the plugin it's showing me following error message:
The plugin generated 2651 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.
I can not understand why it's showing this error. I can see there is no white space to show this error!
Here is my code:
<?php
/*
Plugin Name: Forum Roles
Plugin URI: http://www.creativeartbd.com
Description: Generate a google map
Version: 1.0
Author: Shibbir
Author URI: http://creativeartbd.com/bio/
License: GPL2
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: gmape
Domain Path: /languages/
*/
// custom forum roles and capabilites class
class BOJ_Forum_Roles {
function __construct() {
// register plugin activation hook
register_activation_hook( __FILE__, 'activation' );
// register plgin deactivation hook
register_deactivation_hook( __FILE__, 'deactivation' );
}
// plugin activation method
function activation () {
// get the default administrator tole
$role =& get_role('administrator');
// add forum capabilities to the administrator role
if( !empty($role) ) {
$role->add_cap('publish_forum_topics');
$role->add_cap('edit_others_forum_topics');
$role->add_cap('delete_forum_topics');
$role->add_cap('read_forum_topics');
}
// create the forum administator tole
add_role( 'forum_administrator', 'Forum Administrator', array(
'publish_forum_topics', 'edit_others_forum_topics', 'delete_forum_topics', 'read_forum_topics'
) );
// create the moderator role
add_role('forum_moderator', 'Forum Moderator', array(
'publish_forum_topics', 'edit_others_forum_topics','read_forum_topics'
));
// create the forum member role
add_role('forum_member', 'Forum Member', array(
'publish_forum_topics', 'read_forum_topics'
));
// create the forum suspended role
add_role( 'forum_suspended', 'Forum Suspeded', array(
'read_forum_topics'
) );
}
// plugin deactivation method
function deactivation () {
// get the default administrator role
$role =& get_role('administrator');
//remove forum capabilites to the administrator role
if(!empty($role)) {
$role->remove_cap('publish_forum_topics');
$role->remove_cap('edit_others_forum_topics');
$role->remove_cap('delete_forum_topics');
$role->remove_cap('read_forum_topics');
}
// set up an array of roles to delete
$roles_to_delete = array(
'forum_administrator',
'forum_moderator',
'forum_member',
'forum_suspended'
);
// loop through each role, deleting the role if necessary
foreach ($roles_to_delete as $role) {
// get the users of the role
$users = get_users(array(
'role' => $role
));
// check if there are no users for the role
if( count($users) <= 0 ) {
//remove the role from the site
remove_role( $role );
}
}
}
}
$forum_roles = new BOJ_Forum_Roles();
Can you tell me how can I solve it?