Skip to:
Content
Pages
Categories
Search
Top
Bottom

FAQ: How To, Code Snippets and Solutions

Viewing 25 replies - 1 through 25 (of 27 total)

  • Burt Adsit
    Participant

    @burtadsit


    Burt Adsit
    Participant

    @burtadsit

    How to restrict users to one blog per user:

    https://buddypress.org/forums/topic.php?id=1328


    Burt Adsit
    Participant

    @burtadsit


    Burt Adsit
    Participant

    @burtadsit

    How to upgrade to the trunk version of buddypress

    https://buddypress.org/forums/topic.php?id=2145

    You don\’t have to use SVN if you don’t want to:

    https://buddypress.org/forums/topic.php?id=2171

    SVN is definitely the best way but not the only way.


    Jeff Sayre
    Participant

    @jeffsayre

    Having problems uploading an avatar? Do they turn black? Do they not show up at all? Does the cropping tool malfunction?

    https://buddypress.org/forums/topic.php?id=302#post-1212

    https://buddypress.org/forums/topic.php?id=1960#post-10404

    Some good advice on how to change blogs.dir directory permissions: https://buddypress.org/forums/topic.php?id=1153

    Here is a rule of thumb. You do not want to try uploading too big or too small of an avatar file. By default, BuddyPress sets the small avatar at 50 by 50 and the large avatar at 150 by 150. So, if your source image is smaller than 150 on at least one of its dimensions, you could have issues with creating the large avatar. If it is smaller than 50 on at least one of its dimensions, you could have issues with creating the small and large avatar.

    Finally, if you are still having issues after following the linked advice, you may have a WPMU plugin conflict–especially if you are using any plugins for image manipulation or display. Here is a list of plugins that can cause conflicts that users have reported to date:

    1. NextGen Gallery
    2. WP-cycle
    3. lightbox
    4. Dynamic Content Gallery

    To figure out if you have plugin issues, follow the standard WPMU protocol for determining plugin conflicts.


    Burt Adsit
    Participant

    @burtadsit

    Limiting the creation of blogs to certain user roles such as Site Admin

    This thread describes how to modify the both the admin bar and the member theme navigation functions using bp-custom.php. No core mods needed. It can give you an idea of how to modify any bp function that responds to an action.

    https://buddypress.org/forums/topic.php?id=2283


    vsellis
    Participant

    @vsellis

    How to show secondary profile fields while hiding the \”Base\” profile fields in a user profile:

    On line 3 of profile-loop.php add:<?php if (!bp_the_profile_group() == \"1\") : ?>

    (after the <?php while ( bp_profile_groups() ) : bp_the_profile_group(); ?>)

    and don\’t forget to close your \”if\” before the <? endwhile; ?>


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    Make your own custom BuddyPress page, slug, and template file

    https://buddypress.org/forums/topic/make-your-own-custom-buddypress-page


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    Group/User Avatar Mix-up (usually after update/upgrade)

    https://buddypress.org/forums/topic/surprising-avatar-behavior?view=all#post-24791

    I once posted a forum article about having profile information in the registration-mail to the admin, when a new member registers. We couldn’t accomplish that, but a friend of mine made it possible to have a direct link to the members-profile. That’s one click away and helps me very much, so that I don’t have to search for them. Here is the code, just put it in a php-file and in the mu-plugins folder:

    <?php
    /*
    Plugin Name: My Register Form
    Description: Customisations for the Registration Form
    Version: 0.1
    Author: Marc Cawood
    */

    // Custom Message in Registration Mail
    add_filter( 'newuser_notify_siteadmin', 'my_newuser_notify_siteadmin');

    function my_newuser_notify_siteadmin($msg) {
    global $current_site;
    // Extract member name
    $member = substring_between($msg, ': ', "n");
    // Link to member profile
    $member_url = clean_url("http://{$current_site->domain}{$current_site->path}members/".$member."/profile");
    return $msg . "nn" . $member_url;
    }

    function substring_between($haystack,$start,$end) {
    $start_position = strpos($haystack,$start)+strlen($start);
    $end_position = strpos($haystack,$end);
    return substr($haystack,$start_position,$end_position-$start_position);
    }

    ?>


    Nick Watson
    Participant

    @nickbwatson

    Email Login & Randomized User URLs

    check out the following link for the solution:

    https://buddypress.org/forums/topic/email-login-randomized-user-urls-solution

    When a user goes to register, they get to type in an email and a password.

    Their ‘username’ field is hidden.

    The code will randomly generate a URL for the person like below:

    mem12345abcdefghijklmnopqrst

    so their URL would be

    http://www.yoursite.com/members/mem12345abcdefghijklmnopqrst

    Freeing up the good names like John and Smith to be created manually by an administrator.


    Mike Pratt
    Participant

    @mikepratt

    It’s a great idea but just remember that the member directory, as it works now, alphabetizes by username so you will render that useless…for now


    Nick Watson
    Participant

    @nickbwatson

    The member directory alphabetizes by the ”Name” field, which is a mandatory profile field defaulted by buddypress. So the only place that the username is really displayed and used is in the url.


    Mike Pratt
    Participant

    @mikepratt

    @nickbwatson Duh. You’re right. I head my head somewhere else. What I meant to say was it screws up the new Mention feature which makes use of the @username model.


    Nick Watson
    Participant

    @nickbwatson

    Ahh, okay, I hadn’t heard of the feature yet.

    Maybe there’ll be a better solution somewhere.


    r-a-y
    Keymaster

    @r-a-y

    BP 1.2 Default Theme – Set the Activity Stream as front page, blog posts on another page:

    1) Login to the WP backend, navigate to “Pages > Add New”. Create an empty, new page called “News” or “Blog” or whatever you want. This page will contain the blog updates.

    2) Under “Settings > Reading”, set front page to “Activity Stream” and your posts page to the new page that you just created.


    r-a-y
    Keymaster

    @r-a-y

    BP 1.2 – Disable activity stream comments for blog and forum posts

    1) Login to the WP backend, navigate to “Buddypress > General settings”.

    2) Under “Disable activity stream commenting on blog and forum posts?” Select “Yes”.


    Tim Nicholson
    Participant

    @timnicholson

    r-a-y, is there any way to get comments on blog and forum posts (in the BP activity pages) to actually add the comment to the WP blog post or as a reply to the forum post? This would be SO useful. The way it works now is that your user’s comments end up staying only within the BP activity stream and don’t get reflected on your actual main website (blog)! Disabling it prevents that, but also removes the convenience of user’s being able to comment globally from a single place on their BP activity stream pages.

    I have to believe this *should* be a pretty easy plugin to develop (depending on how modular the WP and BP code is around this), but would much rather see this built into BP core. I already have a dozen WP plugins that I feel are essential for any blog and as I look to roll out BP, that’s going to add many more. I’m tapping out a dedicated server as it is and all these hooks and plugins and template tags and such require some seriously beefy hardware.


    r-a-y
    Keymaster

    @r-a-y

    @Tim

    No, not at the moment. This is something I’ve brought up before, but it’s a little bit more complicated than that.

    Feel free to create a plugin for it though ;)


    spammie
    Participant

    @spammie

    is there a way to get the member id in a member loop?

    <?php while ( bp_members() ) : bp_the_member(); ?>
    <input value="<?php bp_member_id(); ?>" name="ids[]"> ids </input>
    <?php endwhile; ?>

    bp_member_id() is not working, is there a way to achieve this?

    otherwise i would have to match the members with their name when doing the database query, and that can be a long string which takes too long to evaluate when compared to an int.

    i guess the answer to this question will be an obvious one, as soon as i read it, but right now i am confused

    good bye and thanks for all the fish

    spammie


    Brajesh Singh
    Participant

    @sbrajesh

    Yes, there is one :)

    Instead of bp_member_id() use

    bp_member_user_id()

    Inside the loop and It will give you the desired result.


    r-a-y
    Keymaster

    @r-a-y

    Help! There’s no register button on my BuddyPress site!

    If you’re using standard WP, login to the WP admin area, navigate to “Settings > General”, and make sure “Anyone can register” is checked.

    If you’re using WPMU, login to the WPMU admin area, navigate to “Site Admin > Options”, and under “Allow new registrations”, select any option but “Disabled”.


    Gianfranco
    Participant

    @gian-ava

    Standard WP – Getting rid of the “subdirectory” in permalinks when WP is installed in a subdirectory

    Create a file called “bp-custom.php” in wp-content/plugins.

    Paste this:

    function my_bp_override_core_domain() {
    $domain = get_bloginfo('url');
    return $domain;
    }
    add_filter('bp_core_get_root_domain','my_bp_override_core_domain');

    Now, instead of having: mysite.com/subfolder/activity, you have: mysite.com/activity.

    via https://buddypress.org/forums/topic/permalinks-setup-with-wp-intalled-in-subdirectory-and-indexphp-in-root#post-43767


    r-a-y
    Keymaster

    @r-a-y

    BuddyPress isn’t sending out emails (eg. activation emails, email notifications)

    This appears to be a problem with certain web hosts (Bluehost primarily).

    Members of the BP community have had success using the “Mail From” plugin:

    https://wordpress.org/extend/plugins/mail-from/

    Try this and reply in the following forum thread if it doesn’t work:

    https://buddypress.org/forums/topic/email-notification-not-working


    jivany
    Participant

    @jivany

    Redirect to User’s Profile Page on Login

    Place the following snippet in either wp-content/plugins/bp-custom.php or in your child theme’s functions.php file.

    function oci_login_redirect($redirect_to, $set_for, $user){
    $redirect_to = bp_core_get_userurl($user->id);
    return $redirect_to;
    }
    add_filter('login_redirect', 'oci_login_redirect', 10, 3);

    From https://buddypress.org/forums/topic/two-questions-about-the-login-process#post-8380

    (alternate method)

    Use Brajesh’s plugin (which does basically the same thing as above):

    https://wordpress.org/extend/plugins/bp-redirect-to-profile/

Viewing 25 replies - 1 through 25 (of 27 total)
  • The topic ‘FAQ: How To, Code Snippets and Solutions’ is closed to new replies.
Skip to toolbar