-
Author
Tagged: member profile button
-
October 17, 2014 at 13:17 #32019santeeParticipant
Hi !
I would put the button “book this artist” on the profile of a member who sent the message to me and not directly to the member.
Is this possible?thank you very much
Attachments:
You must be logged in to view attached files.October 17, 2014 at 13:56 #32021sharmstrModeratorTry this. Change ‘yourusername’ in the code below to your username. Put the following into your functions.php file
COPY CODEadd_action( 'bp_before_member_header_meta', 'book_artist'); function book_artist(){ $link = wp_nonce_url( bp_loggedin_user_domain() . bp_get_messages_slug() . '/compose/?r=yourusername' ); echo bp_book_artist_button($link); } function bp_book_artist_button($link) { return apply_filters( 'bp_get_send_message_button', bp_get_button( apply_filters( 'bp_get_send_message_button_args', array( 'id' => 'book_artitst', 'component' => 'messages', 'must_be_logged_in' => true, 'block_self' => true, 'wrapper_id' => 'send-private-message', 'link_href' => $link, 'link_title' => __( 'Book this artist.', 'buddypress' ), 'link_text' => __( 'Book Artist', 'buddypress' ), 'link_class' => 'send-message', ) ) ) ); }
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
October 17, 2014 at 14:30 #32023santeeParticipantThank you 🙂
i put this in buddypress-funtions.php or function.php ?thanx!!!
October 17, 2014 at 14:36 #32024sharmstrModeratorHad a thought that you might want to auto populate the subject and maybe the message so you know what artist they want to book. The code I gave you before will only start the message and would rely on the person sending it to remember to put the artist name in. Anyhow, I found some code that should do this. So, instead of the code I gave you before, try this.
COPY CODEadd_action( 'bp_before_member_header_meta', 'book_artist'); function book_artist(){ global $bp; //$link = wp_nonce_url( bp_loggedin_user_domain() . bp_get_messages_slug() . '/compose/?r=tnsficadmin' ); $link = bp_custom_get_send_private_message_link('Booking Request for: ' . bp_core_get_username( bp_displayed_user_id() ),'Predefined message Information'); echo bp_book_artist_button($link); } function bp_custom_get_send_private_message_link($subject=false, $message=false) { //if user is not logged, do not prepare the link if ( !is_user_logged_in() ) return false; $compose_url=bp_loggedin_user_domain() . bp_get_messages_slug() . '/compose/?r=yourusername'; if($subject) $compose_url.=('&subject='.$subject); if($message) $compose_url.=('&content='.$message); return wp_nonce_url( $compose_url ) ; } /* Auto populate the message content */ add_filter('bp_get_messages_content_value','bp_custom_message_content_value'); function bp_custom_message_content_value($content){ if(!empty ($content)) return $content; $content=$_REQUEST['content']; return $content; } /* Auto Populate subject */ add_filter('bp_get_messages_subject_value','bp_custom_get_messages_subject_value'); function bp_custom_get_messages_subject_value($subject){ if(!empty($subject)) return $subject; $subject=$_REQUEST['subject']; return $subject; }
Some things to note
1 – Change ‘yourusername’ to your actual username.
2 – You can edit the subject by changing ‘Booking Request for: ‘
3 – You can change the message body by changing ‘Predefined message Information’. If you dont want a predefined message, the set it to ”.Credit goes to the code found here: https://gist.github.com/digitalchild/02c0730deebb3e3fca68
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
October 17, 2014 at 14:37 #32025sharmstrModeratoras I said
Put the following into your functions.php file
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
October 17, 2014 at 15:03 #32028santeeParticipantThank you !
But it does not work properly. The button appears on each member of the list and when I click it, I get on the profile page of the member. The button is not displayed and all completely disappeared (information, media, profile) and there are no form to send a message.
Style is also broken. (Header, main)
Any idéa??thank you
October 17, 2014 at 15:11 #32029santeeParticipantI wish it was the user online and offline that can see what the artist booker for Button and send me a message
October 17, 2014 at 15:23 #32031sharmstrModeratorA user cant send a private message unless they are logged in. That’s just the way it is. If you want non-logged in users to send you a message, then take a look at the Contact Form 7.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
October 17, 2014 at 15:25 #32034santeeParticipantOk. Good idea. I would have to create a button on the profile of the member who returns to the form.
But how then put a button under the member’s avatar?Thanx
October 17, 2014 at 15:36 #32037sharmstrModeratorThe add action line at the top of my code injects stuff exactly where it says it does ‘bp_before_member_header_meta’.
add_action( ‘bp_before_member_header_meta’, ‘your_button_code’);
Someone has probably asked for something similar over at Contact Form 7. Search there or google it.
In the future, please be as specific as possible when requesting help. I wasted an hour on this.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
-
AuthorPosts
The topic ‘Add "contact" button on member page?’ is closed to new replies.