PluginProbe
BP Simple Private / trunk
BP Simple Private vtrunk
trunk 1.0 1.1 1.2 1.3 1.4 2.0 2.1 2.2 2.3
bp-simple-private / loader.php

loader.php in BP Simple Private trunk, at loader.php

71 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 Plugin Name: BP Simple Private
5 Description: Select whether posts, pages and BuddyPress or BuddyBoss sections can be viewed by non-logged-in users. See Settings > BP Simple Private
6 Version: 2.3
7 Author: PhiloPress
8 Author URI: https://philopress.com/
9 Text Domain: bp-simple-private
10 Domain Path: /languages
11 License: GPLv2 or later
12 */
13
14 if ( !defined( 'ABSPATH' ) ) exit;
15
16
17 function pp_private_bp_check() {
18 if ( !class_exists('BuddyPress') ) {
19 add_action( 'admin_notices', 'pp_private_install_buddypress_notice' );
20 }
21 }
22 add_action('plugins_loaded', 'pp_private_bp_check', 999);
23
24 function pp_private_install_buddypress_notice() {
25 echo '<div id="message" class="error fade"><p style="line-height: 150%">';
26 _e('BuddyPress Simple Private requires the BuddyPress plugin. Please install BuddyPress first, or deactivate BuddyPress Simple Private.', 'bp-simple-private');
27 echo '</p></div>';
28 }
29
30
31 function pp_private_load_admin() {
32
33 if ( is_admin() ) {
34
35 load_plugin_textdomain( 'bp-simple-private', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
36
37 require( dirname( __FILE__ ) . '/inc/pp-private-admin-meta-box.php' );
38 require( dirname( __FILE__ ) . '/inc/pp-private-admin-settings.php' );
39
40 } else {
41
42 if( function_exists('bp_classic_includes') ) {
43 require( dirname( __FILE__ ) . '/inc/pp-private-front-bp-classic.php' );
44 } else {
45 require( dirname( __FILE__ ) . '/inc/pp-private-front.php' );
46 }
47 }
48 }
49 add_action( 'bp_include', 'pp_private_load_admin' );
50
51
52 function pp_private_add_settings_link( $links ) {
53 $link = array( '<a href="' . admin_url( 'options-general.php?page=bp-simple-private' ) . '">Settings</a>', );
54 return array_merge( $links, $link );
55 }
56 add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), 'pp_private_add_settings_link' );
57
58
59 function pp_private_activation() {
60
61 if( !function_exists('is_plugin_active') ) {
62 include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
63 }
64
65 if ( is_plugin_active( 'bp-simple-private-pro/bp-simple-private-pro.php' ) ) {
66 deactivate_plugins( '/bp-simple-private-pro/bp-simple-private-pro.php' );
67 }
68
69 }
70 register_activation_hook(__FILE__, 'pp_private_activation');
71