Forum Replies Created
-
In reply to: Set Birthday value buddypress
What did you get when you used
var_dump()?In reply to: A Nicer Way To Edit Group SlugsEven though the plugin hasn’t been updated for 2+ years, it’s built by @jjj (BuddyPress project lead who knows BuddyPress inside out) so it will be well-written. If you do spot anything, open a support ticket on the plugin’s forum.
In reply to: Set Birthday value buddypressHow are you getting
$user_id? You should show us all of your code. My advice is to dump stuff to check where you’re going wrong. For example:var_dump( $user_id ); var_dump( $randDate );Closing as a duplicate
Hey @alessandrat
Welcome to the BuddyPress forum!
1. Have two separate front ends for different user types (with differently configured profiles), appearances, and accesses.
Yes. This can be done with either a plugin (try searching the Plugin Directory) or coded through the Member Types feature introduced in version 2.2.
2. Have a place where shortcode could be put in so that users can take a questionnaire containing likert questions on their profile and/or while creating their profile.
Either a post, page or perhaps even an activity update all spring to mind as possible places to add it.
3. One but not both kinds of users can create their own group (public, semiprivate or private) or forum and browse/ join existing ones
The ability for all members to create new groups comes as standard.
4. One kind of user but not the other needs to be able to set up ways for the other type of user to purchase products (I assume I can use another plugin but will need a place to put the shortcode)
This will need to be either custom coded, or you may find a plugin with the functionality you need.
Hope this info helps!
In reply to: Dismiss template notices after a few seconds$handleis simply a name you give your script. I chosemy-custom-jsbut feel free to use any string you like.custom-scriptormaelga-jsare both suitable alternatives.In reply to: Dismiss template notices after a few secondsYou could create a .js file in your child theme which you could use for all of your custom JavaScript. You’d then enqueue it with the following code (which goes into your child theme’s functions.php):
function my_enqueue_scripts() { wp_enqueue_script( 'my-custom-js', get_stylesheet_directory() . '/js/script.js', array(), '1.0.0', true ); } add_action( 'wp_enqueue_scripts', 'my_enqueue_scripts' );Note:
This snippet will enqueue a script called script.js located at child-theme/js/script.jsAlternatively, you could just add the code to your footer.php file, just above the
</body>tag like this:<script> // JavaScript goes here. </script>In reply to: How To Match BP Components With BP Pages?Only for components that have a directory. Also, you will need to do that for the “register” and “activate” pages (this is all done via Settings > BuddyPress > Pages).
In reply to: Dismiss template notices after a few secondsYou could use the
setTimeout()JavaScript method for that:function delay() { id = window.setTimeout(rm, 500); } function rm() { // Remove the notice from the DOM. var e = document.getElementById("id_of_the_notice"); e.parentElement.removeChild(e); }Note:
500(milliseconds) can be changed.id_of_the_noticemust be changed
In reply to: How To Match BP Components With BP Pages?In the area titled Directories, only 3 components are shown. The opportunity exists to assign Pages to those 3. But what about the other 6 components I chose?
Not all components have directories. Take friends for example, that component doesn’t have a directory. However, members, groups and activity do.
Of course, sorry. Glad you figured it out ๐
$udis aWP_Userobject of the person who is receiving the message. So:function filter_private_message_email_body( $email_content, $sender_name, $subject, $content, $message_link, $settings_link, $ud ) { $content = wp_trim_words( $content, 15 ); $email_content = sprintf( __( 'Dear %1$s, %2$s sent you a new message: Subject: %3$s "%4$s" To view and read your messages please log in and visit: %5$s --------------------- ', 'buddypress' ), $sender_name, $subject, $content, $message_link, $ud->user_login ); return $email_content; } add_filter( 'messages_notification_new_message_message', 'filter_private_message_email_body', 10, 7 );In reply to: (Invite Anyone) Avoid people seeing other membersYou should ask on the plugin’s support forum. Also, something that might be of interest to you, there’s a new invitations API in progress. See #6210.
In reply to: BuddyPress 2.4.0 – Pietro@shanebp, funny you say that, since 2.4.0 dropped, I’ve been using 2013 on everything! My new favourite 20-something
In reply to: Wish support was mobile friendlyThanks for the feedback. I’m assuming this is feedback regarding the BuddyPress forum, rather than the BuddyPress software. In your own forum, you can change the location of the new topic form by modifying your theme. See the Theme Compatibility article for more info. Any questions you may have feel free to ask on their support forum:
In reply to: SuperUsers that are allowed to create usersThe person creating the user will need the
create_userscapability. By default, only super-admins and admins have it. But, you can add the capability to any role using theadd_cap()function.Refs:
https://codex.wordpress.org/Roles_and_Capabilities#create_users
In reply to: 2.4 Cover Photo’s does not work with Graphene ThemeIโve reported it to the theme developer
Good idea. Hopefully they’ll be able to provide a fix!
In reply to: BuddyPress 2.4.0 – PietroGreat stuff @imath and everyone else involved, 2.4.0 looks a truly fantastic release! Thank you ๐
In reply to: BuddyPress Site wide activityCheck out
bp_parse_args(). It’s super powerful when it comes to filtering the activity stream.In reply to: Removing Xprofile fieldsIt doesnโt help if I directly delete the field in the database.
That’s really weird. If you delete something from a database, usually it’s gone permanently
In reply to: Adding profile fields to members directoryGreat to hear ๐
Very cool yacht by the way! I’m going to visit my uncle’s this Thursday. It’s moored at Canvey Island while he does some restorations.
In reply to: Adding profile fields to members directoryThere’s 2 ways of doing this.
1. You could modify the members-loop template (see the BuddyPress Template Hierarchy for details on how that’s done). See here. You would just add
bp_member_profile_data( 'field=the field name here' );to the template.2. Add this to your theme’s functions.php file:
function add_info_to_members_loop() { echo bp_get_member_profile_data( 'field=the field name here' ); } add_action( 'bp_directory_members_item', 'add_info_to_members_loop' );You can’t do that currently. The only way to add an item to the activity stream is with
bp_activity_add(). See the bp_activity_add() article for more details.In reply to: Custom Hook HelpTake a look at the source where the hook appears. See here. You should see
do_action( 'bp_after_registration_confirmed' );.This invokes all functions hooked to
bp_after_registration_confirmed. So for example:function test() { // The code here will be run. } add_action( 'bp_after_registration_confirmed', 'test' );In this particular case, nothing is passed to
test(). So to answer your question:how do I retrieve registration data from the hook?
If an argument is supplied to
do_action()like this:do_action( 'bp_after_registration_confirmed', $user_id );, then that argument is passed to your custom function. You can receive that argument like this:function test( $user_id ) { // Do something with $user_id here. } add_action( 'bp_after_registration_confirmed', 'test' );So the short answer is if you want to use
$user_idin your custom function, thenbp_after_registration_confirmedisn’t the right hook to use, because it comes with no arguments. This isn’t always the case because sometimes you may have request variables available but I won’t get into that.Hope this helps!
In reply to: Custom Hook HelpCan someone confirm if this code will ever be overwritten by an update to WordPress or BuddyPress?
Updating WordPress or BuddyPress won’t overwrite anything you have added to your theme, but updating your theme will do. The way around this is to create a Child Theme.