Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'private message button'

Viewing 25 results - 76 through 100 (of 327 total)
  • Author
    Search Results
  • #263296
    eastw00dx
    Participant

    I would like to add a ‘send private message’ button in a page, does anybody know how?

    Datenfresser
    Participant

    Hi all,
    I’m using the latest version of BuddyPress & found a bug in the private message modul.
    When I write a new message to a member and forget the subject line there is an error message to fill out the subject line –> that’s correct.
    But after fill out the subject line and send on the “send” Button, there is another error message, that the username is not correct! –> that’s the bug. When I fill out the subject line and the body-text in one step, the message can be send without any problems.

    Is this a general bug in BuddyPress?

    Best regards
    Miriam

    http://www.familyship.org

    YesPapa
    Participant

    Hi, Is it possible to add a “private message” button in the members’s directory page.
    I have found this

    but it is not working when I put it in the “bp-custom.php” file.

    Any other ideas?

    Thank you.

    #262727
    luisa227
    Participant

    do you remember that in the user profile appear as buttons to write private or public messages?
    I would like to add more buttons (and I did it – I do not remember which files have changed…) but I wish these buttons are only visible in your profile and not at all (thus the reverse of what happens to the buttons of the listed messages above). How can I do? thank you

    danbp
    Moderator
    jscmal
    Participant

    Hi,
    I would out the Private Message Button in a WordPress Page that I use as Dashboard for the members of my website.

    I would be able to create a Shortcode to Add the “Private Message” Button to the make to make any member able to send me a Private Message directly to me (only to me from the Dashboard).

    1 – The first problem that I have is that I don’t know how to make the button to make eveyrbody able to contact me.

    2 – I would use it like a shortcode to insert it everywhere it is necessary.

    Please, how can I do it?

    I really need support to do it.

    Kind regards

    G. Aloe

    #261060
    empressdianna
    Participant

    Thank you so much for this code! I’ve spent several hours trying to use other people’s code to hide the button and even tried to make my own but nothing worked until I found your code. I just switched it around because I only wanted one particular group to not be able to send messages while the rest can.

    Posting in case someone in the future needs the opposite of your code:

    add_filter( 'bp_get_send_message_button', function( $array ) {
        if ( pmpro_hasMembershipLevel('NAMEOFPMPLEVEL') ) {
            return '';
        } else {
            return $array;
        }
    } );

    Also, I am looking for the same code as you to restrict non-paying users from sending private messages. I found a code that looks promising but unfortunately doesn’t work. It sees if the user is logged in and if not redirects them. Then if the person is logged in it checks their role but if they’re not that role they’re supposed to be redirected. But it just breaks my whole site. Any ideas?

    function my_function() {
    
        if ( ! is_user_logged_in() && bp_is_current_component( 'messages' ) ) {
            // Current user is not logged in so don't let them see stuff. In this case, private messages 
            wp_redirect( home_url() );
            exit;
        }
            
        $flag = false;
        // Get current user info.
        $user = wp_get_current_user();
    
        if ( ! in_array( 'student', $user->roles ) ) {
            // The current member is not a student.
            $flag = true;
        }
    
        if ( $flag && bp_is_current_component( 'messages' )  ) {
            The currently logged-in member is not a student and is trying to view private messaging. Let's redirect them away.
            wp_redirect( home_url() );
            exit;
        }
    }
    add_action( 'init', 'my_function' );
    #260857
    maccast
    Participant

    This works and hides the button, but I’m curious. Can someone still send a private message to another user when they are “not” friends using URL manipulation or should the _wpnonce stop that?

    #260837
    inzerat
    Participant

    1) If is text of private message too long, do read more
    2) Seen date – please do date with time (date & time reading)
    3) Why is there SSS? Please change text on “Mark as read” and “Mark as unread” It confuses people
    4) When someone wants to see the messages in the conversation, please do that he will automatically jump down the page on the last message. Look how it works on Facebook, it also jumps down and you do not have to scroll down in order to write the answer.
    5) Load more button – In some of the conversations I have more than 30 messages, then it’s confusing. Load newest button – Could you indicate a new incoming message as in the activities?
    6) New messages at the top, old messages down. Similar as is the case activity. Reply form at the top as well.


    #260568
    danbp
    Moderator

    hi @masoud1111,

    all i found was how to hide that button, or remove it.
    but not show it only on some profiles

    You just need to add some conditionnals.

    Try this (in bp-custom.php) and give feed back if it works.

    function bpex_private_message_button( $button ) {
    $user = bp_loggedin_user_id();
    
        if ( is_super_admin() ) { 
    		return $button;
    	}
    
    	if ( !empty( $user->roles ) && is_array( $user->roles ) ) {
    
    		if ( $role == 'subscriber' || $role == 'contributor' || $role == 'author' || $role == 'editor' )  {
    			// hide button for these roles
    			$button = '';
    		}
    	}
    
    	// allow the button to appear on admin's profile only
    	if ( bp_is_active( 'xprofile' ) && bp_is_user() )  {	
    		$user_id = bp_displayed_user_id();	
    		// assuming admin's ID is 1
    		if ( $user_id == 1 ) {
    			return $button;
    		}
    
    	}
    
    }
    add_filter( 'bp_get_send_message_button', 'bpex_private_message_button', 1 , 1 );
    Masoud
    Participant

    hi.
    i am using latest version of BP and WordPress.
    and i am working on a food & recipe website.
    in this website, i’d like to show the “private message” button only on admin’s page.
    something with the help of:

    if (current_user_can(administrator) && is_admin())
    { \\show the button on his profile }
    else
    { \\hide the button on profiles }

    Or maybe:

    if(current_user_id == 1) \\for example user 1 is admin
    { \\show the message button on his profile for others to see }

    —–
    as an example: imagine you have 4 users. user A, user B, user C, user D.
    Role user A : admin
    Role user B & C & D : subscribers/or/authors/or/editor/or…
    subscribers can’t see the private message button on each others profile page to send each other message.
    but when they visit User A profile page, they can see the button , and can send message only to admins…

    i searched a lot, but all i found was how to hide that button, or remove it.
    but not show it only on some profiles for others to see .

    any help would be much appreciated.
    thanks a lot.

    danbp
    Moderator

    The function is working correctly on my install.

    Perhaps you have an issue with quotes, ie after copy/pasting the snippet from a topic where the code whas inserted without using the code button.
    Which software do you use to publish bp-custom ?

    Copy/paste following and give a try:

    function buddydev_hide_members_directory_from_all_except_admin() {
    
    if ( bp_is_members_directory() && ! is_super_admin() ) {
    //should we add a message too?
    //bp_core_add_message( 'Private page.', 'error' );
    bp_core_redirect( site_url('/') );
    }
    }
    add_action( 'bp_template_redirect', 'buddydev_hide_members_directory_from_all_except_admin' );
    danbp
    Moderator

    This topic is titled “Function to hide private message depending of user role”.

    and the snippet does that ! Subscribers have no access to the button. So far i remember it is also the default role in WordPress. You change that to your need.

    The first condition in the snippet allows some users (by ID) to access the button, whatever their role.

    If you want to add other WP roles, you simply copy the 2nd conditionnal if(role=='') and add another role if(role=='mamamouchi") { //do something }.

    Or you use only the user ID if you have only a few members allowed to access. I litle understanding of php is of course a + to do that.
    You have the basics in the snippet. Now, it’s to you now to make it work for your need.

    Raphael.v
    Participant

    Thank you @danbp, this work ! I’m pretty sure this will help a lot (and not only me).

    I’am asking something more : can this be adapt to allow only some user role to use private message ? (and not only some users ?) As the second part of the code you wrote, it remove the button to susbscriber.

    (I’m learning PHP, I’ve tried to change the code but did not succeed to have it work…)

    danbp
    Moderator

    Hi,

    try this (goes to bp-custom.php)

    function bpex_remove_private_message_button( $button ) {
    $user = bp_loggedin_user_id();
    
        if ( $user == '4' || $user == '7' || $user == '25'  ) { // the allowed user ID's
    	 return $button;
    	}
    
    	if ( !empty( $user->roles ) && is_array( $user->roles ) ) {
    
    		if ( $role == 'subscriber') {
    			$button = '';
    		}
    	}
    }
    add_filter( 'bp_get_send_message_button', 'bpex_remove_private_message_button', 1 , 1 );

    No idea how to get specifically a pmpro defined user ID – you have to check their doc to adjust the above snippet. Note that it works on a standart install – without pmpro.

    Raphael.v
    Participant

    Hi !
    I’ve been looking for this function on the forum but did not find something about my pb on the forum. I need to disable private messaging for some members. My website runs PMPRO but if a function can help me doing this, I’m OK with it.

    For example, I need users only with the WP role “premium1” to be allowed to send private message;
    OR, it can be users only with pmpro membership level “6” to have access to this function and see the “Private message” button.

    Does someone has a solution for me ? (bp-custom or function.php from child-theme)

    Thanks !

    #259414
    danbp
    Moderator

    Hi @koded1999,

    please, use the <code> button to insert snippets. Also avoid double posting.
    Closing this topic as duplicate.
    Conversation goes ahead here:

    Disable or Hide Private Message Button

    #259413
    koded1999
    Participant

    @henrywright i managed to fix that and is working perfectly.

    but i have another problem.

    i will like to populate the subject automatically when user click the private message button from post

    pls how can i achieve this.

    thank you

    #259410
    koded1999
    Participant

    @henrywright Please i will like to add private message button in post side bar. i used the code below it works but doesnt populate the author automatically. how can i fix this thanks in advance.

    function bpfr_message_shortcode() {	
    $author = get_the_author();
    $message = 'Login to contact advertiser!';
    
    if( is_user_logged_in() ) {
    	return '<a>MESSAGE ADVERTISER</a>';
     } else {
        return $message;
     }
    } 
    add_shortcode( 'ksam', 'bpfr_message_shortcode' );
    BexxBl
    Participant

    I have this very specific problem I need to solve. The thing is I have this BuddyPress-Setup that is linked to my WP and WC Vendors. What I’m trying to achive is a sidebar/seller info tab displaying the BuddyPress-Profil informations from the Vendor. Something like this when the User is logged in:

    • Profile name (BuddyPress/WP)
    • Storename (from WC Vendors)
    • phone number
    • email-address
    • Button to send Private Message to Seller

    If the User is not logged in there should be a Button with the meassgae to please login. I already know how to do that button.
    I already linked my BuddyPress Profile with the WC Vendors store. So that the “Visit-Store”-Button is displayed on the BuddyPress profile of my Users (from knowledge Base of WC Vendors)

    How is the best way to approche this problem?

    I’m not looking for a fullywritten out solution just some suggestions where to start.

    I’m running the current versions of WP, BuddyPress, WooCommerce and WC Vendors(free) with the Socialize Theme. Also posted the question on the WC Vendors Support Site.

    Thank you for your help.

    #258281
    danbp
    Moderator

    Hi,

    you can try to remove the private message button from the template or hide it with CSS.
    And add a custom one who leads to admin inbox.

    The link should look like
    http://your-site.com/members/YOU/messages/compose/?r=THE ADMIN&_wpnonce=an_alpha_numeric_value

    See here how you may code this

    Codex and Forum are your friends to search about template customization.

    #258149
    danbp
    Moderator

    You’re welcome. 😉
    In case of, here’s another trick.

    #258094

    In reply to: New Privacy Plugin

    danbp
    Moderator

    hi @fencer04,

    thank for sharing your work. Well done, but it needs some revision (sorry).
    At his activation on 2 test sites (one with 4.5.3/bp 2.6.1, other 4.6/bp2.6.2) i got a notice.
    Array to string conversion in buddypress/bp-core/classes/class-bp-core-nav.php on line 279from

    sbpp04_privacy_check( )	..\plugin.php:525
    sbpp04_privacy_redirect( )	..\buddypress-profile-privacy.php:176
    bp_core_remove_nav_item( )	..\buddypress-profile-privacy.php:184
    BP_Core_Nav->delete_nav( )	..\bp-core-buddybar.php:798

    Another point concerning UI/UX is the Private button appearing on buddybar.
    On this tab, a default message says Friends Only.
    USERNAME has chosen to limit profile access to friends only.
    That’s wrong! Because this appear on each profile, even if the owner hasn’t setup anything about his profile privacy.

    So far i understand its fonctionality, this plugin let each member decide to show or not his whole profile page to friends or members only or to everyone (bp default).

    – imo this tab should show “This profile is private” to anybody who is concerned by a privacy setting and should not appear at all if “Everyone” is set.
    – the original BP Add as friend button on profile header or members directory is still there. This means that there is no need to go on Private tab to ask forfriendship.
    This is a little confusing !

    If the plugin is to extend profile settings, it should appear in profile settings only. And as it doesn’t superseed BP, there is no real reason to give him an extra tab on buddybar outside of the settings scope. A template notice could be enough to tell visitors what’s going on on such a profile.

    Just my 2 cents.

    danbp
    Moderator

    Try this:

    function mohammad_remove_private_message_button( $button ) {
    $user_id = bp_loggedin_user_id();
    
        if ( $user_id == '37' ) // the user ID
    	$button = '';
    
         return $button;
    }
    add_filter( 'bp_get_send_message_button', 'mohammad_remove_private_message_button', 1 , 1 );

    More details here:

    [Resolved] how hide tab only for user? not remove/disable

    sudden100
    Participant

    I’m trying to accomplish the following:
    A user should be able to complete a form (containing checkboxes, radiobuttons, dropdowns etc) and post it’s content so it is only visible to selected users in BuddyPress.

    I’ve tried the following:
    Created a form with the plugin “Formidable Form Pro” which can be filled out from a separate page and upon submit it posts the content to the logged in user’s activity stream (visible for everyone).

    Problem:
    I’m still missing the possibility to select which users (ideally one or several BuddyPress friends) who should be receivers of the content. I’m also still missing the possibility to make sure no one else, other than the specified users, can see the content. Using the plugin “BuddyPress Activity Privacy” only seems to be working when posting from frontend inside BuddyPress, such as status update in activity stream.

    Question:
    Is it possible to include a form created with “Formidable Form Pro” in an activity update in BuddyPress (or a private message or another post type)? Could it perhaps be done with a shortcode? Any solutions to accomplish what is stated above are welcome.

Viewing 25 results - 76 through 100 (of 327 total)
Skip to toolbar