Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

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

  • GyziieDK
    Participant

    @dreampixel

    Hello

    I’m just curious, but what is the “select2” supposed to do? – Is this a secondary plugin you’ve got or what is the purpose of this?

    The Xprofile fields are capable on its own to support multi-select, so I’m just a bit confused on what you’re trying to accomplish here and what the actual issue is?

    Maybe a more detailed description would make it easier to try and troubleshoot this. πŸ™‚


    GyziieDK
    Participant

    @dreampixel

    Are you using LocoTranslate?

    In this case this might be the issue. There was a lot of issues after the update to WordPress 6.7 regarding how the text got translated. It seems to have been fixed with their latest update though.


    GyziieDK
    Participant

    @dreampixel

    Recieved your mail.. I’ll see what I can do πŸ™‚


    GyziieDK
    Participant

    @dreampixel

    And you use the BuddyX theme with BuddyPress and not the BuddyBoss Platform right?

    You can send me an email here: support@spiritualskill.com

    This reply will be deleted once you reach out, in order to prevent spam mails in the future. πŸ™‚


    GyziieDK
    Participant

    @dreampixel

    If this doesn’t work for you, it would be nice to get access at least to the site to troubleshoot the issue from there. I don’t have a ton of time to troubleshoot lol, but I would like to give it a try. Hopefully it can be fixed to work as intended so you can move on with something more fun to do than troubleshooting the same issue for days lol.

    I could provide you with my “junk-email” which I use for this exact purpose (if needed).


    GyziieDK
    Participant

    @dreampixel

    I think I understand what your issue if yes, but still sounds wierd to me lol.

    Anyways, you could try add this snippet code into a WPcode PHP snippet and see if it will do the trick for you by setting up default sorting to be by display name.

    // Force BuddyPress member directory to always be sorted by display name
    function custom_buddypress_member_sorting( $args ) {
        // Check if the current page is the members directory
        if ( bp_is_members_directory() ) {
            // Set the 'orderby' to 'display_name' and 'order' to 'ASC'
            $args['orderby'] = 'display_name';
            $args['order'] = 'ASC';  // You can change to 'DESC' for descending order
        }
        
        return $args;
    }
    add_filter( 'bp_after_has_members_parse_args', 'custom_buddypress_member_sorting' );

    Let me know if that might solve your issue. πŸ™‚


    GyziieDK
    Participant

    @dreampixel

    If you want the “Name” (display name) to always be set by default to “username”, you can add this code into your functions.php (or preferable using the Snippet Code plugin WPCode – with a PHP snippet code).

    This should setup the default display name to always show the “username” when creating new user profiles.

    // Function to set the display name to the username for new users or profile updates
    function bp_sync_display_name_with_username($user_id) {
        // Get the user data
        $user_info = get_userdata($user_id);
        
        if ($user_info) {
            // Get the username
            $username = $user_info->user_login;
    
            // Update display_name to the username
            wp_update_user(array(
                'ID' => $user_id,
                'display_name' => $username
            ));
        }
    }
    
    // Hook the function to user registration and profile update actions
    add_action('user_register', 'bp_sync_display_name_with_username');
    add_action('profile_update', 'bp_sync_display_name_with_username');

    Also, you can add another function to sort by alphabetical by default if this continues to be causing you issues.

    // Function to set default BuddyPress member sorting to alphabetical
    function bp_default_members_sorting_alphabetical($args) {
        // Check if the 'type' is not set, set it to 'alphabetical'
        if (empty($args['type'])) {
            $args['type'] = 'alphabetical';
        }
        return $args;
    }
    
    // Apply the filter to the member query arguments
    add_filter('bp_after_has_members_parse_args', 'bp_default_members_sorting_alphabetical');

    Let me know if that works for you.


    GyziieDK
    Participant

    @dreampixel

    Hello again @forinn

    I hate to make a different txt-document since it would not let me upload a longer answer in here and then started to refuse because of duplicate posting. Anyways, see my attached answer from the link below.

    https://jumpshare.com/s/G4ocRkpfKm3w25l4qrjD

    Hope it helps! πŸ™‚


    GyziieDK
    Participant

    @dreampixel

    @forinn I’m trying to upload a reply, but it’s not letting me lol. I’m getting back to you with an answer asap when it lets me post.


    GyziieDK
    Participant

    @dreampixel

    I just wanted to thank @dreampixel for the support they are giving here on the site. It’s very refreshing. Usually no help whatsoever is offered by any of the people behind Buddypress. None.

    Hello @thinlizzie πŸ™‚

    I’m by no means an expert or anything lol, but I’ve been playing around with WordPress and numerous different large setups for the past 15+ years. I normally reply to people if I got the time or ideas on what could be done.

    That is not my experience that there is no support in here. Please remember that BuddyPress is open source and the users in here (mods included) are not obligated to help/offer support all the time. Most people in here have other projects going on and/or might not be able to help. Also, a lot of the time the same issues are highlighted again and again instead of people searching the forums for answers first.

    That being said, I also appreciate when people try to help me troubleshooting, since it can be quite frustrating when things doesn’t work, and you have people depending on it.


    GyziieDK
    Participant

    @dreampixel

    Also please note that the name field marked in the Users > Profile Fields with “(Primary)” IS the display name itself. This should be the field users use upon registration of their user – and this is also the field the BuddyPress Member Directory uses to sort content Alphabetical.


    GyziieDK
    Participant

    @dreampixel

    Hello again πŸ™‚

    This might start to make sense then!

    First, when you translate something within the code itself (not using a translation plugin and po/mo file) it will for the most part be overridden whenever you update your WordPress / plugins that are translated. So, this might be why it doesn’t work now after the update.

    I personally use a combination of LocoTranslate and TranslatePress. This is because BuddyPress activity is updated the way it is and for that reason LocoTranslate itself is not able to translate the dynamic content (like when activity updates – without the page doing so) – this TranslatePress supports.

    So, for the BuddyPress content that can’t be translated correctly using LocoTranslate, I use the TranslatePress for those. Both plugins are free to use, and it doesn’t require you to purchase any expensive addons.

    It’s important that you pick the right placement for your translation-files (custom, author, system). If they’re not in the right place the translation might not show up on the front-end. Also make sure you setup the settings within the LocoTranslate plugin not to override your translated files upon updating WordPress: Loco Translate > Settings > File system access > Modification of installed files & Editing of POT (template) files must be set to Disallow.

    For the display name, this should be the default value it sorts by. Mine by default sorts by display name. When you go to Users > Profile Fields – you can edit the different settings from within there with the names and what is mandatory/not mandatory.

    For the sorting part (or other features in the future) if it still causes issues, maybe a snippet code using a plugin like WPCode Lite might be a better solution rather than going into the code and edit it from there. In this way it will not get affected in most cases when you update WordPress, plugins and theme.

    Maybe some of this can help you – if not – then feel free to keep me updated. πŸ™‚


    GyziieDK
    Participant

    @dreampixel

    Sounds weird, since I’m also using the user fields (xProfile fields) – my site is translated into Danish, but my site-admin back-end it set to English. This is due to it being easier to find items in the menu when troubleshooting (hate when settings and so on is translated lol).

    So seems weird to me if the translation part of it is causing the issue, since I’m also using it, but not having the same issue?

    Hope you find a solution and it ends up working for you though! πŸ™‚


    GyziieDK
    Participant

    @dreampixel

    Found the solution with the following code:

    Restrict in single group

    function restrict_activity_posting_for_specific_group( $can_post, $user_id, $group_id ) {
        // The ID of the group you want to restrict posting in (replace with the actual group ID)
        $restricted_group_id = 123;  // Example group ID
    
        // Only apply the restriction to the specific group
        if ( $group_id == $restricted_group_id ) {
            // Check if the user is an admin or moderator
            if ( !bp_group_is_admin( $user_id, $group_id ) && !bp_group_is_mod( $user_id, $group_id ) ) {
                return false;  // Don't allow posting
            }
        }
    
        // If not the restricted group, or the user is admin/mod, allow posting
        return $can_post;
    }
    add_filter( 'bp_activity_can_post', 'restrict_activity_posting_for_specific_group', 10, 3 );

    Restrict in multiple groups

    function restrict_activity_posting_for_specific_groups( $can_post, $user_id, $group_id ) {
        // The IDs of the groups you want to restrict posting in (replace with actual group IDs)
        $restricted_group_ids = array( 123, 456, 789 );  // Example group IDs
    
        // Check if the group ID is in the restricted group IDs array
        if ( in_array( $group_id, $restricted_group_ids ) ) {
            // Only apply the restriction if the user is not an admin or moderator
            if ( !bp_group_is_admin( $user_id, $group_id ) && !bp_group_is_mod( $user_id, $group_id ) ) {
                return false;  // Don't allow posting
            }
        }
    
        // If not in the restricted groups or the user is an admin/mod, allow posting
        return $can_post;
    }
    add_filter( 'bp_activity_can_post', 'restrict_activity_posting_for_specific_groups', 10, 3 );

    GyziieDK
    Participant

    @dreampixel

    Unfortunately this plugin breaks the “groups” settings from backend and comes up with a critical error, so if anyone has a solution, please let me know. πŸ™‚


    GyziieDK
    Participant

    @dreampixel

    Sounds like compatibility issue within the theme then. Have you tried it with a BuddyPress supported theme?


    GyziieDK
    Participant

    @dreampixel

    You can add users from back-end, yes.. but the users still need to “activate” their account and login for them to show up on the front-end (in directory).

    Does the member show up in the normal member directory? – and is the issue only with the “alphabetical search”? .. My alphabetical search works fine, so might be a theme compatibility issue.

    Have you cleared both server and browser cache?


    GyziieDK
    Participant

    @dreampixel

    Found plugin that does the job:

    BP Fan Page


    GyziieDK
    Participant

    @dreampixel

    Try download this plugin – and switch to the user you created (can also be done from backend) – and “login” with that user. Normally users show up, when they have logged in after registration.

    Maybe that works. πŸ™‚

    User Switching


    GyziieDK
    Participant

    @dreampixel

    Please do me a favor, go to your latest buddypress and wordpress version and try to use the userlist/friendlist, I am 1000% sure you are having the same issues.

    Sorry, but works fine for me – even with latest update to BuddyPress Version 14.2.1.

    I even run a pretty complex site with a lot of software that needs to be compatible – including custom code setups and so on. Still works πŸ™‚


    GyziieDK
    Participant

    @dreampixel

    Hello again πŸ™‚

    The user you’re setting up, is this a legit setup with a mail (where you can activate the account)?. If not, then maybe give this a try. Normally users must activate their accounts from a mail they receive upon registration before they’re visible on the directory.

    Also, what settings have you setup under the following:
    Settings > BuddyPress > Options

    This might make it easier for me to see if anything in there is the culprit. πŸ™‚


    GyziieDK
    Participant

    @dreampixel

    Does sound like there is a conflict somewhere – no snippet codes enabled while troubleshooting?
    Could you provvide screenshots of what it looks like on your end? πŸ™‚


    GyziieDK
    Participant

    @dreampixel

    Hello @forinn

    Works fine for me, so sounds like a third-party conflict or maybe an issue within your theme.

    Have you tried troubleshooting the issues? (Cleared cache, tested compatibility within plugins and so on?)


    GyziieDK
    Participant

    @dreampixel

    Hello @emaralive

    Thank you for the update. Sounds exciting – I’m looking forward for the new release when it’s ready. In the meantime I just made the “Load More” button hidden on my site. πŸ™‚

    Please keep me updated. Thank you! πŸ™‚


    GyziieDK
    Participant

    @dreampixel

    Figured it out (I’m stupid lol).

    I can confirm that the snippet from Brajesh Singh still works. Just make sure to place it into your bp-custom.php (/wp-content/plugins/bp-custom.php). Turns out my role wasn’t called “Basic” (as shown/named within the backend). Since I use Paid Membership Pro it used pmpro_role_1 set by PMP.

    Remember to change the role within the code down below to the one you want to exclude. πŸ™‚

    Credit: https://buddydev.com/hiding-users-on-buddypress-based-site/

    /**
     * Exclude Users from BuddyPress Members List by WordPress role.
     *
     * @param array $args args.
     *
     * @return array
     */
    function buddydev_exclude_users_by_role( $args ) {
    	// do not exclude in admin.
    	if ( is_admin() && ! defined( 'DOING_AJAX' ) ) {
    		return $args;
    	}
    
    	$excluded = isset( $args['exclude'] ) ? $args['exclude'] : array();
    
    	if ( ! is_array( $excluded ) ) {
    		$excluded = explode( ',', $excluded );
    	}
    
    	$role     = 'administrator';// change to the role to be excluded.
    	$user_ids = get_users( array( 'role' => $role, 'fields' => 'ID' ) );
    
    	$excluded = array_merge( $excluded, $user_ids );
    
    	$args['exclude'] = $excluded;
    
    	return $args;
    }
    
    add_filter( 'bp_after_has_members_parse_args', 'buddydev_exclude_users_by_role' );
Viewing 25 replies - 1 through 25 (of 52 total)
Skip to toolbar