Skip to content

Commit

Permalink
Update code
Browse files Browse the repository at this point in the history
  • Loading branch information
raftaar1191 committed Oct 4, 2024
1 parent ced261f commit a21f74d
Show file tree
Hide file tree
Showing 12 changed files with 210 additions and 8 deletions.
2 changes: 1 addition & 1 deletion build/css/backend.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array(), 'version' => '8c5b220bf6f482881a90');
<?php return array('dependencies' => array(), 'version' => '94f0a0b1ab64ca7caf6a');
3 changes: 3 additions & 0 deletions build/css/backend.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/css/frontend.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array(), 'version' => 'a4f0c497198fb9a32f33');
<?php return array('dependencies' => array(), 'version' => '1c44fb6d6b7c0528017d');
97 changes: 96 additions & 1 deletion build/css/frontend.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions build/css/frontend.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/js/backend.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array(), 'version' => '31d6cfe0d16ae931b73c');
<?php return array('dependencies' => array(), 'version' => '67b3fb99c5e63f20e616');
7 changes: 7 additions & 0 deletions build/js/backend.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/******/ (() => { // webpackBootstrap
/*!***************************!*\
!*** ./src/js/backend.js ***!
\***************************/

/******/ })()
;
2 changes: 1 addition & 1 deletion build/js/frontend.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array(), 'version' => 'c22719989000470787dd');
<?php return array('dependencies' => array(), 'version' => '8656e8776b4195bbf712');
40 changes: 39 additions & 1 deletion build/js/frontend.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions build/js/frontend.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 27 additions & 1 deletion public/partials/post-anonymously-public-render-activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,33 @@ public function hooks() {
* Hook to add filter so that the normal user can not see the Post author data
*/
add_filter( 'bp_groups_format_activity_action_activity_update', array( $this, 'group_activity_update' ), 1000, 2 );


/**
* Update comment edit data so when reply to the hidden comment usename is not show
*/
add_filter( 'bb_activity_comment_get_edit_data', array( $this, 'comment_get_edit_data' ), 1000 );

}

/**
* Updage the edit comment
*/
public function comment_get_edit_data( $edit_data ) {

if ( ! isset( $edit_data['id'] ) ) {
return $edit_data;
}

if ( ! $this->_functions->is_anonymously_activity( $edit_data['id'] ) ) {
return $edit_data;
}

$edit_data['content'] = '';
$edit_data['user_id'] = '';
$edit_data['nickname'] = '';

return $edit_data;
}

/**
Expand Down Expand Up @@ -192,6 +219,5 @@ function group_activity_update( $action, $activity ) {

return $action;
}

}

33 changes: 32 additions & 1 deletion public/partials/post-anonymously-public-save-meta.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ public function hooks() {

/**
* Add post meta into the Activity Meta
* Remove this in future
*/
add_action( 'bp_activity_posted_update', array( $this, 'activity_posted_update' ), 1000, 3 );
// add_action( 'bp_activity_posted_update', array( $this, 'activity_posted_update' ), 1000, 3 );


/**
Expand All @@ -81,6 +82,36 @@ public function hooks() {
add_action( 'bp_activity_comment_posted', array( $this, 'activity_comment_posted' ), 1000, 3 );
add_action( 'bp_activity_comment_posted_notification_skipped', array( $this, 'activity_comment_posted' ), 1000, 3 );

/**
* Stop email for the groups new activity of anonymou post.
*/
add_action( 'bp_send_email', array( $this, 'email_sending' ), 1000, 4 );

}

/**
* Do not send email for the anonymou post in groups
*/
public function email_sending( $email, $email_type, $to, $args ) {

if ( 'groups-new-activity' != $email_type ) {
return;
}

if ( ! isset( $args['tokens']['activity'] ) ) {
return;
}

$activity = $args['tokens']['activity'];
if ( ! isset( $activity->id ) ) {
return;
}

if ( ! $this->_functions->is_anonymously_activity( $activity->id ) ) {
return;
}

$email->set_to( '' );
}

/**
Expand Down

0 comments on commit a21f74d

Please sign in to comment.