This topic has 36 replies, 4 voices, and was last updated 6 years by Roader.

  • Author
  • #166755
     Roader
    Participant

    Hi there!

    I found this code.

    This function php add a message button in members loop, but without Css.

    If you can help me with that (example pic 2*).

    ____

    *  Example 1, without text, only icons: How can I hide the text here? overflow? I don’t remember…

     

    // BuddyPress – add message button in members loop

    // Source:  https://gist.github.com/shanebp/5391229

    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();

    add_filter(‘bp_get_send_private_message_link’, ‘filter_message_button_link’, 1, 1 );

    }

    }

    add_action( ‘bp_directory_members_item’, ‘display_private_message_button’ );

    Attachments:
    You must be logged in to view attached files.
    #166758
     Kieran_SQ
    Moderator

    Hi @montecci01,

    Please provide some admin credentials so I can take a look and send you the css that you need.

    Thanks,

    Kieran.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Custom development requests can be sent to dev@seventhqueen.com, one of the development team will be happy to discuss your needs.

    #166759
     Roader
    Participant

    This functions is interesting for SD, Radu, if you want, for the Next Update includes this.

    ——————–
    Other Topic related.

    Pic 1. A little problem with the Css here… (by default).

    I tried BP Better Messages — WordPress Plugins, but, does not work very well with the Theme (and I dont want this plugin… but some functions are interesting. Try the Demo).

    Pic 2 and 3. I did tell you this repeatedly: SD Message improvements.

    If you can, add a Quick Navigation or (for SD 3.0) a Message like (pic 3).

    Attachments:
    You must be logged in to view attached files.
    #166764
     Roader
    Participant
    This reply has been set as private.
    #166765
     Roader
    Participant
    This reply has been set as private.
    #166770
     Kieran_SQ
    Moderator

    You could try this CSS for the message button

    COPY CODE
    .members .dir-list a:not(.button), div#main a:not(.button), #header .form-footer a:not(.button) {
        color: #ffffff;
    }
    .members .dir-list .generic-button a {
        background-color: #743349;
        color: #ffffff;
        min-width: 60px;
        padding: 10px;
        border-radius: 5px;
    }

    As for the “View profile” I’m not too sure so I am going to ask a more senior support staff member to assist you with this request.

    Thanks,

    Kieran

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Custom development requests can be sent to dev@seventhqueen.com, one of the development team will be happy to discuss your needs.

    #166771
     Roader
    Participant

    Hi again kieran_sq

    Well, your css needs more works 🙂

    Pic 1. Using this css the [ + ] button is bigger. Private Ms. up… etc.

    Pic 2. Needs Css for Mobile or Table… etc.

    Attachments:
    You must be logged in to view attached files.
    #167026
     Radu
    Moderator

    Hi,

    Just use this function

    COPY CODE
    
    
    if ( ! function_exists( 'kleo_bp_member_dir_view_button' ) ):
        /**
         * Render view profile button on members directory
         */
        function kleo_bp_member_dir_view_button() {
            ?>
            <a>" class="small button radius secondary"><i
                    class="icon-angle-right"></i> </a>
            <?php
        }
    endif;
    add_action( 'bp_directory_members_item_last', 'kleo_bp_member_dir_view_button', 10 );
    
    

    NOTE : Child theme needs to be installed and activated.

    The function needs to be pasted in wp-content/themes/sweetdate-child/functions.php

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #167080
     Roader
    Participant

    Hi Radu!
    Check your code… look at this.

    Well, Radu, the idea is to add a Private Message button in Members Directory.
    The code that I shared works, but, hasn’t CSS. So, if you want, give the CSS for this button and for the next update of SD add this button 🙂 (Styles 1 or 2, picture 2).

    And… How can you hide text (from a button) using css?

    Attachments:
    You must be logged in to view attached files.
    #167242
     Roader
    Participant

    Hi Radu, the correct code is:

    COPY CODE
    if ( ! function_exists( 'kleo_bp_member_dir_view_button' ) ):
    	/**
    	 * Render view profile button on members directory
    	 */
    	function kleo_bp_member_dir_view_button() {
    		?>
    		<a href="<?php bp_member_permalink(); ?>" class="small button radius secondary"><i
    				class="icon-angle-right"></i> <?php _e( "View profile", 'kleo_framework' ); ?></a>
    		<?php
    	}
    endif;
    add_action( 'bp_directory_members_item_last', 'kleo_bp_member_dir_view_button', 10 );

    But I need help with ==>
    JULY 11, 2017 AT 23:38 #167080

    #167244
     Roader
    Participant

    Well, the code adds the button, but, without css.
    And the code works very well.
    Solution:

    Adjust this code for Kleo/SweetDate. (Includes:

    COPY CODE
    
    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();
    
    add_filter('bp_get_send_private_message_link', 'filter_message_button_link', 1, 1 );
    
    }
    
    }
    
    add_action( 'bp_directory_members_item', 'display_private_message_button' );

    Includes with: `<a href=”<?php bp_member_permalink(); ?>” class=”small button radius secondary”><i
    class=”icon icon-envelope”></i> <?php _e( ” “, ‘kleo_framework’ ); ?></a>`

    #167408
     Radu
    Moderator

    Great if you have solved

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #167453
     Roader
    Participant

    Hi Radu, I have not solved anything. I am waiting for your help.

    Your solution will serve to add that button in the next update of the Theme. It is practical that button of Messages there.

    #167456
     Roader
    Participant

    I gotta remove View Profile, from the original Theme code, as you can see.

    But, it is necessary to add the correct CSS and the location of the other buttons.

    Then, it would look like this:

    [View Profile] [+] [M]

    Note: View profile is necessary because with this Theme, if is a single icon (the eye) when you are not logged in it looks very empty in that area.
    So, picture.

    Attachments:
    You must be logged in to view attached files.
    #167573
     Roader
    Participant

    Spanish (Laura):
    Veo que para añadir ese botón private message en members requerirá de más trabajo.
    Cuando haces click (cuadro azul) en el botón [ + ] (añadir Amigo) inmediatamente el botón sufre un cambio (cuadro rojo) cambia de solo icono a texto, lo mismo pasa cuando Anulas la Petición de Amistad, se pone: Cancelar Amistad.

    Este es un errorcito de CSS que hay que arreglar. Prúebalo tú misma para que veas. Debería ponerse un Botón con un icono X (fa fa-times o icon icon-times) para Cancel Friendship y mantenerse el aspecto (css).

    Lo demás, ajustar el botón private (con el icono = fa fa-envelope o fa fa-paper-plane).

    Attachments:
    You must be logged in to view attached files.
    #167577
     Roader
    Participant

    English (Radu):

    A little problem with CSS.

    When you click on the button (only icon) Add Friend,
    Immediately that button undergoes a change, and the text appears.

    This change of icon to text would cause a conflict if the Private Messages button is added.

    The solution here is to keep the button style (icons only).

    For Add Friend: icon icon-plus

    For Cancel Friendship: icon icon-times

    For Private Message: icon icon-envelope or icon icon-paper-plane

    The Code for PM in Members Page work! But, needs profesional css.

    #167820
     Radu
    Moderator

    Hi,

    I cannot provide you a CSS Cuz I don’t know how it behaves right now, I need to see the live site to can help you with something since this it’s already customized and our support cannot offer support for customizations requirements.

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #167848
     Roader
    Participant

    Hi Radu,
    Okey I will try in Localhost later, using a clean installation.

    #167849
     Roader
    Participant

    For now, this code works ==> but, does not have CSS for SweetDate. If you want, in your Localhost, try it.

    COPY CODE
    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();
    
    add_filter(‘bp_get_send_private_message_link’, ‘filter_message_button_link’, 1, 1 );
    
    }
    
    }
    
    add_action( ‘bp_directory_members_item’, ‘display_private_message_button’ );
    #167895
     Roader
    Participant

    LocalHost, Clean Install.

    When you click on the button (only icon) Add Friend,
    Immediately that button undergoes a change, and the text appears (Add Friend, or Cancel Friendship Request).

    This change of icon to text would cause a conflict of space (margin, padding) if the Private Messages button is added.

    Maybe the solution here is to keep the button style with icons only. So:

    [ > View Profile] [ + ] [ M ]

    But, I need your help here.

    Attachments:
    You must be logged in to view attached files.
    #167947
     Roader
    Participant

    Radu…

    #168086
     Radu
    Moderator

    Hi,

    Please add those codes to function.php child theme but get rid off all codes related to this modification.

    COPY CODE
    
    
    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 );
    

    Then replace this file content: /wp-content/plugins/buddypress/bp-themes/bp-default/_inc/ajax.php with this one: https://pastebin.com/raw/XjsaY26E

    This will overwrite a BuddyPress core file, since the ajax, it returns the "Add friend" text dynamically this it's the single option, you can ask the BuddyPress forums about how to overwrite the ajax.php file in child theme

    So those will be displayed like this :

    That's all

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Ticket solution
    #168139
     Roader
    Participant

    You are the master man! 😀 thanks!

    1 – 2: I dont know why, when you click on [ + ] (add friend) icon becomes text, and the style is broken. If you refresh, icon [ – ] again.

    3: For mobile (@media) those buttons are very width, by default…

    Attachments:
    You must be logged in to view attached files.
    #168144
     Roader
    Participant

    A little bug

    The Messages button is displayed for non logged in user. Please check!

    #168240
     Roader
    Participant

    The Code has: bp_loggedin_user_id() but, this not work.
    The Button is visible for all. Check it please. Like Add Friend Button [ + ] the Message button needs to be visible only for Logged in users.

    #168483
     Radu
    Moderator

    Hi,

    For further development and adjustments here you should do it yourself cuz the support service can not cover custom works, I’ve guided you to start.

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #168532
     Roader
    Participant

    My friend, my friend… This function is for you, for your Theme and better.
    When you have time… check it, and if you want add this button very well to your Theme.

    #168676
     Radu
    Moderator

    Ok but anyway we will release soon an improved Sweetdate version (Sweetdate 3.0 ) with a lot of new features.

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #168689
     Roader
    Participant

    with a lot of new features… Um okey! With chat includes, hehehe 😀

    I told you: take inspiration of loventine and waplog. (this pages does not work under buddypress, but, you have this sensation).

    #168841
     Radu
    Moderator

    I’ve added chat feature to improvement list but for that surest we will suggest a plugin to use

    Cheers

    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #168888
     Roader
    Participant

    No my friend. You dont need a plugin. Only other structure or Template for Messages.

    Other practical improvement is the Menu. Look at this Menu. Or Thrive Menu.

    Attachments:
    You must be logged in to view attached files.
    #169140
     Radu
    Moderator

    Hi,

    I see what you say, it’s already added to future improvement list.

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #175591
     Roader
    Participant

    For my friend @radu

    Here is the code working very well for logged in users. The solution was adding: if( is_user_logged_in() && bp_get_member_user_id() …

    Now you can add this button in the Next SD update. Is very functional.

    But, I need your help only for something.

    If you click e. g. Add Friend button (1st times), automatically changes to Text: Cancel friendship Request, and the style is broken until you refresh the page. The same, if you click Cancel friendship Request, changes to Add Friend (text).

    Solution: Force the css to stay stable. But, I dont know how!

    COPY CODE
    // 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 );
    Attachments:
    You must be logged in to view attached files.
    #175596
     Roader
    Participant

    You said:

    Then replace this file content: /wp-content/plugins/buddypress/bp-themes/bp-default/_inc/ajax.php with this one: https://pastebin.com/raw/XjsaY26E

    This will overwrite a BuddyPress core file, since the ajax, it returns the “Add friend” …

    But, this does not work.

    #175673
     Radu
    Moderator

    Hi, maybe they have changed something in the file or somewhere else, I’ve provided the solution a few months ago.

    I cannot offer support for a custom feature, just hire a developer.

    Cheers
    R

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #177595
     mbfit
    Participant

    Hello Roader, I like that option with the text, please share if you get that resolved. Only when I click on it initially does the text appear to Cancel and then clicking cancel goes to Add Friend Text. Everyone else stays as a + sign.

    #184526
     Roader
    Participant

    Hello here!

    This code worked, but not anymore.
    Maybe changed something in the Theme or in BuddyPress. I dont know.

    If you put this code in the functions.php the list of members (members page) disappears, only 2 or 3 are displayed.


    @Radu
    , if you can review that to know what the cause is.

    COPY CODE
    // 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 );
Viewing 37 posts - 1 through 37 (of 37 total)

You must be logged in to reply to this topic.

Log in with your credentials

Forgot your details?