Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 25 replies - 1,526 through 1,550 (of 3,787 total)
  • @danbp

    Participant

    you’re on front-end, I’m talking about backend
    your-site/wp-admin/users.php

    @danbp

    Participant

    Afaik there is nothing out to do this.

    As start point, this snippet which let you hide a profile by user_id. Add it to bp-custom.php

    
    function bpfr_hide_user_profile() {
    global $bp; 
    // hide user_id 35
    if(bp_is_profile && $bp->displayed_user->id == 35 && $bp->loggedin_user->id != 35) :
       wp_redirect( home_url() );
       exit;
    endif;
    }
    add_action( 'wp', 'bpfr_hide_user_profile', 1 );

    Also, from here
    https://buddypress.org/support/topic/temporarily-blocking-a-user-while-keeping-their-datanetwork/
    https://wordpress.org/plugins/buddypress-verified/

    @danbp

    Participant

    I’m wondering what is a username for you.

    WP register only a user by username (aka pseudonym), email and password. BP add a Name field in which you can add anything: username, first or lastname. In the user table, there is also display_name, wich is the combination of first and last name from a WP user profile, before BuddyPress was installed or if you allow your users to enter the dashboard, and they start to play with their profile settings. IMHO, it’s better they haven’t that access when BP is activated. 👮

    When on the members directory, you (connected or not) can search a member by using his username.

    If you use WP’s site search from toolbar or the search widget (same thing), it doesn’t work, as members are not post types… 👣

    For now, i’m unsure what you want to fetch. Do you mean display_name ?

    All search forms available in BP are contextualized, as @henrywright expected.

    A BP class can be extended, a core function with a filter can be extended. You simply add your own to it.
    In other cases, like for bp_core_action_search_site function (in bp-core-classes.php)
    there is an action and a filter. Wow. 💪

    You can rewrite the whole function and use the action hook or only change a part of it by using the filter.

    remove_action( 'bp_init', 'bp_core_action_search_site', 7 );
    function my_custom_core_action_search_site() {
       bla bla bla....
    }
    add_action( 'bp_init', 'my_custom_core_action_search_site', 7 );

    or
    add_filter( 'filter_name', function_name');

    Theorie here:
    https://buddypress.org/support/topic/how-to-override-core-function/

    But before hacking to deep, read here:

    Members Loop

    Maybe you could find some interesting things about include or search_tems options. 👀

    If all this is too much for you, consider this plugin:
    https://wordpress.org/plugins/buddypress-global-search/

    @prabin04, @henrywright
    🚧 i’m really not an expert in matter of BP search, but thank you for your consideration.

    @danbp

    Participant

    Anything related to notifications is in /buddypress/bp-notifications/ folder.

    Best place to see commented BP code in a glance is
    http://hookr.io/plugins/buddypress/#index=a

    @danbp

    Participant

    @tafmakura,

    try

    function bpfr_hide_top_nav() {	
    if( bp_is_active('xprofile' ) )	
    	bp_core_remove_nav_item( 'profile' );
    }
    add_action( 'bp_ready', 'bpfr_hide_top_nav' );

    @danbp

    Participant

    shareit/wordpress/sample-page/groups/test this path looks strange.

    In which directory are WP/BP installed ?

    Configure BuddyPress


    Each component page must stay blank and without any template models or parent page…
    Permalinks must be enabled, using any option except “default”.

    @danbp

    Participant

    Consider this plugin:
    https://wordpress.org/plugins/disable-users/

    Works like a charm from within user profile admin.
    dashboard > users > username > modify and check Disable User Account

    @danbp

    Participant

    Search by username is not possible yet with the mentionned plugin.
    https://wordpress.org/support/topic/search-by-username

    If you’re comfortable with coding, see this gist.

    Site search source code is in bp-core-functions.php:2236

    @danbp

    Participant

    This page is on front-end: mysite/groups/groupname/admin/manage-members/

    The snippet is playing on the user list in admin. The access to delete a group user is in the bulk action selector, at the top left of that list.

    @danbp

    Participant

    You’re welcome 😉

    @danbp

    Participant

    why does bp_member_profile_data pull in the array data but not print the classes ?

    1) Because this function handles only the field value and the user ID.

    2) You add the div outside of the array.

    if ( $datas = bp_get_profile_field_data( array( 'field' => 'Service' ) ) ) :
    echo '<div class="whatever">';
    	foreach ( $datas as $data ) { 		
    echo $data.'&nbsp;';
        }
    echo '</div>';
    endif;

    nbsp is needed to space datas

    @danbp

    Participant

    Codex is your friend:

    bp-custom.php

    @danbp

    Participant

    Difficult to say without knowing the theme name and WP config (single or network install).
    In BP settings you can allow the toolbar to logged in user only.

    @danbp

    Participant

    @danbp

    Participant

    hi @palmdoc,

    as expected by @henrywright, there is an easier solution from backend. I quickly tested it and it seems to work.

    The snippet will add a bulk option to members list (in admin), which let you remove users from groups. Like on front-end, the admin user list is searchable by user.

    Add this to bp-custom.php

    // remove users from groups
    add_action('load-users.php',function() {
    
    if(isset($_GET['action']) && isset($_GET['bp_gid']) && isset($_GET['users'])) {
        $group_id = $_GET['bp_gid'];
        $users = $_GET['users'];
        foreach ($users as $user_id) {
            groups_leave_group( $group_id, $user_id );
        }
    }
        //Add some Javascript to handle the form submission
        add_action('admin_footer',function(){ ?>
        <script>
            jQuery("select[name='action']").append(jQuery('<option value="groupleave">Remove from BP Group</option>'));
            jQuery("#doaction").click(function(e){
                if(jQuery("select[name='action'] :selected").val()=="groupleave") { e.preventDefault();
                    gid=prompt("Please enter a BuddyPres Group ID","");
                    jQuery(".wrap form").append('<input type="hidden" name="bp_gid" value="'+gid+'" />').submit();
                }
            });
        </script>
        <?php
        });
    });

    @danbp

    Participant

    hi @tafmakura,

    As first, did you activated Activity auto-refresh in BP settings ?
    Second, as it concern a custom feature of yours, you have to check for ajax requests on your action post variable.
    That said, there is a latency of 15 seconds before “load more” will show up a new activity. Not sure if this can be modified.

    Seach on Trac for some hints about Ajax and activity.
    Perhaps those tickets #5328, #6195 can help you.

    @danbp

    Participant

    hi,

    first snipppet removes the mention tab.
    Second remove the mention item from the top right usermenu below howdy.

    Condition is set to site admin. If you use custom capabilities, change that to your need.
    Code goes to bp-custom.php

    function bpfr_hide_mention_nav() {
    	//if ( bp_current_user_can( 'bp_moderate' ) )
    	if ( is_super_admin() ) {
    		return;
    	} 
    	bp_core_remove_subnav_item( 'activity', 'mentions' ); 
    }
    add_action( 'bp_ready', 'bpfr_hide_mention_nav' );
    
    function bpfr_admin_bar_remove_activity_mentions(){
    global $wp_admin_bar;
    	if ( is_super_admin() ) {
    		return;
    	}
    	$wp_admin_bar->remove_node('my-account-activity-mentions');
    }
    add_action('wp_before_admin_bar_render','bpfr_admin_bar_remove_activity_mentions');
    

    An alternate (IMO better) solution, is this premium plugin: http://www.philopress.com/products/buddynotes/

    In reply to: Add a Text Area Field

    @danbp

    Participant

    hi,
    Dashboard > Users > Profile Fields > Add new field

    Name []
    Description []
    Type > select Multi-line Text Area

    User Extended Profiles

    In reply to: Logged in home page

    @danbp

    Participant

    To redirect your users to their friends activities page on login, you can use this:

    function bpdev_redirect_to_profile( $redirect_to_calculated, $redirect_url_specified, $user ){
     
        if( empty( $redirect_to_calculated ) )
            $redirect_to_calculated = admin_url();
     
        //if the user is not site admin,redirect to his/her profile
    	$url = bp_core_get_user_domain( $user->ID ) .'activity/friends/';
    
        if( isset( $user->ID) && ! is_super_admin( $user->ID ) )
            return $url;
        else
            return $redirect_to_calculated; /*if site admin or not logged in,do not do anything much*/
     
    }
    add_filter( 'bp_login_redirect', 'bpdev_redirect_to_profile', 11, 3 );

    Snippet source: http://buddydev.com/buddypress/buddypress-trick-redirect-users-to-their-profile-on-login/

    To add a home button to the main menu, use WP’s menu builder. But this doesn’t let you add a dynamic button going to EACH user profile, only to yours. You will have to code this.

    See from here how to do this:
    https://buddypress.org/support/topic/how-to-get-notification-count-code/#post-244069
    You need to introduce this:
    $url = bp_core_get_user_domain( $user->ID ) .'activity/friends/';

    @danbp

    Participant

    Ok, i see… multiselectbox/checkbox values are returned in a array.

    if ( $data = bp_member_profile_data( 'field=Musical Genre' ) )....endif; thing cannot work, because we have to fetch the whole array of values, not only one.
    Give this a try:

    function custom_display_xprofile_fields() {
    
    if ( $data = bp_get_profile_field_data( 'field=Artist Name' ) ) : 
    	echo '<div class="artist"><h4 class="user-nicename">'. xprofile_get_field_data( 'Artist Name', bp_displayed_user_id() ) .'</h4></div>';
    endif;
    
    if ( $datas = bp_get_profile_field_data( array( 'field' => 'Musical Genre' ) ) ) :
        foreach ( $datas as $data ) { 
           echo '<div class="genre">'. $data .'</div>';
        }
    endif;
    
    if ( $data = bp_get_profile_field_data( 'field=Location' ) ) : 
    	echo '<div class="location">'. xprofile_get_field_data( 'Location', bp_displayed_user_id() ) .'</div>';
    endif;
    }
    add_action( 'bp_profile_header_meta' , 'custom_display_xprofile_fields' );

    @danbp

    Participant

    Despite your efforts, it seems that you miss some basics.
    Your class name may be wrong. CSS class names cannot contain spaces.

    Try to use mdetcenter-genre. And do same thing for all other custom class.

    That said, i don’t know why only this div doesn’t show up while the 2 other are showing (?).
    What is the field type of Musical genre being an “open issue” ? A multi-select box ? A checkbox ?…

    The snippet i provided is working and shows up in two places. You can(should) remove the one or the other. Are both places affected by this div issue ? Try with p, but i doubt that it will work better if div or li don’t work. An values ouput has nothing to do with html in this case.

    add_filter is handled near user name, add_action is going underneath all messages buttons.

    In reply to: Filter Profile Fields

    @danbp

    Participant

    This is possible as built-in feature from within a profile. Each field value is clickable by default (in fact the 5 first words). When clicked, you get a list of all members who entered the same value.

    To list the member directory by xprofile field values, you have to code it or modify the directory template. Read from here:

    Members Loop

    @danbp

    Participant

    How else would I override the buddypress file unless it was in my child theme with the same name?

    You should NOT override core files. The only files you alter from child theme are template files.

    To alter core functions, you use custom functions and add them via filter hooks, preferably added to bp-custom.php – so you won’t loose your work at next update.

    member-profile.php doesn’t exist in BuddyPress.

    Codex is your friend !

    Theme Compatibility & Template Files

    Displaying Extended Profile Fields on Member Profiles

    … and forum search too. 😉

    @danbp

    Participant

    Is your child theme working correctly with Kleo ?
    Is the altered member-header.php file in your child-theme ?
    Do you really use a file called member-profile.php, as stated in your first topic ? Bad !

    Remove all your custom snippets and revert back to original BP template fisrt, then try this in bp-custom.php:

    function custom_display_xprofile_fields() {
    
    echo 'Custom display fields';
    echo '<ul>';
    if ( $data = bp_get_profile_field_data( 'field=Artist Name' ) ) : 
    	echo '<li>'. xprofile_get_field_data( 'Artist Name', bp_displayed_user_id() ) .'</li>';
    endif;
    
    if ( $data = bp_get_profile_field_data( 'field=Musical Genre' ) ) : 
    	echo '<li>'. xprofile_get_field_data( 'Musical Genre', bp_displayed_user_id() ) .'</li>';
    endif;
    
    if ( $data = bp_get_profile_field_data( 'field=Location' ) ) : 
    	echo '<li>'. xprofile_get_field_data( 'Location', bp_displayed_user_id() ) .'</li>';
    endif;
    
    echo '</ul>';
    }
    add_action( 'bp_profile_header_meta' , 'custom_display_xprofile_fields' );
    add_filter( 'bp_before_member_header_meta', 'custom_display_xprofile_fields' );

    @danbp

    Participant

    @tischla,
    unable to reproduce your issue.
    Did you activated Private Messaging component in BP settings ?

    Which them and plugins are you using ?
    Have you tested with only WP/BP enabled (without other plugins) and One of Twenty’s theme ?

Viewing 25 replies - 1,526 through 1,550 (of 3,787 total)
Skip to toolbar