Skip to content

Commit

Permalink
bottom links (donate & settings)
Browse files Browse the repository at this point in the history
  • Loading branch information
gordielachance authored and gordielachance committed Sep 11, 2016
1 parent 6518428 commit 2a7e216
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion bbpress-pencil-unread.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ class bbP_Pencil_Unread {
public $marked_forums_metaname = 'bbppu_marked_forums'; // contains an array of 'marked as read' timestamps for forums (stored in usermeta)

public $qvar = 'bbppu';

public $donate_link = 'http://bit.ly/gbreant';

/**
* @var The one true Instance
Expand Down Expand Up @@ -116,8 +118,27 @@ function setup_actions(){
add_action('bbp_init', array($this, 'register_scripts_styles'));
add_action('bbp_enqueue_scripts', array($this, 'scripts_styles'));
add_action('admin_enqueue_scripts', array($this, 'scripts_styles_admin'));

add_filter( 'plugin_action_links_' . $this->basename, array($this, 'plugin_bottom_links')); //bottom links

}

function plugin_bottom_links($links){

$links[] = sprintf('<a target="_blank" href="%s">%s</a>',$this->donate_link,__('Donate','bbppu'));//donate

if (current_user_can('manage_options')) {
$settings_page_url = add_query_arg(
array(
'page'=>bbP_Pencil_Unread_Settings::$menu_slug
),
get_admin_url(null, 'options-general.php')
);
$links[] = sprintf('<a href="%s">%s</a>',esc_url($settings_page_url),__('Settings'));
}

return $links;
}

public function load_plugin_textdomain(){
load_plugin_textdomain( 'bbppu', false, plugin_basename( dirname( __FILE__ ) ) . '/languages' );
Expand Down Expand Up @@ -290,7 +311,7 @@ function scripts_styles(){
//checks if the current page is the bbppu settings page
function is_bbppu_admin(){
$screen = get_current_screen();
if( $screen->id == 'settings_page_bbppu') return true;
if( $screen && ($screen->id == 'settings_page_bbppu') ) return true;
}

function scripts_styles_admin(){
Expand Down

0 comments on commit 2a7e216

Please sign in to comment.