Skip to:
Content
Pages
Categories
Search
Top
Bottom

Help me sort out my BuddyPress install


  • daltontastic
    Participant

    @daltontastic

    I love BuddyPress and use it to power my community. It’s current setup isn’t necessarily easy to maintain when it comes to updates (and there is also some stuff I low key hate).

    I allow people to use color tags in their status updates using the bp_activity_filter_kses function. They aren’t real HTML tags btw, but they work because of my CSS rules here.

    Inside of my bp-custom.php it looks like this:

    function bp_activity_filter_kses($content)
    {
        global $allowedtags;
        
        $activity_allowedtags = $allowedtags;
            
            $activity_allowedtags['a']['href']   = array();
            $activity_allowedtags['b']           = array();
            $activity_allowedtags['i']           = array();
            $activity_allowedtags['darkblue']    = array();
            $activity_allowedtags['darkgreen']   = array();
            $activity_allowedtags['darkaqua']    = array();
            $activity_allowedtags['darkred']     = array();
            $activity_allowedtags['darkpurple']  = array();
            $activity_allowedtags['gold']        = array();
            $activity_allowedtags['gray']        = array();
            $activity_allowedtags['blue']        = array();
            $activity_allowedtags['green']       = array();
            $activity_allowedtags['aqua']        = array();
            $activity_allowedtags['red']         = array();
            $activity_allowedtags['lightpurple'] = array();
            $activity_allowedtags['yellow'] = array();
            $activity_allowedtags['a']['href']   = array();
            
        $activity_allowedtags = apply_filters('bp_activity_allowed_tags', $activity_allowedtags);
        return wp_kses($content, $activity_allowedtags);
    }

    My reasoning behind removing this from bp-activity/bp-activity-filters.php is that I didn’t want to have to manually update my entries every single time BuddyPress updated. I had to delete it from the original source code or else the site wouldn’t load (I’m assuming the identical functions were conflicting).

    Is there a way to put my custom allowed tags in bp-custom.php that will work with each consecutive update. As it currently stands next time I update BuddyPress the core files will be defaulted (and my site won’t load lmao).

    I also noticed buddypress.pot doesn’t actually seem to do anything and most times I have to actually edit the messages in the core files. What is the point of that file even existing?

    Inside of bp-groups/bp-groups-template.php starting at line 4320 I have code that only lets you create groups if you have at least $10 in your account balance. When I update BuddyPress this file is going to be defaulted.. See my problem? Is there any detailed bp-custom.php documentation online?

    function bp_user_can_create_groups() {
    
    	// Super admin can always create groups.
    	if ( bp_current_user_can( 'bp_moderate' ) ) {
    		return true;
    	}
    	$id = get_current_user_id();
        $donations = mycred_get_users_cred( $id );
        if ($donations >= 10) {
            return true;
        }

    LASTLY –

    Inside of entry.php I put a verified badge by certain user’s names like this:

    <div class="activity-content">
            <div class="activity-header">
    <?php
    
    $id = bp_get_activity_user_id();
    
    $verified_group_id = 10;
    
    if (groups_is_user_member( $id, $verified_group_id )) {
        $verified = true;
    } else {
        $verified = false;
    }
    
    $donations = mycred_get_users_cred( $id );
    
    $aid = bp_get_activity_id();
    
    if ($verified === true) {
        echo "
        <span title='Verified'>
    <span class='fa fa-stack fa-lg' style='font-size:9px;color:#00AAAA;margin-top: -3.5px;margin-right: -4px;'>
        <i class='fa fa-certificate fa-stack-2x'></i>
        <i class='fa fa-check fa-stack-1x fa-inverse'></i>
    </span>
    </span>
    ";
    echo "
    <style>
    @media screen and (max-width: 720px) {
    
    #activity-$aid {
        background-color: rgba(0,170,170,0.1) !important;
    }
    #buddypress .activity-comments {
        background-color: #eef1f1 !important;
    }
    
    }
    </style>
    ";
    }
    ?>

    That is the best placement I could find. Check out this activity update as an example (click here)

    On any social media site the verified badge always goes after the person’s name, but there is nowhere in entry.php to put it after the name. It looks so silly before the name. I also add a badge to names in comments (and it’s before the name too and I hate it).

    Is there code somewhere that will let me place it after their name instead of before it? I know it’s in the action section but that appears to be a unified thing.

Viewing 2 replies - 1 through 2 (of 2 total)

  • danbp
    Moderator

    @danbp

    positionning: check CSS pseudo class :before or :after

    buddypress.pot: this file does nothing! It contains only the strings you can translate. If you need a translation, you have to create a po and a compiled mo file. To do this you need a tool like poEdit.

    Any code placed in bp-custom.php stays untouched after an update. It works like a child-theme.

    To add your own create group button output function, unhook the current ones:

    remove_action( 'bp_groups_directory_group_filter', 'bp_legacy_theme_group_create_nav', 999 );
    remove_action( 'bp_groups_directory_group_filter', 'bp_group_backcompat_create_nav_item', 1000 );

    and add your own to bp-custom.php:

    add_action( 'bp_groups_directory_group_filter', 'my_dolla_bill_group_create_button', 82 );
    function my_dolla_bill_group_create_button() {
    	if ( dolla_bill_has_dollas ) { 
                 bp_group_create_nav_item();
            }
    }

    Your other issues can probably be solved in the similar way. Read up on hooks and actions in WP: http://blog.teamtreehouse.com/hooks-wordpress-actions-filters-examples

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar