Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 25 replies - 2,226 through 2,250 (of 2,756 total)
  • @henrywright

    Moderator

    Hi @bacigaloop

    Posts are displayed by single.php. Take a look in your theme to see if there is a hook available in that file. If not you could always add one yourself by creating a child theme.

    Ref: https://codex.wordpress.org/Child_Themes

    @henrywright

    Moderator

    Hi @flaviamelo

    BuddyPress doesn’t have a Login_Helper class or a change_buddypress_avatar method. Which plugins are you using? This is 99.99% likely to be due to one of them.

    @henrywright

    Moderator

    bp_displayed_user_id() requires an echo for display.

    Just to confuse us all! 😉

    @henrywright

    Moderator

    bp_displayed_user_id() is the member’s ID so perhaps that’s the same as a membership ID? I’m not sure it matters though as the important part is it’s a unique identifier so whatever name we give it is irrelevant.

    You should be able to add it to your member-header.php file. Which theme are you using? Some themes might not have it so you’ll need to create it yourself if that’s the case. It might be worth reading up on the Template Hierarchy to get a feel of how BuddyPress templates work.

    @henrywright

    Moderator

    <?php bp_displayed_user_id(); ?> will work on the member’s profile page.

    @henrywright

    Moderator

    Hi @anivarth,

    Check out BP Chat. It’s a “Facebook-like chatting plugin for BuddyPress”.

    @henrywright

    Moderator

    Actually it’s not quite the same. On a quick glance, I noticed you have extra <div> tags such as <div class="effect6" style="width:100%;">, and you’re doing a str_replace() on some $_GET variable and also you’re wrapping some of your label’s text in <h2> tags. Not entirely sure if those changes are to blame though. Anyhow, glad you got it resolved 🙂

    @henrywright

    Moderator

    Good point @danbp

    @bloodslayer, you’d need to be logged in as ‘editor’ or upwards (admin or super admin) for my example above to work.

    @henrywright

    Moderator

    Hi @bloodslayer

    wp_insert_post() is a function provided by WordPress which lets developers add pages to the database without the need to access the WP admin area.

    So, as an example, you could use it like this:

    $post = array(
        'post_content' => 'This is some content',
        'post_name' => 'this-is-the-page-slug',
        'post_title' => 'I am the title of this page',
        'post_status' => 'publish',
        'post_type' => 'page',
        'post_excerpt' => 'This is the excerpt'
    );
    
    $post_id = wp_insert_post( $post );

    Notes: $post_id will be the ID of the new page or if wp_insert_post() failed (for whatever reason) it will be 0.

    So that’s how you create a new page programmatically. It’s more of a WordPress thing than a BuddyPress thing.

    @henrywright

    Moderator

    In the absence of a plugin, you would need to create a front-end form and a server-side processing script which makes use of wp_insert_post().

    Ref: https://codex.wordpress.org/Function_Reference/wp_insert_post

    In reply to: not recently active

    @henrywright

    Moderator

    Hi @bea107

    Did you copy and paste @danbp’s code? I haven’t tested it myself but if you have copied his code then it doesn’t look like you’ve copied it properly as some of it is certainly missing. For example, where did this bit in your code snippet come from?

    add_filter( ‘bp_core_get_last_activity’ );

    @henrywright

    Moderator

    Perhaps your own processing is the cause of the nonce not validating? We still can’t be sure the nonce is the issue here because there’s no helpful error message but it’s a good place to start looking.

    @henrywright

    Moderator

    I assume you’re letting BP handle the form processing in the default way and not doing your own processing?

    Can you try using this and see if the problem still happens:

    http://pastebin.com/aX2WS6hZ

    @henrywright

    Moderator

    Hi @godavid33

    It’s likely the WP nonce is invalid. Usually you get a message such as “Are you really sure you want to do this?” so I can understand why the blank page looks weird.

    Have you modified the form at all? Perhaps you could paste the form’s markup into pastebin? I’ll take a look to see if I can see anything wrong

    @henrywright

    Moderator

    Very nice plugin @shanebp!

    @henrywright

    Moderator

    I think the field visibility settings are applicable to the member who is performing the setting.

    The suggested way to do what you want would be to make your notes profile field hidden to all non-admin members.

    The first step would be to create /wp-content/themes/your-theme/buddypress/members/single/profile/edit.php inside your theme.

    You can copy the contents of edit.php from:

    bp-templates/bp-legacy/buddypress/members/single/profile/edit.php

    Then you need to modify edit.php. In edit.php, find <?php while ( bp_profile_fields() ) : bp_the_profile_field(); ?> and add the following immediately after it:

    if ( ! current_user_can( 'manage_options' ) && ( bp_get_the_profile_field_name() === 'notes' ) )
        continue;

    Note: I’m assuming your field name is notes

    @henrywright

    Moderator

    bp_notifications_add_notification() is used to add a notification. For example:

    if ( bp_is_active( 'notifications' ) ) {
        bp_notifications_add_notification( array(
            'user_id'           => $user_id,
            'item_id'           => $item_id,
            'secondary_item_id' => $secondary_item_id,
            'component_name'    => $component_name,
            'component_action'  => $component_action,
            'date_notified'     => bp_core_current_time(),
            'is_new'            => 1,
        ) );
    }

    See here for more info: https://codex.buddypress.org/developer/function-examples/bp_notifications_add_notification/

    In reply to: not recently active

    @henrywright

    Moderator

    Hi @bea107

    Check out the Template Hierarchy article which will let you customise the BuddyPress templates.

    @henrywright

    Moderator

    Hi @grkmp

    All activated members get allocated a URL. For example: example.com/members/username. Actually, to my knowledge, even unactivated members are given a URL so in theory any person who has completed the registration form will have a profile. They way around this would be to implement a custom registration form which doesn’t make use of the default functionality.

    @henrywright

    Moderator

    That won’t change what’s already been uploaded. If you upload a new avatar going forward, you should see the new size.

    @henrywright

    Moderator

    There might actually be more things you’d need to do. For example, the bp_get_message_thread_avatar() function uses bp_core_fetch_avatar() so you would need to filter that using bp_get_message_thread_avatar etc.

    Unless someone else knows of an easier way, it seems as though it’ll be a big task of going through everything. You’d also need to be comfortable with PHP.

    Alternatively, you could try disabling avatars by adding this to your bp-custom.php file

    define( 'BP_SHOW_AVATARS', false );

    Note: I’ve not tested that, I’m just going on what I see at the beginning of the bp_core_fetch_avatar() function. i.e:

    // If avatars are disabled for the root site, obey that request and bail
    if ( ! buddypress()->avatar->show_avatars )
       return;

    @henrywright

    Moderator

    If your theme doesn’t explicitly use BuddyPress templates then the default templates will be used. For a quick look at the templates check out the GitHub repo.

    I’m guessing your theme doesn’t explicitly use the templates so what you’d have to do is create them yourself. The general idea is to create a folder called buddypress inside your theme and then add the templates you’d like to customise to that folder. So for example, you’d end up with /wp-content/themes/your-theme/buddypress/. Everything goes inside there.

    @henrywright

    Moderator

    It will do, sort of indirectly, actually. For more info on how it works, check out the Template Hierarchy article.

    @henrywright

    Moderator

    Actually scratch that last post – it’s now displaying the avatars as the WordPress avatars in the back-end but not the front end

    In that case, I think we’ve just crossed that bridge hehe. i.e the next step will be to replace all instances of bp_core_fetch_avatar() in your front-end templates with get_avatar()

    @henrywright

    Moderator

    Humm.. not helpful then. In that case we might have to try doing it manually. Perhaps try disabling the filter which replaces the WP avatars with BP avatars. For example, add this to your theme’s functions.php file:

    remove_filter( 'get_avatar', 'bp_core_fetch_avatar_filter', 10, 5 );

    I think you can disable the Gravatar fallback as well with this:

    add_filter( 'bp_core_fetch_avatar_no_grav', '__return_true' );

    If that doesn’t work, you may need to replace all occurrences of bp_core_fetch_avatar() with get_avatar() in your templates. But cross that bridge when you come to it.

    Ref: https://codex.wordpress.org/Function_Reference/get_avatar

Viewing 25 replies - 2,226 through 2,250 (of 2,756 total)
Skip to toolbar