Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 25 replies - 926 through 950 (of 2,756 total)
  • @henrywright

    Moderator

    What did you get when you used var_dump()?

    @henrywright

    Moderator

    Even 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.

    @henrywright

    Moderator

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

    @henrywright

    Moderator

    Closing as a duplicate

    @henrywright

    Moderator

    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!

    @henrywright

    Moderator

    $handle is simply a name you give your script. I chose my-custom-js but feel free to use any string you like. custom-script or maelga-js are both suitable alternatives.

    @henrywright

    Moderator

    You 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.js

    Alternatively, you could just add the code to your footer.php file, just above the </body> tag like this:

    <script>
        // JavaScript goes here.
    </script>

    @henrywright

    Moderator

    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).

    @henrywright

    Moderator

    You 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_notice must be changed

    @henrywright

    Moderator

    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.

    @henrywright

    Moderator

    Of course, sorry. Glad you figured it out ๐Ÿ™‚

    @henrywright

    Moderator

    $ud is a WP_User object 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 );

    @henrywright

    Moderator

    @startershut

    You 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.

    @henrywright

    Moderator

    @shanebp, funny you say that, since 2.4.0 dropped, I’ve been using 2013 on everything! My new favourite 20-something

    @henrywright

    Moderator

    @functionmunchkin

    Thanks 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:

    https://bbpress.org/forums/

    @henrywright

    Moderator

    The person creating the user will need the create_users capability. By default, only super-admins and admins have it. But, you can add the capability to any role using the add_cap() function.

    Refs:

    https://codex.wordpress.org/Roles_and_Capabilities#create_users

    https://codex.wordpress.org/Function_Reference/add_cap

    @henrywright

    Moderator

    Iโ€™ve reported it to the theme developer

    Good idea. Hopefully they’ll be able to provide a fix!

    @henrywright

    Moderator

    Great stuff @imath and everyone else involved, 2.4.0 looks a truly fantastic release! Thank you ๐Ÿ™‚

    @henrywright

    Moderator

    Check out bp_parse_args(). It’s super powerful when it comes to filtering the activity stream.

    @henrywright

    Moderator

    It 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

    @henrywright

    Moderator

    Great 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.

    @henrywright

    Moderator

    There’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' );

    @henrywright

    Moderator

    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 Help

    @henrywright

    Moderator

    Take 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_id in your custom function, then bp_after_registration_confirmed isn’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 Help

    @henrywright

    Moderator

    Can 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.

Viewing 25 replies - 926 through 950 (of 2,756 total)
Skip to toolbar