-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathloader.php
83 lines (66 loc) · 3.8 KB
/
loader.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
74
75
76
77
78
79
80
81
82
83
<?php
/*
Plugin Name: BuddyPress Skeleton Component
Plugin URI: http://example.org/my/awesome/bp/component
Description: This BuddyPress component is the greatest thing since sliced bread.
Version: 1.6.2
Revision Date: MMMM DD, YYYY
Requires at least: What WP version, what BuddyPress version? ( Example: WP 3.2.1, BuddyPress 1.5 )
Tested up to: What WP version, what BuddyPress version?
License: (Example: GNU General Public License 2.0 (GPL) http://www.gnu.org/licenses/gpl.html)
Author: Dr. Jan Itor
Author URI: http://example.org/some/cool/developer
Network: true
*/
/*************************************************************************************************************
--- SKELETON COMPONENT V1.6.2 ---
Contributors: apeatling, jeffsayre, boonebgorges
This is a bare-bones component that should provide a good starting block to building your own custom BuddyPress
component.
It includes some of the functions that will make it easy to get your component registering activity stream
items, posting notifications, setting up widgets, adding AJAX functionality and also structuring your
component in a standardized way.
It is by no means the letter of the law. You can go about writing your component in any style you like, that's
one of the best (and worst!) features of a PHP based platform.
I would recommend reading some of the comments littered throughout, as they will provide insight into how
things tick within BuddyPress.
You should replace all references to the word 'example' with something more suitable for your component.
IMPORTANT: DO NOT configure your component so that it has to run in the /plugins/buddypress/ directory. If you
do this, whenever the user auto-upgrades BuddyPress - your custom component will be deleted automatically. Design
your component to run in the /wp-content/plugins/ directory
*************************************************************************************************************/
// Define a constant that can be checked to see if the component is installed or not.
define( 'BP_EXAMPLE_IS_INSTALLED', 1 );
// Define a constant that will hold the current version number of the component
// This can be useful if you need to run update scripts or do compatibility checks in the future
define( 'BP_EXAMPLE_VERSION', '1.6.2' );
// Define a constant that we can use to construct file paths throughout the component
define( 'BP_EXAMPLE_PLUGIN_DIR', dirname( __FILE__ ) );
/* Define a constant that will hold the database version number that can be used for upgrading the DB
*
* NOTE: When table defintions change and you need to upgrade,
* make sure that you increment this constant so that it runs the install function again.
*
* Also, if you have errors when testing the component for the first time, make sure that you check to
* see if the table(s) got created. If not, you'll most likely need to increment this constant as
* BP_EXAMPLE_DB_VERSION was written to the wp_usermeta table and the install function will not be
* triggered again unless you increment the version to a number higher than stored in the meta data.
*/
define ( 'BP_EXAMPLE_DB_VERSION', '1' );
/* Only load the component if BuddyPress is loaded and initialized. */
function bp_example_init() {
if ( version_compare( BP_VERSION, '1.9', '<' ) ) {
return;
}
require( BP_EXAMPLE_PLUGIN_DIR . '/includes/bp-example-loader.php' );
}
add_action( 'bp_include', 'bp_example_init' );
/* Put setup procedures to be run when the plugin is activated in the following function */
function bp_example_activate() {
}
register_activation_hook( __FILE__, 'bp_example_activate' );
/* On deacativation, clean up anything your component has added. */
function bp_example_deactivate() {
/* You might want to delete any options or tables that your component created. */
}
register_deactivation_hook( __FILE__, 'bp_example_deactivate' );