Last active
February 13, 2022 22:20
-
-
Save KaineLabs/be61c1ff9fddfcb453f7a003294e6c4d to your computer and use it in GitHub Desktop.
Post On Other Users Wall !
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Display Posting Form In Friends Wall. | |
*/ | |
add_action( 'bp_before_member_activity_post_form', 'yzc_add_posting_form_in_friends_wall' ); | |
function yzc_add_posting_form_in_friends_wall() { | |
if ( is_user_logged_in() && ! bp_is_my_profile() && bp_is_user() ) { | |
add_filter( 'gettext', 'yzc_change_whats_new_msg', 10 ); | |
bp_get_template_part( 'activity/post-form' ); | |
remove_filter( 'gettext', 'yzc_change_whats_new_msg', 10 ); | |
} | |
} | |
add_filter( 'bp_get_activity_action_pre_meta' , 'youzify_activity_action_wall_postss', 1000, 2 ); | |
function youzify_activity_action_wall_postss( $action, $activity ) { | |
$mentioned_user_id = bp_activity_get_meta( $activity->id, 'yzc_mentioned_wall' ); | |
if ( ! empty( $mentioned_user_id ) ) { | |
if ( bp_is_my_profile() && $mentioned_user_id == bp_displayed_user_id() ) { | |
return sprintf( __( '%1s wrote on your wall', 'youzify' ), bp_core_get_userlink( $activity->user_id ) ); | |
} else { | |
return sprintf( __( '%1s wrote on %2s', 'youzify' ), bp_core_get_userlink( $activity->user_id ), bp_core_get_userlink( $mentioned_user_id ) ); | |
} | |
} | |
return $action; | |
} | |
add_action( 'youzify_after_adding_wall_post', 'yzc_mark_activity_as_mentioned', 10 ); | |
function yzc_mark_activity_as_mentioned( $activity_id ) { | |
bp_activity_update_meta( $activity_id, 'yzc_mentioned_wall', bp_displayed_user_id() ); | |
} | |
/** | |
* Edit Status Content To Include @Username. | |
*/ | |
function yzc_edit_status_content( $status ) { | |
if ( isset( $_POST['youzify_friend_display_name'] ) && ! empty( $_POST['youzify_friend_display_name'] ) ) { | |
return '@' . $_POST['youzify_friend_display_name'] . ' ' . $status; | |
} | |
return $status; | |
} | |
add_filter( 'youzify_bp_activity_post_update_content', 'yzc_edit_status_content' ); | |
function yzc_change_whats_new_msg( $translated_text ) { | |
switch( $translated_text ) { | |
case "What's new, %s?": | |
return sprintf( 'Write something on %s wall...', bp_get_displayed_user_fullname() ); | |
} | |
return $translated_text; | |
} | |
/** | |
* Add Friends Post Form Custom Value. | |
*/ | |
function yzc_add_activity_custom_input() { | |
if ( ! bp_is_my_profile() && bp_is_user() ) { ?> | |
<input type="hidden" name="youzify_friend_display_name" value="<?php echo bp_get_displayed_user_username(); ?>"> | |
<?php } | |
} | |
add_action ( 'bp_activity_post_form_options', 'yzc_add_activity_custom_input' ); | |
/** | |
* Edit Personal Feed To include Mentions. | |
*/ | |
function yzc_edit_personal_activity_feed_to_include_mentions( $loop ) { | |
if ( ! bp_is_my_profile() && bp_is_user() && bp_is_current_component( 'activity') && isset( $loop['scope'] ) && $loop['scope'] == 'just-me' ) { | |
$loop['scope'] = 'just-me,mentions'; | |
} | |
return $loop; | |
} | |
add_filter( 'bp_after_has_activities_parse_args', 'yzc_edit_personal_activity_feed_to_include_mentions' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I want to remove this from the wall how can I do it? http://prntscr.com/oqf603