From 94934df90cde45b967082ff7f80549f66252d208 Mon Sep 17 00:00:00 2001 From: Giri Date: Tue, 14 Jul 2015 13:50:43 +0530 Subject: [PATCH] setting added for number of compliments to display per page --- change_log.txt | 3 +- css/bp-compliments.css | 1 + includes/bp-compliments-taxonomies.php | 10 ++++++- .../buddypress/members/single/compliments.php | 5 +++- languages/bp-compliments-en_US.mo | Bin 522 -> 522 bytes languages/bp-compliments-en_US.po | 26 ++++++++++-------- 6 files changed, 31 insertions(+), 14 deletions(-) diff --git a/change_log.txt b/change_log.txt index 3c4bace..543be2d 100644 --- a/change_log.txt +++ b/change_log.txt @@ -2,7 +2,8 @@ v0.0.3 Validation added when adding compliment, icon required - FIXED Some strings are not translatable - FIXED Docblocks added to all functions, filters and actions - ADDED -Setting added for Members can delete compliments received? - ADDED +Members can delete compliments received? setting - ADDED +Number of Compliments to display per page setting - ADDED v0.0.2 BP compliments now supports notification component - ADDED diff --git a/css/bp-compliments.css b/css/bp-compliments.css index 8b65792..ae55534 100644 --- a/css/bp-compliments.css +++ b/css/bp-compliments.css @@ -113,6 +113,7 @@ display: block; border-bottom: 1px solid #ccccc8; padding: 10px 5px; + margin-left: 0; } .gd-list-item-author.comp-user { padding-left: 0; diff --git a/includes/bp-compliments-taxonomies.php b/includes/bp-compliments-taxonomies.php index a1cddf2..9318247 100644 --- a/includes/bp-compliments-taxonomies.php +++ b/includes/bp-compliments-taxonomies.php @@ -9,7 +9,7 @@ add_action('admin_menu', 'register_compliments_submenu_page'); /** - * Register compliments submenu under Settings page. + * Register Compliments menu below Settings menu. * * @since 0.0.1 * @package BuddyPress_Compliments @@ -237,6 +237,7 @@ function compliment_remove_parent_dropdown() add_action( 'admin_init', 'bp_compliments_register_settings' ); function bp_compliments_register_settings() { register_setting( 'bp-compliment-settings', 'bp_compliment_can_delete' ); + register_setting( 'bp-compliment-settings', 'bp_comp_per_page' ); } function bp_compliments_settings_page() { @@ -249,6 +250,9 @@ function bp_compliments_settings_page() { @@ -259,6 +263,10 @@ function bp_compliments_settings_page() { + + + +
diff --git a/includes/templates/buddypress/members/single/compliments.php b/includes/templates/buddypress/members/single/compliments.php index 6b337cc..fcf9e39 100644 --- a/includes/templates/buddypress/members/single/compliments.php +++ b/includes/templates/buddypress/members/single/compliments.php @@ -17,7 +17,10 @@ ); $count_array = bp_compliments_total_counts($count_args); $total = (int)$count_array['received']; - $items_per_page = 5; + + $comp_per_page_value = esc_attr( get_option('bp_comp_per_page')); + $items_per_page = $comp_per_page_value ? (int) $comp_per_page_value : 5; + $page = isset($_GET['cpage']) ? abs((int)$_GET['cpage']) : 1; $offset = ($page * $items_per_page) - $items_per_page; $args = array( diff --git a/languages/bp-compliments-en_US.mo b/languages/bp-compliments-en_US.mo index 62bf8d6ae8ac2885c46275b289aa51622e6cad88..31c8970a642a4c2dd10669bfa5a39517fa2c8f6b 100644 GIT binary patch delta 29 fcmeBT>0+7C#%`iuXl!L-F|k(>%Cy|LHIxwmcAp3N delta 29 ecmeBT>0+7C#%`=&Xl7+\n" "Language: en_US\n" @@ -105,12 +105,12 @@ msgid "" msgstr "" #: includes/bp-compliments-notifications.php:278 -#: includes/bp-compliments-taxonomies.php:258 +#: includes/bp-compliments-taxonomies.php:262 msgid "Yes" msgstr "" #: includes/bp-compliments-notifications.php:279 -#: includes/bp-compliments-taxonomies.php:259 +#: includes/bp-compliments-taxonomies.php:263 msgid "No" msgstr "" @@ -198,39 +198,43 @@ msgstr "" msgid "Icon" msgstr "" -#: includes/bp-compliments-taxonomies.php:245 +#: includes/bp-compliments-taxonomies.php:246 msgid "BuddyPress Compliments - Settings" msgstr "" -#: includes/bp-compliments-taxonomies.php:255 +#: includes/bp-compliments-taxonomies.php:259 msgid "Members can delete compliments received?" msgstr "" +#: includes/bp-compliments-taxonomies.php:267 +msgid "Number of Compliments to display per page?" +msgstr "" + #: includes/bp-compliments-templatetags.php:83 msgid "Send Compliment" msgstr "" -#: includes/templates/buddypress/members/single/compliments.php:67 +#: includes/templates/buddypress/members/single/compliments.php:70 msgid "Delete" msgstr "" -#: includes/templates/buddypress/members/single/compliments.php:99 +#: includes/templates/buddypress/members/single/compliments.php:102 #, php-format msgid "1 of 1" msgid_plural "%1$s to %2$s of %3$s" msgstr[0] "" msgstr[1] "" -#: includes/templates/buddypress/members/single/compliments.php:102 +#: includes/templates/buddypress/members/single/compliments.php:105 msgid "Go to Page" msgstr "" -#: includes/templates/buddypress/members/single/compliments.php:119 +#: includes/templates/buddypress/members/single/compliments.php:122 msgid "" "Aw, you have no compliments yet. To get some try sending compliments to " "others." msgstr "" -#: includes/templates/buddypress/members/single/compliments.php:125 +#: includes/templates/buddypress/members/single/compliments.php:128 msgid "Sorry, no compliments just yet." msgstr ""