This repository has been archived by the owner on Dec 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
bp-wake-up-sleepers.php
executable file
·73 lines (57 loc) · 2.11 KB
/
bp-wake-up-sleepers.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
/*
Plugin Name: BP wake up sleepers
Plugin URI: http://imathi.eu/2012/12/20/bp-wake-up-sleepers/
Description: Need to wake the sleeping users of your BuddyPress community ?
Version: 1.0-beta1
Author: imath
Author URI: http://imathi.eu
License: GPLv2
Text Domain: bp-wake-up-sleepers
Domain Path: /languages/
*/
define ( 'BP_WUS_PLUGIN_NAME', 'bp-wake-up-sleepers' );
define ( 'BP_WUS_PLUGIN_URL', plugins_url('' , __FILE__) );
define ( 'BP_WUS_PLUGIN_URL_JS', plugins_url('js' , __FILE__) );
define ( 'BP_WUS_PLUGIN_URL_CSS', plugins_url('css' , __FILE__) );
define ( 'BP_WUS_PLUGIN_URL_IMG', plugins_url('images' , __FILE__) );
define ( 'BP_WUS_PLUGIN_DIR', WP_PLUGIN_DIR . '/' . basename( dirname( __FILE__ ) ) );
define ( 'BP_WUS_PLUGIN_VERSION', '1.0-beta1');
add_action('bp_include', 'bp_wus_init');
function bp_wus_init() {
global $bp;
require( BP_WUS_PLUGIN_DIR . '/includes/bp-wus-loader.php' );
$bp_wus = new BP_Wus;
}
function bp_wus_install(){
if( BP_WUS_PLUGIN_VERSION != get_option( 'bp-wus-version' ) ){
$page_id = get_option( 'bp-wus-page' );
if( empty( $page_id ) ){
$page_id = wp_insert_post( array( 'comment_status' => 'closed', 'ping_status' => 'closed', 'post_title' => 'Unsubscribe', 'post_status' => 'publish', 'post_type' => 'page' ) );
update_option( 'bp-wus-page', $page_id );
}
update_option( 'bp-wus-version', BP_WUS_PLUGIN_VERSION );
}
}
register_activation_hook( __FILE__, 'bp_wus_install' );
/**
* bp_checkins_load_textdomain
* translation!
*
*/
function bp_wus_load_textdomain() {
// try to get locale
$locale = apply_filters( 'bp_wus_load_textdomain_get_locale', get_locale() );
// if we found a locale, try to load .mo file
if ( !empty( $locale ) ) {
// default .mo file path
$mofile_default = sprintf( '%s/languages/%s-%s.mo', BP_WUS_PLUGIN_DIR, BP_WUS_PLUGIN_NAME, $locale );
// final filtered file path
$mofile = apply_filters( 'bp_wus_load_textdomain_mofile', $mofile_default );
// make sure file exists, and load it
if ( file_exists( $mofile ) ) {
load_textdomain( BP_WUS_PLUGIN_NAME, $mofile );
}
}
}
add_action ( 'init', 'bp_wus_load_textdomain', 8 );