Skip to content

Commit

Permalink
Merge pull request #24 from GeoDirectory/master
Browse files Browse the repository at this point in the history
pull
  • Loading branch information
kprajapatii authored Jun 2, 2022
2 parents d51e0af + 8e13df7 commit 88077af
Show file tree
Hide file tree
Showing 14 changed files with 218 additions and 155 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
.idea/

/vendor/
1 change: 1 addition & 0 deletions bp-compliments-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ public function enqueue_scripts() {
wp_enqueue_script( 'bp-compliments-js', constant( 'BP_COMPLIMENTS_URL' ) . 'js/bp-compliments.js', array( 'jquery' ) );
wp_register_style( 'bp-compliments-css', constant( 'BP_COMPLIMENTS_URL' ) . 'css/bp-compliments.css' );
wp_enqueue_style( 'bp-compliments-css' );
wp_enqueue_style( 'dashicons' );
}

}
Expand Down
60 changes: 38 additions & 22 deletions bp-compliments.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@
*
* @wordpress-plugin
* Plugin Name: BuddyPress Compliments
* Plugin URI: http://wpgeodirectory.com/
* Plugin URI: https://appwp.io/
* Description: Compliments module for BuddyPress.
* Version: 1.0.7
* Author: GeoDirectory
* Author URI: http://wpgeodirectory.com
* Version: 1.0.9
* Author: AyeCode Ltd
* Author URI: https://ayecode.io
* Text Domain: bp-compliments
* Domain Path: /languages
* Requires at least: 3.1
* Tested up to: 4.7
* Tested up to: 5.2
*/

// Exit if accessed directly
if ( !defined( 'ABSPATH' ) ) exit;

// Define the plugin version.
define( 'BP_COMPLIMENTS_VER', '1.0.7' );
define( 'BP_COMPLIMENTS_VER', '1.0.9' );

/**
* BuddyPress compliments text domain.
Expand Down Expand Up @@ -65,19 +65,43 @@ function bp_compliments_init() {
$table_prefix = apply_filters( 'bp_core_get_table_prefix', $wpdb->base_prefix );
////define the plugin table.
define( 'BP_COMPLIMENTS_TABLE', $table_prefix . 'bp_compliments' );

if( file_exists(BP_COMPLIMENTS_DIR . 'vendor/autoload.php' ) ){
require_once( BP_COMPLIMENTS_DIR . 'vendor/autoload.php' );
}
// only supported in BP 1.5+
if ( version_compare( BP_VERSION, '1.3', '>' ) ) {
require( constant( 'BP_COMPLIMENTS_DIR' ) . '/bp-compliments-core.php' );

// show admin notice for users on BP 1.2.x
} else {
add_action( 'admin_notices', 'bp_compliments_older_version_notice' );

return;
}
}
add_action( 'bp_include', 'bp_compliments_init' );
add_action( 'init', 'bp_compliments_plugin_init' );
/**
* Hook into actions and filters on site init.
*/
function bp_compliments_plugin_init(){
add_action( 'tgmpa_register', 'bp_compliments_require_plugins');
}

/**
* Add required plugin check.
*/
function bp_compliments_require_plugins(){
$plugins = array( /* The array to install plugins */ );
$plugins = array(
array(
'name' => 'BuddPress',
'slug' => 'buddypress',
'required' => true, // this plugin is recommended
'version' => '1.5'
)
);
$config = array( /* The array to configure TGM Plugin Activation */ );
tgmpa( $plugins, $config );
}

/**
* Creates Custom table for BuddyPress compliments.
Expand Down Expand Up @@ -147,7 +171,10 @@ function bp_compliments_deactivate() {
function bp_compliments_activation_redirect() {
if ( get_option( 'bp_compliments_activation_redirect', false ) ) {
delete_option( 'bp_compliments_activation_redirect' );
wp_redirect( admin_url( 'admin.php?page=bp-compliment-settings' ) );
if(class_exists('BuddyPress')){
wp_redirect( admin_url( 'admin.php?page=bp-compliment-settings' ) );
exit;
}
}
}

Expand All @@ -172,19 +199,8 @@ function bp_compliments_localization() {
}
add_action( 'plugins_loaded', 'bp_compliments_localization' );

add_action( 'admin_notices', 'bp_compliments_required_plugins_nag' );
function bp_compliments_required_plugins_nag() {
// Check for BuddyPress
$class = "update-nag";
$url = 'https://wordpress.org/plugins/buddypress/';
$message = sprintf( wp_kses( __( 'BuddyPress Compliments requires <a target="_blank" href="%s">BuddyPress</a> plugin.', 'bp-compliments' ), array( 'a' => array( 'href' => array() ) ) ), esc_url( $url ) );
if(!class_exists('BuddyPress')){
echo"<div class=\"$class\"> <p>$message</p></div>";
}
}

function bp_compliments_older_version_notice() {
$older_version_notice = __( "Hey! BP Compliments requires BuddyPress 1.5 or higher.", 'bp-compliments' );

echo '<div class="error"><p>' . $older_version_notice . '</p></div>';
}
75 changes: 0 additions & 75 deletions change_log.txt

This file was deleted.

17 changes: 17 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "ayeCode/buddypress_compliments",
"description": "Compliments module for BuddyPress.",
"type": "project",
"require": {
"tgmpa/tgm-plugin-activation": "dev-master"
},
"authors": [
{
"name": "AyeCode",
"email": "[email protected]",
"homepage": "https://ayecode.io",
"role": "Developer"
}
],
"minimum-stability": "dev"
}
Loading

0 comments on commit 88077af

Please sign in to comment.