Tagged: groups
People are use to pages on Facebook. When they post a new post on Facebook as an admin of that page it does not show their personal profile as posting to the page.
How can you setup groups to have the option that when admin or moderator posts to the group it shows just groups name?
Example group name: Outdoor Hiking
When you post it should say, “Outdoor Hiking created a new post”, and not “John Doe creating a new post in the group Outdoor Hiking”.
Can this be done with a snippet code?
Thank you for helping.
Hi Roni,
Thank you for the question.You can do it by filtering the group activity actions to replace user with the the group.
Regards
BrajeshThank you. Is this setting in the wordpress admin panel somewhere?
Hi Roni,
No, you will need to custom code it.I will ask @ravisharma tomorrow to see if he can put some code as example here.
Regards
BrajeshThat will be great! I appreciate it and so will our users!
Hi Roni,
Hope you are doing well.Just an update on this, we had a holiday today due to Diwali here(festival). I did not consider that while replying earlier.
@ravisharma will be available on Monday and assist you then.Thank you
BrajeshHello Roni,
Please check the following code. It will modify activity action for activities posted by the group’s admin or moderator.
/** * Modify group action * * @param string $action Group action. * @param BP_Activity_Activity $activity Activity object. * * @return string */ function buddydev_modify_groups_activity_action( $action, $activity ) { if ( 'groups' != $activity->component || 'activity_update' != $activity->type ) { return $action; } if ( groups_is_user_admin( $activity->user_id, $activity->item_id ) || groups_is_user_mod( $activity->user_id, $activity->item_id ) ) { $group = groups_get_group( $activity->item_id ); $action = sprintf( '<a href="%s">%s</a> posted an update.</a>', bp_get_group_permalink( $group ), $group->name ); } return $action; } add_action( 'bp_get_activity_action', 'buddydev_modify_groups_activity_action', 10, 2 );
Please let me know if it works or not.
Regards
RaviThank you very much. However, where do I place this code? What file?
Hello Roni,
Try in “bp-custom.php file”. Take a look at the following URL:
https://buddydev.com/docs/buddypress-guides/what-is-bp-custom-php/
Regards
RaviYES! It worked! Thank you Ravi! This is such a huge needed feature for Buddypress! Corporations that sign up for a social network don’t want their personal user profile to be seen when they post on their company group page.
Thank you very much!
You must be logged in to reply to this topic.