-
Author
-
July 8, 2017 at 23:58 #166755RoaderParticipant
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.July 9, 2017 at 00:10 #166758Kieran_SQModeratorHi @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 solutionIf 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.
July 9, 2017 at 00:59 #166759RoaderParticipantThis 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.July 9, 2017 at 03:18 #166770Kieran_SQModeratorYou 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 solutionIf 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.
July 9, 2017 at 04:13 #166771RoaderParticipantHi 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.July 11, 2017 at 16:36 #167026RaduModeratorHi,
Just use this function
COPY CODEif ( ! 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 solutionJuly 11, 2017 at 23:38 #167080RoaderParticipantHi 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.July 13, 2017 at 01:56 #167242RoaderParticipantHi Radu, the correct code is:
COPY CODEif ( ! 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 #167080July 13, 2017 at 03:36 #167244RoaderParticipantWell, the code adds the button, but, without css.
And the code works very well.
Solution:Adjust this code for Kleo/SweetDate. (Includes:
COPY CODEfunction 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>`July 14, 2017 at 16:12 #167408RaduModeratorGreat 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 solutionJuly 14, 2017 at 20:02 #167453RoaderParticipantHi 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.
July 14, 2017 at 20:12 #167456RoaderParticipantI 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.July 16, 2017 at 15:06 #167573RoaderParticipantSpanish (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.July 16, 2017 at 15:19 #167577RoaderParticipantEnglish (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.
July 18, 2017 at 16:25 #167820RaduModeratorHi,
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 solutionJuly 18, 2017 at 20:19 #167848RoaderParticipantHi Radu,
Okey I will try in Localhost later, using a clean installation.July 18, 2017 at 20:22 #167849RoaderParticipantFor now, this code works ==> but, does not have CSS for SweetDate. If you want, in your Localhost, try it.
COPY CODEfunction 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’ );
July 19, 2017 at 02:40 #167895RoaderParticipantLocalHost, 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.July 20, 2017 at 18:44 #168086RaduModeratorHi,
Please add those codes to function.php child theme but get rid off all codes related to this modification.
COPY CODEfunction 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 solutionJuly 21, 2017 at 03:06 #168139RoaderParticipantYou 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.July 21, 2017 at 03:20 #168144RoaderParticipantA little bug
The Messages button is displayed for non logged in user. Please check!
July 22, 2017 at 00:36 #168240RoaderParticipantThe 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.July 24, 2017 at 19:42 #168483RaduModeratorHi,
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 solutionJuly 25, 2017 at 17:01 #168532RoaderParticipantMy 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.July 26, 2017 at 19:47 #168676RaduModeratorOk 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 solutionJuly 26, 2017 at 22:00 #168689RoaderParticipantwith 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).
July 28, 2017 at 16:00 #168841RaduModeratorI’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 solutionJuly 29, 2017 at 02:02 #168888RoaderParticipantNo 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.July 31, 2017 at 18:12 #169140RaduModeratorHi,
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 solutionOctober 4, 2017 at 00:01 #175591RoaderParticipantFor 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.October 4, 2017 at 00:09 #175596RoaderParticipantYou 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.
October 4, 2017 at 19:06 #175673RaduModeratorHi, 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
RHi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionOctober 24, 2017 at 02:11 #177595mbfitParticipantHello 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.
January 2, 2018 at 16:25 #184526RoaderParticipantHello 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 );
-
AuthorPosts
You must be logged in to reply to this topic.