Skip to content

Commit

Permalink
Email notifications not working - FIXED
Browse files Browse the repository at this point in the history
  • Loading branch information
viruthagiri committed Mar 10, 2016
1 parent 66d1a0a commit 0acc7ea
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 18 deletions.
1 change: 1 addition & 0 deletions change_log.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ v1.0.4
Compliment user settings page - ADDED
Linebreaks are removed on compliment messages - FIXED
Compliments message links are clickable - ADDED
Email notifications not working - FIXED

v1.0.1
Use singular name instead of slug name - FIXED
Expand Down
16 changes: 3 additions & 13 deletions includes/bp-compliments-notifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,11 @@ function bp_compliments_notifications_add_on_compliment( BP_Compliments $complim
* @since 0.0.2
* @package BuddyPress_Compliments
*
* @param array $args Sender and Receiver user ID.
* @return bool
*/
function bp_compliments_new_compliment_email_notification() {
$args = '';
function bp_compliments_new_compliment_email_notification($args = array()) {
// $args = '';

$defaults = array(
'receiver_id' => bp_displayed_user_id(),
Expand All @@ -166,17 +167,6 @@ function bp_compliments_new_compliment_email_notification() {
if ( 'no' == bp_get_user_meta( (int) $r['receiver_id'], 'notification_on_compliments', true ) )
return false;

// Check to see if this receiver has already been notified of this sender before
$has_notified = bp_get_user_meta( $r['sender_id'], 'bp_compliments_has_notified', true );

// Already notified so don't send another email
if ( in_array( $r['receiver_id'], (array) $has_notified ) )
return false;

// Not been notified before, update usermeta and continue to mail
$has_notified[] = $r['receiver_id'];
bp_update_user_meta( $r['sender_id'], 'bp_compliments_has_notified', $has_notified );

$sender_name = bp_core_get_user_displayname( $r['sender_id'] );
$compliment_link = bp_core_get_user_domain( $r['receiver_id'] ) .BP_COMPLIMENTS_SLUG. '/?bpc_read=true&bpc_sender_id='.$r['sender_id'];

Expand Down
8 changes: 4 additions & 4 deletions includes/bp-compliments-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function bp_compliments_settings_page() {
<td><input type="text" class="widefat" name="bp_compliment_slug" value="<?php echo BP_COMPLIMENTS_SLUG; ?>" /></td>
</tr>
<tr valign="top">
<th scope="row"><?php echo sprintf( __( 'Who can see other members %s page?', 'bp-compliments' ), strtolower(BP_COMP_SINGULAR_NAME) ); ?></th>
<th scope="row"><?php echo sprintf( __( 'Who can see other members %s page?', 'bp-compliments' ), BP_COMP_SINGULAR_NAME ); ?></th>
<td>
<select id="bp_compliment_can_see_others_comp" name="bp_compliment_can_see_others_comp">
<option value="yes" <?php selected( $bp_compliment_can_see_others_comp, 'yes' ); ?>><?php echo __( 'Anybody', 'bp-compliments' ); ?></option>
Expand All @@ -83,7 +83,7 @@ function bp_compliments_settings_page() {
</td>
</tr>
<tr valign="top">
<th scope="row"><?php echo sprintf( __( 'Members can delete %s received?', 'bp-compliments' ), strtolower(BP_COMP_PLURAL_NAME) ); ?></th>
<th scope="row"><?php echo sprintf( __( 'Members can delete %s received?', 'bp-compliments' ), BP_COMP_PLURAL_NAME ); ?></th>
<td>
<select id="bp_compliment_can_delete" name="bp_compliment_can_delete">
<option value="yes" <?php selected( $bp_compliment_can_delete, 'yes' ); ?>><?php echo __( 'Yes', 'bp-compliments' ); ?></option>
Expand All @@ -92,7 +92,7 @@ function bp_compliments_settings_page() {
</td>
</tr>
<tr valign="top">
<th scope="row"><?php echo sprintf( __( 'Enable activity component for %s ?', 'bp-compliments' ), strtolower(BP_COMP_PLURAL_NAME) ); ?></th>
<th scope="row"><?php echo sprintf( __( 'Enable activity component for %s ?', 'bp-compliments' ), BP_COMP_PLURAL_NAME ); ?></th>
<td>
<select id="bp_compliment_enable_activity" name="bp_compliment_enable_activity">
<option value="yes" <?php selected( $bp_compliment_enable_activity, 'yes' ); ?>><?php echo __( 'Yes', 'bp-compliments' ); ?></option>
Expand All @@ -101,7 +101,7 @@ function bp_compliments_settings_page() {
</td>
</tr>
<tr valign="top">
<th scope="row"><?php echo sprintf( __( 'Enable notification component for %s ?', 'bp-compliments' ), strtolower(BP_COMP_PLURAL_NAME) ); ?></th>
<th scope="row"><?php echo sprintf( __( 'Enable notification component for %s ?', 'bp-compliments' ), BP_COMP_PLURAL_NAME ); ?></th>
<td>
<select id="bp_compliment_enable_notifications" name="bp_compliment_enable_notifications">
<option value="yes" <?php selected( $bp_compliment_enable_notifications, 'yes' ); ?>><?php echo __( 'Yes', 'bp-compliments' ); ?></option>
Expand Down
3 changes: 2 additions & 1 deletion includes/templates/buddypress/members/single/compliments.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ class='preview-upload'/>
</div>
</div>
<?php
echo make_clickable(apply_filters('the_content', $comp->message)); ?>
$comp_message = apply_filters('bp_comp_message', $comp->message);
echo $comp_message; ?>
</div>
</div>
</li>
Expand Down

0 comments on commit 0acc7ea

Please sign in to comment.