Skip to content

Commit

Permalink
Merge pull request #8 from mistergiri/master
Browse files Browse the repository at this point in the history
setting added for number of compliments to display per page
  • Loading branch information
NomadDevs authored and NomadDevs committed Jul 14, 2015
2 parents 7759c74 + 94934df commit ea6b684
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 14 deletions.
3 changes: 2 additions & 1 deletion change_log.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions css/bp-compliments.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 9 additions & 1 deletion includes/bp-compliments-taxonomies.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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() {
Expand All @@ -249,6 +250,9 @@ function bp_compliments_settings_page() {
<?php do_settings_sections( 'bp-compliment-settings' );
$bp_compliment_can_delete_value = esc_attr( get_option('bp_compliment_can_delete'));
$bp_compliment_can_delete = $bp_compliment_can_delete_value ? $bp_compliment_can_delete_value : 'yes';

$comp_per_page_value = esc_attr( get_option('bp_comp_per_page'));
$comp_per_page = $comp_per_page_value ? (int) $comp_per_page_value : 5;
?>
<table class="form-table">
<tr valign="top">
Expand All @@ -259,6 +263,10 @@ function bp_compliments_settings_page() {
<option value="no" <?php selected( $bp_compliment_can_delete, 'no' ); ?>><?php echo __( 'No', BP_COMP_TEXTDOMAIN ); ?></option>
</select>
</tr>
<tr valign="top">
<th scope="row"><?php echo __( 'Number of Compliments to display per page?', BP_COMP_TEXTDOMAIN ); ?></th>
<td><input type="number" name="bp_comp_per_page" value="<?php echo $comp_per_page; ?>" /></td>
</tr>
</table>

<?php submit_button(); ?>
Expand Down
5 changes: 4 additions & 1 deletion includes/templates/buddypress/members/single/compliments.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Binary file modified languages/bp-compliments-en_US.mo
Binary file not shown.
26 changes: 15 additions & 11 deletions languages/bp-compliments-en_US.po
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
msgid ""
msgstr ""
"Project-Id-Version: BuddyPress Compliments 0.0.2\n"
"POT-Creation-Date: 2015-07-13 16:54+0530\n"
"PO-Revision-Date: 2015-07-13 16:54+0530\n"
"POT-Creation-Date: 2015-07-14 13:48+0530\n"
"PO-Revision-Date: 2015-07-14 13:49+0530\n"
"Last-Translator: \n"
"Language-Team: GeoDirectory <[email protected]>\n"
"Language: en_US\n"
Expand Down Expand Up @@ -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 ""

Expand Down Expand Up @@ -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 ""

0 comments on commit ea6b684

Please sign in to comment.