Did you find a solution to recover the activity stream? My private group activity stream is no longer showing past activity even though the activity is still in the database.
Okey, here is the correct code, thanks to @brajesh
// Adding message button in members directory
function filter_message_button_link( $link ) {
$link = wp_nonce_url( bp_loggedin_user_domain() . bp_get_messages_slug() . '/compose/?r='. bp_core_get_username( bp_get_member_user_id() ) );
return $link;
}
function display_private_message_button() {
if( is_user_logged_in() && bp_get_member_user_id() != bp_loggedin_user_id() ) {
//bp_send_message_button();
?>
<div id="send-private-message" class="generic-button">
<div class="private-message-button generic-button" ><a href="<?php echo filter_message_button_link(); ?>" class="button small secondary radius" rel="add"><i class="icon-envelope"></i></a></div>
</div>
<?php
add_filter('bp_get_send_private_message_link', 'filter_message_button_link', 1, 1 );
}
}
add_action( 'bp_directory_members_item_last', 'display_private_message_button',9999 );
I’m trying to set up a membership site and may go with WooCommerce Membership. But I have a hard time finding a way to solve a problem.
When a member’s membership (via WooCommerce Membership) is cancelled, his Buddypress WordPress user account is still active, which means he can still log in and freely contact other members. i need to find a way to restrict these cancelled members from accessing BP entirely, or at least from Private Message so they can’t contact other members.
So far the closest one i found is this thread
https://buddypress.org/support/topic/hiderestrict-access-to-private-messaging/#post-170393
According to the note, USER_TO_DISALLOW would be my cancelled WooCommerce users. But I wouldn’t know which member would cancel (or their membership level) upfront so this codes don’t seem to work for my site. Besides, it’s 4+ years old and I’m not sure if it’s still relevant.
The other one is
https://buddypress.org/support/topic/restrict-private-messages/
The moderator said there’s a hook available in BuddyPress called messages_message_before_save which can be used to do things before a message is sent. But I don’t know how to write a function to customize it for my need.
Can anyone help? If you happen to know any other membership plugins that can achieve this, I’d really appreciate if you can let me know.
Thank you.
I am trying to build a contact form that I can load on any page that would send a private message to a user. I already have the selected user/s in an array and now I would like to take that plus form data to (I’m guessing) message_new_message
Sample HTML Form
<form>
<label>Subject</label>
<input id="subjec_input" name="subject_input" type="text">
<label>Message Body</label>
<textarea id="body_input" name="body_input"></textarea>
<button id="submit_btn" name="submit_btn">Submit</button>
</form>
How I think arguments are given to the function
`messages_new_message( $args = array( ‘recipients’ => $user_id, ‘subject’ => $title, ‘content’ => $message );
Any help would be appreciated. Thanks
Help me with the code.
I need the Message button visible only to logged in users (Just like the Add Friend button works).
Check the code, please.
// Adding message button in members loop
function filter_message_button_link( $link ) {
$link = wp_nonce_url( bp_loggedin_user_domain() . bp_get_messages_slug() . '/compose/?r='. bp_core_get_username( bp_get_member_user_id() ) );
return $link;
}
function display_private_message_button() {
if( bp_get_member_user_id() != bp_loggedin_user_id() ) {
//bp_send_message_button();
?>
<div id="send-private-message" class="generic-button">
<div class="private-message-button generic-button" ><a href="<?php echo filter_message_button_link(); ?>" class="button small secondary radius" rel="add"><i class="icon-envelope"></i></a></div>
</div>
<?php
add_filter('bp_get_send_private_message_link', 'filter_message_button_link', 1, 1 );
}
}
add_action( 'bp_directory_members_item_last', 'display_private_message_button',9999 );
@modemlooper
@sbrajesh
@mercime
Have you tried BP Simple Private ?
You can also get it here: PhiloPress
Robin W over at bbPress was kind enough to provide this filter for functions.php:
add_filter( 'bbp_get_topic_subscribers', 'rew_filter_subscrbers' );
add_filter( 'bbp_get_forum_subscribers', 'rew_filter_subscrbers' );
function rew_filter_subscribers ($users) {
$role = 'my_custom_role' ;
$filtered_ids = array();
foreach ( (array) $users as $user_id ) {
$user_info = get_userdata($user_id);
$user_roles = $user_info->roles ;
if (!in_array ($role, $user_roles)) {
array_push($filtered_IDs, $user_id);
}
}
return $filtered_ids ;
}
Used with a custom role, it works great at preventing emails from going out from bbPress.
Of course, BuddyPress sends out several emails (friend request, private messages, etc).
Any ideas on how I can modify the filter above to prevent sending of BuddyPress emails to user if they have a custom role enabled? Even a place to go where I might find some ideas to work with?
Thanks for any suggestions.
I did end up installing this plugin and it is exactly what I was looking for so thank you!! I would like to request that this question be taken down, if that is ok. It shows up in a google search when I do a search for my domain and I have set it to private in order for it to not show up in a search. If this isn’t possible, than I understand. I just thought I’d ask. Thank you once again for your time and for all of your help!!
Take care,
Kari
Thank you so much for your help!! I would like to request that this question be taken down, if that is ok. It shows up in a google search when I do a search for my domain and I have set it to private in order for it to not show up in a search. If this isn’t possible, than I understand. I just thought I’d ask. Thank you once again for your time and for all of your help!!
Take care,
Kari
// Restrict Private Message to friends.
Does not work with the new BuddyPress. ;-/
BuddyPress has a API that you can use: https://codex.buddypress.org/component/private-messages/
You can hook at the WooCommerce actions when sending the emails and send your private messages.
Hope that helps! 🙂
Nice , Thanks. Actually i d like to change messaging logic a little bit. In case of writing to user a private message i d like not to create a new message thread object, but to search instead for existing message thread between me and the user. If there is one, send my message to that thread and open existing dialog. I ve researched send function and i came to conclusion ,that i must change the function.
I believe that wont hurt the logic.I m alomost sure. What d say other participants about my idea?
There is a plugin called BP Simple Private that allows you to restrict access to all Buddypress pages to logged in users only. Then, if people try to visit Buddypress pages after you install the plugin, they will get redirected to the home page.
But if I’m understanding you wrong – and you want to have a separate site just for your buddypress groups, then I will recommend setting up WordPress Multisite.
And if I’m understanding you right – which bells and whistles do you want to disable? I’ve disabled a few things with CSS & PHP hacks – but like what do you want to see gone?
Hi, i was thinking of using the plugin bb media for the users to upload numerous photos to their profiles. As i think with buddypress and bb press the profile only allows one main photo.
Ultimately I would like the users to have a main photo and then their own private photo gallery which other users can see all their profile and gallery photos
Have you tried: BP Simple Private ?
Can I create private groups in which the contents are public for the whole world?
To prevent non-members from viewing the members directory you can use this plugin:
BP Simple Private
You could probably run a cronjob to remove various activity items and private message threads if they’re older than a certain interval.
Of course, this would need to be custom-developed.
Private messaging in BuddyPress is persistent (saved to the db). There is also “flash” messages but these are stored as a cookie and are removed after the page request.
The widget’s ajax call does not check to see who is viewing it.
So only public groups will appear; hidden & private groups will not appear even though you are a member.
You could write your own widget that uses the logged-in member’s id.
Use the group widget code as a reference:
buddypress\bp-groups\bp-groups-widgets.php
Hi @arbolife any chance you even vaguely remember what you did to get new user activation email being sent out when using WPML + BuddyPress? Like you, everything works 100% correctly on the ‘English’ side when new users register, requests membership for a private BP group, logs-in, etc – BUT if a user registers on the french registration page (fr/register/) they never get any emails (I they are foever listed as “pending” in the user area). I’ve also noticed that no emails (outgoing) get triggered if an existing user switches to the /fr/ side & tries to join a private BuddyPress group. Trying to access the /fr/wp-login.php page (or the password reset) from the /fr/ side will also trigger a 404 page. So, like you mentioned, it’s a setting “somewhere” in WPML to resolve these (many) anomalies, but for whatever reason, I can’t see to find the resolution!
My test setup:
WP: 3.7.4
BP: 2.8.2
WPML: 3.7.0
BuddyPress WPML Plugin: 1.5.5.1
-Jeff
I’m going to do the bump.. But let’s take an easier approach to this topic:
Anyone know how I can at least prevent the member-header from being displayed upon creation of a private message?
Let’s forget about sticking the recipient’s photo in there for now, and take it one step at a time.
I just don’t know which file this involves. compose.php seems to make no reference to bp_displayed_user_avatar(), so I’m wondering why is the avatar appearing?
I would like to hide “Send To (Username or Friend’s Name)” from the private message compose page. Can this be achieved by css or does it require editing of other files?
Optionally, I would like to hide change the wording of this.
Can anyone advise on to best achieve one of the above? Thank you.