Created
September 27, 2011 12:43
-
-
Save mox601/1244968 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Knowledge Room | |
... | |
*/ | |
if (!class_exists("KnowledgeRoom")) { | |
class KnowledgeRoom { | |
var $pluginPath; | |
var $pluginUrl; | |
public function KnowledgeRoom() | |
{ | |
$this->__construct(); | |
} | |
function __construct() { | |
echo "building knowledgeroom"; | |
// Set Plugin Path | |
$this->pluginPath = dirname(__FILE__); | |
// Set Plugin URL | |
$this->pluginUrl = WP_PLUGIN_URL . '/knowledge-room'; | |
//register function to action | |
add_action( 'display_knowledge_room', array( &$this, 'display_knowledge_room' ) ); | |
} | |
function display_knowledge_room($user_ID) { | |
knowledge_room_menu(); | |
$retval = '<div class="kr_content">got user id: '. $user_ID .'</div>'; | |
$retval .= '<br/>'; | |
echo $retval; | |
} | |
function knowledge_room_menu() { | |
echo 'path: '.$this->pluginPath.'<br/>'; | |
echo 'url: '.$this->pluginUrl.'<br/>'; | |
$menu = 'draw the menu <br/>'; | |
$menu .='<a href="http://www.google.it">link to search'.'</a> '; | |
$menu .= get_link_self(); | |
$menu .= get_link_to_section('firstAction', 'First Action'); | |
echo $menu; | |
} | |
function get_link_self() { | |
return '<a href="'.$this->pluginUrl.'">link to self</a> '; | |
} | |
function get_link_to_section($section_path, $section_title) { | |
return '<a href="'.$this->pluginUrl.'/'.$section_path.'">link to '.$section_title.'</a>'; | |
} | |
} | |
} | |
//*************** Admin function *************** | |
function knowledge_room_admin() { | |
if (!current_user_can('manage_options')) { | |
wp_die( __('You do not have sufficient permissions to access this page.') ); | |
include('kr-admin.php'); | |
} | |
} | |
function kr_admin_actions() { | |
add_options_page("Kroom", "Knowledge Room Configuration", 1, "Knowledge Room Configuration", "knowledge_room_admin"); | |
} | |
add_action('admin_menu', 'kr_admin_actions'); | |
new KnowledgeRoom(); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Template Name: Knowledge Room | |
*/ | |
/* This file should be included in the root BuddyPress theme directory */ | |
get_header() ?> | |
<div id="content"> | |
<div class="padder"> | |
<?php do_action( 'bp_before_blog_page' ) ?> | |
<div class="page" id="blog-page" role="main"> | |
<h2 class="pagetitle"><?php the_title(); ?></h2> | |
<?php do_action( 'display_knowledge_room', 666); ?> | |
<?php edit_post_link( __( 'Edit this page.', 'buddypress' ), '<p class="edit-link">', '</p>'); ?> | |
</div><!-- .page --> | |
<?php do_action( 'bp_after_blog_page' ) ?> | |
</div><!-- .padder --> | |
</div><!-- #content --> | |
<?php get_sidebar() ?> | |
<?php get_footer(); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment