diff --git a/bp-compliments-core.php b/bp-compliments-core.php index f458d95..ab40e5b 100644 --- a/bp-compliments-core.php +++ b/bp-compliments-core.php @@ -67,8 +67,6 @@ public function includes( $includes = array() ) { require( $this->path . '/bp-compliments-classes.php' ); // Functions related to compliment component. require( $this->path . '/bp-compliments-functions.php' ); - // Functions related to compliment types and icons. - require( $this->path . '/bp-compliments-taxonomies.php' ); // Functions related to frontend content display. require( $this->path . '/bp-compliments-screens.php' ); // Functions related to compliment buttons and template tags. @@ -81,6 +79,10 @@ public function includes( $includes = array() ) { require( $this->path . '/bp-compliments-activity.php' ); // Functions related to compliment forms. require( $this->path . '/bp-compliments-forms.php' ); + // Functions related to compliment settings. + require( $this->path . '/bp-compliments-settings.php' ); + // Functions related to compliment types and icons. + require( $this->path . '/bp-compliments-taxonomies.php' ); } /** @@ -95,9 +97,6 @@ public function includes( $includes = array() ) { public function setup_globals( $args = array() ) { global $bp; - if ( ! defined( 'BP_COMPLIMENTS_SLUG' ) ) - define( 'BP_COMPLIMENTS_SLUG', 'compliments' ); - // Set up the $globals array $globals = array( 'notification_callback' => 'bp_compliments_format_notifications', @@ -176,7 +175,7 @@ public function setup_nav( $main_nav = array(), $sub_nav = array() ) { } bp_core_new_nav_item( array( - 'name' => sprintf( __( 'Compliments %d', BP_COMP_TEXTDOMAIN ), $counts['received'] ), + 'name' => BP_COMP_PLURAL_NAME." "."".$counts['received']."", 'slug' => $bp->compliments->compliments->slug, 'position' => $this->params['adminbar_myaccount_order'], 'screen_function' => 'bp_compliments_screen_compliments', diff --git a/bp-compliments.php b/bp-compliments.php index 3eedfaa..071bb59 100644 --- a/bp-compliments.php +++ b/bp-compliments.php @@ -25,6 +25,13 @@ * BuddyPress compliments text domain. */ define( 'BP_COMP_TEXTDOMAIN', 'bp-compliments' ); +/** + * BuddyPress compliments names. + */ +define( 'BP_COMP_SINGULAR_NAME', trim(esc_attr( get_option('bp_compliment_singular_name', __( 'Compliment', BP_COMP_TEXTDOMAIN )))) ); +define( 'BP_COMP_PLURAL_NAME', trim(esc_attr( get_option('bp_compliment_plural_name', __( 'Compliments', BP_COMP_TEXTDOMAIN )))) ); +define( 'BP_COMPLIMENTS_SLUG', strtolower(trim(esc_attr( get_option('bp_compliment_slug', __( 'compliments', BP_COMP_TEXTDOMAIN ))))) ); + /** * Only load the plugin code if BuddyPress is activated. diff --git a/change_log.txt b/change_log.txt index b0b1749..4a4592f 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,3 +1,6 @@ +v0.0.6 +Compliments can be renamed to anything Ex: "Gifts" - ADDED + v0.0.5 404 error while sending compliments - FIXED diff --git a/includes/bp-compliments-actions.php b/includes/bp-compliments-actions.php index 6ee5735..04cdfbc 100644 --- a/includes/bp-compliments-actions.php +++ b/includes/bp-compliments-actions.php @@ -48,9 +48,9 @@ function handle_compliments_form_data() { $redirect_url = bp_core_get_user_domain($receiver_id); if ( ! bp_compliments_start_compliment($args)) { - bp_core_add_message( sprintf( __( 'There was a problem when trying to send compliment to %s, please contact administrator.', BP_COMP_TEXTDOMAIN ), $receiver_name ), 'error' ); + bp_core_add_message( sprintf( __( 'There was a problem when trying to send %s to %s, please contact administrator.', BP_COMP_TEXTDOMAIN ), strtolower(BP_COMP_SINGULAR_NAME), $receiver_name ), 'error' ); } else { - bp_core_add_message( sprintf( __( 'Your compliment sent to %s.', BP_COMP_TEXTDOMAIN ), $receiver_name ) ); + bp_core_add_message( sprintf( __( 'Your %s sent to %s.', BP_COMP_TEXTDOMAIN ), strtolower(BP_COMP_SINGULAR_NAME), $receiver_name ) ); } $bp_compliment_can_see_others_comp_value = esc_attr( get_option('bp_compliment_can_see_others_comp')); @@ -66,7 +66,7 @@ function handle_compliments_form_data() { } if ($show_for_displayed_user) { - $redirect = $redirect_url.'compliments/'; + $redirect = $redirect_url.BP_COMPLIMENTS_SLUG.'/'; } else { $redirect = $redirect_url; } @@ -130,7 +130,7 @@ function delete_single_complement() { */ do_action( 'bp_compliments_after_remove_compliment', $c_id ); - $redirect = bp_displayed_user_domain().'compliments/'; + $redirect = bp_displayed_user_domain().BP_COMPLIMENTS_SLUG.'/'; bp_core_redirect( $redirect ); } add_action( 'bp_actions', 'delete_single_complement'); diff --git a/includes/bp-compliments-activity.php b/includes/bp-compliments-activity.php index 9b57ed6..7687648 100644 --- a/includes/bp-compliments-activity.php +++ b/includes/bp-compliments-activity.php @@ -103,18 +103,18 @@ function compliments_register_activity_actions() { bp_activity_set_action( $bp->compliments->id, 'compliment_received', - __( 'Compliment Received', BP_COMP_TEXTDOMAIN ), + sprintf( __( '%s Received', BP_COMP_TEXTDOMAIN ), BP_COMP_SINGULAR_NAME ), 'compliments_format_activity_action_compliment_received', - __( 'Compliments', BP_COMP_TEXTDOMAIN ), + BP_COMP_PLURAL_NAME, array( 'activity' ) ); bp_activity_set_action( $bp->compliments->id, 'compliment_sent', - __( 'Compliment Sent', BP_COMP_TEXTDOMAIN ), + sprintf( __( '%s Sent', BP_COMP_TEXTDOMAIN ), BP_COMP_SINGULAR_NAME ), 'compliments_format_activity_action_compliment_sent', - __( 'Compliments', BP_COMP_TEXTDOMAIN ), + BP_COMP_PLURAL_NAME, array( 'activity' ) ); @@ -144,8 +144,8 @@ function compliments_format_activity_action_compliment_received( $action, $activ $receiver_link = bp_core_get_userlink( $activity->user_id ); $sender_link = bp_core_get_userlink( $activity->secondary_item_id ); $receiver_url = bp_core_get_userlink( $activity->user_id, false, true ); - $compliment_url = $receiver_url . $bp->compliments->id . '/?c_id='.$activity->item_id; - $compliment_link = ''.__("compliment", BP_COMP_TEXTDOMAIN).''; + $compliment_url = $receiver_url . BP_COMPLIMENTS_SLUG . '/?c_id='.$activity->item_id; + $compliment_link = ''.strtolower(BP_COMP_SINGULAR_NAME).''; $bp_compliment_can_see_others_comp_value = esc_attr( get_option('bp_compliment_can_see_others_comp')); $bp_compliment_can_see_others_comp = $bp_compliment_can_see_others_comp_value ? $bp_compliment_can_see_others_comp_value : 'yes'; @@ -157,7 +157,7 @@ function compliments_format_activity_action_compliment_received( $action, $activ if ($bp_compliment_can_see_others_comp == 'yes') { $action = sprintf( __( '%1$s has received a %2$s from %3$s', BP_COMP_TEXTDOMAIN ), $receiver_link, $compliment_link, $sender_link ); } else { - $action = sprintf( __( '%1$s has received a compliment from %2$s', BP_COMP_TEXTDOMAIN ), $receiver_link, $sender_link ); + $action = sprintf( __( '%1$s has received a %2$s from %3$s', BP_COMP_TEXTDOMAIN ), $receiver_link, strtolower(BP_COMP_SINGULAR_NAME), $sender_link ); } @@ -188,8 +188,8 @@ function compliments_format_activity_action_compliment_sent( $action, $activity $sender_link = bp_core_get_userlink( $activity->user_id ); $receiver_link = bp_core_get_userlink( $activity->secondary_item_id ); $receiver_url = bp_core_get_userlink( $activity->secondary_item_id, false, true ); - $compliment_url = $receiver_url . $bp->compliments->id . '/?c_id='.$activity->item_id; - $compliment_link = ''.__("compliment", BP_COMP_TEXTDOMAIN).''; + $compliment_url = $receiver_url . BP_COMPLIMENTS_SLUG . '/?c_id='.$activity->item_id; + $compliment_link = ''.strtolower(BP_COMP_SINGULAR_NAME).''; $bp_compliment_can_see_others_comp_value = esc_attr( get_option('bp_compliment_can_see_others_comp')); $bp_compliment_can_see_others_comp = $bp_compliment_can_see_others_comp_value ? $bp_compliment_can_see_others_comp_value : 'yes'; @@ -201,7 +201,7 @@ function compliments_format_activity_action_compliment_sent( $action, $activity if ($bp_compliment_can_see_others_comp == 'yes') { $action = sprintf( __( '%1$s has sent a %2$s to %3$s', BP_COMP_TEXTDOMAIN ), $sender_link, $compliment_link, $receiver_link ); } else { - $action = sprintf( __( '%1$s has sent a compliment to %2$s', BP_COMP_TEXTDOMAIN ), $sender_link, $receiver_link ); + $action = sprintf( __( '%1$s has sent a %2$s to %3$s', BP_COMP_TEXTDOMAIN ), $sender_link, strtolower(BP_COMP_SINGULAR_NAME), $receiver_link ); } /** diff --git a/includes/bp-compliments-forms.php b/includes/bp-compliments-forms.php index 2bcfba0..a979bd1 100644 --- a/includes/bp-compliments-forms.php +++ b/includes/bp-compliments-forms.php @@ -23,7 +23,7 @@ function bp_compliments_modal_form($pid = 0, $receiver_id = 0) {