Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 25 replies - 1 through 25 (of 84 total)
  • Profile photo of David Cavins
    David Cavins
    Participant

    @dcavins

    You could add a page-load listener and look for the action using bp_is_current_action(). To learn more about what action or action_variables are set as you browse your site, I recommend adding r-a-y’s BP Footer Debug plugin: https://gist.github.com/r-a-y/5736878

    Page loads are often caught on the action bp_actions.

    You’d have to do some more work to make sure that your filters can’t collide with group names.

    Profile photo of David Cavins
    David Cavins
    Participant

    @dcavins

    Your best best is to create a new language file, then you can customize nearly all of the strings:
    https://codex.buddypress.org/getting-started/customizing/customizing-labels-messages-and-urls/

    Profile photo of David Cavins
    David Cavins
    Participant

    @dcavins

    Hi Zoe-

    My memory is that users need to have usermeta with the key last_activity and a value like 2015-06-16 13:29:04 to reliably appear in the members directory. You can “repair” this value once the users are imported by visiting (from wp-admin) Tools > BuddyPress then select Repair user "last activity" data. In fact, it probably wouldn’t hurt to run all of those repair tools one at a time since you’ve got a bunch of untracked users.

    Profile photo of David Cavins
    David Cavins
    Participant

    @dcavins

    Hi @pilha-

    That’s totally weird behavior. It seems like the table in your database has lost its mind. :)

    Can you check the structure of the table wp_bp_groups? What I want to know is:

    • Is id set as the primary key?
    • Is id set to auto-increment?

    Since you’ve already emptied records from the database, I suspect you’re familiar with some software for MySQL management like phpMyAdmin. Can you check the questions above?

    Profile photo of David Cavins
    David Cavins
    Participant

    @dcavins

    Hi Pihla-

    I can’t reproduce the problem you’re having. Can you add a tracer to your theme’s functions file or to bp-custom.php then try to create a group?

    https://gist.github.com/dcavins/a9197f21d7f31b6594bc

    I added this to my theme’s functions.php and the file that it created (groups_group_after_save_args.txt) ended up at the root of my site. It looked like this:

    
    newly created group args: BP_Groups_Group Object
    (
        [id] => 8
        [creator_id] => 4
        [name] => Number 5
        [slug] => number-5
        [description] => Will this be recorded?
        [status] => public
        [enable_forum] => 0
        [date_created] => 2015-06-15 14:59:00
        [admins] => 
        [mods] => 
        [total_member_count] => 
        [is_member] => 
        [is_invited] => 
        [is_pending] => 
        [last_activity] => 
        [user_has_access] => 
        [args] => Array
            (
                [populate_extras] => 
            )
    
    )
    

    Please let me know if you can do this test and what the results are.

    Profile photo of David Cavins
    David Cavins
    Participant

    @dcavins

    Is Settings > General > “Membership” section “Anyone can register” checked?

    Profile photo of David Cavins
    David Cavins
    Participant

    @dcavins

    I can verify this behavior and will take a look.

    Thanks for the report.

    Profile photo of David Cavins
    David Cavins
    Participant

    @dcavins

    I think I’ve solved this by removing the do_shortcode filter on that admin page. (It’s the front-end settings screen created by the group extension.)

    
    add_action('bp_init','dont_process_shortcodes_filter');
    function dont_process_shortcodes_filter() {
          if ( bp_is_current_component( 'groups' ) && bp_is_current_action( 'admin' ) && bp_is_action_variable( $extension_slug, 0 ) ) {   	) {
            	remove_filter( 'the_content', 'do_shortcode', 11);
          }
    }
    

    I was using the wrong priority on remove_filter, which always gets me. :)

    Thanks for your help!

    Profile photo of David Cavins
    David Cavins
    Participant

    @dcavins

    I still haven’t solved this. It looks like it’s not just me though. It’s also true that if you insert short codes in bbPress topic content then edit that content, the short codes are interpreted in the editor input box.

    Does anyone have any ideas how I could make some headway on this problem? Thanks!

    Profile photo of David Cavins
    David Cavins
    Participant

    @dcavins

    I solved this by adding the following filter. It removes “group-button” from the button wrapper (only on request membership buttons) so that buddypress.js will ignore the click.

    
    add_filter( 'bp_get_group_join_button','request_membership_redirect' );
    
    	/**
    	 * Change group "Request membership" button behavior-- always redirect to request membership pane, no AJAX requests.
    	 *
    	 */
    	public function request_membership_redirect( $button ) {
    		// To prevent buddypress.js from acting on the request membership button click, we'll need to remove the class .group-button from the button wrapper. See buddypress.js line 1252.
    
    		if ( $button[ 'id' ] == 'request_membership' )
    			$button[ 'wrapper_class' ] = str_replace( 'group-button', '', $button[ 'wrapper_class' ] );
    
    		return $button;
    	}
    
    Profile photo of David Cavins
    David Cavins
    Participant

    @dcavins

    Does the logout redirect work if BuddyPress is deactivated (i.e. if you’re just running a typical WordPress site)?

    Profile photo of David Cavins
    David Cavins
    Participant

    @dcavins

    The label of the button is internationalized. See bp-friends-template.php : bp_get_add_friend_button()

    I’d double-check this guide: https://codex.buddypress.org/getting-started/customizing/customizing-labels-messages-and-urls/

    I personally had trouble with getting the naming convention on the .po and .mo files right.

    Profile photo of David Cavins
    David Cavins
    Participant

    @dcavins

    Sure. You’ll need a to make a loop in which you get the ids of the group members and then create a query to fetch those posts.

    For getting group member ids, look at:
    groups_get_group_members( $args = array( $group_id => # ) )

    For the query by author ids: https://codex.wordpress.org/Class_Reference/WP_Query#Author_Parameters

    Profile photo of David Cavins
    David Cavins
    Participant

    @dcavins

    Hi Leonson-

    This sounds like a .htaccess or server configuration problem. What kind of server are you running the site on? Can you post the rewrite rules from your htaccess file (assuming it’s a linux server)?

    -David

    Profile photo of David Cavins
    David Cavins
    Participant

    @dcavins

    Hugo-

    Thanks so much for the push. I was going about this the wrong way, and had totally forgotten about the template hierarchy: https://codex.buddypress.org/themes/theme-compatibility-1-7/template-hierarchy/

    Thanks for your quick reply,

    -David

    Profile photo of David Cavins
    David Cavins
    Participant

    @dcavins

    It sounds like you’re heading in the direction of a private community. Keep in mind that if it’s private, then search engines can’t index your content. Which may be good or bad, depending on your goals.

    You’ll find a lot of info by searching this support forum or the web for “buddyPress private community”

    For instance:
    https://buddypress.org/support/tag/private-community/

    Profile photo of David Cavins
    David Cavins
    Participant

    @dcavins

    You’ll need to logout to visit the register page. (If you’re already logged in, then you don’t need to register.)

    I usually fire up a second browser to see what the non-logged-in user sees. In this case, it’s the only way to visit the register page.

    Profile photo of David Cavins
    David Cavins
    Participant

    @dcavins

    I think it really depends on the plugin. Some plugins make the creation step routine filterable (like BuddyPress docs) and some do not, unfortunately. Of course, uou could add a filter to plugins that don’t have them, and submit the changes back to the plugin author.

    In the case where it is filterable, like BP docs, you can hook in like this:

    add_filter('bp_docs_default_group_settings', 'bp_docs_default_settings_for_child_groups', 10, 1);
    function bp_docs_default_settings_for_child_groups($settings) {
      // If this new group is a child group of another group, we'll set up BP docs to match the parent group's setup. This step copies the parent group's attributes over to the child group.
      // We may have to get the parent ID from the cookie 'bp_new_group_parent_id'
        $parent_id_cookie = $_COOKIE["bp_new_group_parent_id"] ;
        $parent_settings = groups_get_groupmeta( $parent_id_cookie, 'bp-docs');
        
        if ( !empty($parent_settings) ) {
          $settings = array(
              'group-enable'  => isset( $parent_settings['group-enable'] ) ? $parent_settings['group-enable'] : 0,
              'can-create'  => isset( $parent_settings['can-create'] ) ? $parent_settings['can-create'] : 'admin',
            );
        }
    
      return $settings;
    
    }

    But as to a general case, I’ve not found the answer. Most plugins want to have their settings set on group creation, too, so you’ll need to handle that task as well.

    Profile photo of David Cavins
    David Cavins
    Participant

    @dcavins

    The easiest way I’ve found to hide the “last active 3 hours ago” info box is to comment out those bits in the templates in your theme. For instance, in members > members-loop.php, about line 57, you’ll see
    <div class="item-meta"><span class="activity"><?php bp_member_last_active(); ?></span></div>

    Comment that whole line out, and the last active message is hidden.

    Re the first question, Members shouldn’t appear in the list until they’ve activated their accounts, I believe. So you may have a bunch of unactivated members pending. The Pending Activations plugin should show you a list of those. I can find a few members that don’t appear in the members directory because they have created no activity at all, so maybe you’re seeing that problem as well.

    Profile photo of David Cavins
    David Cavins
    Participant

    @dcavins

    Hi Jon-

    You’ve probably already solved this, but I’m thinking you’re going to need top attach some meta to the groups, then use the very cool new group meta filter for bp_has_groups(). The group loop might look like:

    $args = array( 
    		'meta_query' => array(
    			array(
    				'key' => 'meta_key',
    				'value' => 'value_1',
    				'compare' => 'LIKE',
    			)
    		) 
    	);
    
    	if ( bp_has_groups ( $args ) ) { //...

    Here’s an example of writing a plugin to collect group meta: https://codex.buddypress.org/plugindev/how-to-edit-group-meta-tutorial/

    Good luck!

    Profile photo of David Cavins
    David Cavins
    Participant

    @dcavins

    Looks like the problem is that the WP function you’re using is deprecated. Try

    get_the_author_meta('ID')

    https://codex.wordpress.org/Function_Reference/get_the_author_meta

    Profile photo of David Cavins
    David Cavins
    Participant

    @dcavins

    It’s generally preferred to let the user decide whether he wants to open a link in a new window or the same window. That said, you can use jQuery to force content to open a new window to happen:
    http://stackoverflow.com/questions/4742746/jquery-open-new-window-on-page-load

    Or, you could filter the output for the fields by adding a filter to bp_get_the_profile_field_value (you’ll be adding target="_blank" to the anchor tag). Here’s an example that removes hyperlinks from the output for specific fields:

    function cpfb_unlink_fields( $field_value ) { 
     
    	$options = array ( //These are the ids of the fields you want to target
    					12,
    					14 
    	)
    		
    	if ( in_array( bp_get_the_profile_field_id(), $options ) )
    		$field_value = strip_tags( $field_value );
    
    	return $field_value;
    
    }
    add_filter( 'bp_get_the_profile_field_value', 'cpfb_unlink_fields', 998, 1 );
    Profile photo of David Cavins
    David Cavins
    Participant

    @dcavins

    You can use r-a-y’s code to remove that pane:

    //Removes mentions pane from profile activity (doesn't remove mention functionality)
    function ray_remove_mention_nav() {
    global $bp;
    bp_core_remove_subnav_item( $bp->activity->slug, 'mentions' );
    }
    add_action( 'bp_setup_nav', 'ray_remove_mention_nav', 15 );

    It works on my 1.8+ test setup.

    -David

    Profile photo of David Cavins
    David Cavins
    Participant

    @dcavins

    Great! Thanks for clearing this up.

    Profile photo of David Cavins
    David Cavins
    Participant

    @dcavins

    As a hack I can hide them using css by adding this to my functions.php file:

    function hide_group_admin_tabs($classes) {
      $user_id =  bp_loggedin_user_id();
      $group_id =  bp_get_current_group_id();
      if ( bp_is_groups_component() ) {
        if ( groups_is_user_admin($user_id, $group_id) ) {
          $classes[] = 'group-member-admin-cap';
        } else if ( groups_is_user_mod($user_id, $group_id) ) {
          $classes[] = 'group-member-mod-cap';
        }
      }
      return $classes;
    }
    add_filter( 'body_class', 'hide_group_admin_tabs', 98 );

    And then adding display:none; rules to the tabs. But I would like to handle the navigation the right way (and not with a css hack). Any ideas?

    Thanks for your help,

    -David

Viewing 25 replies - 1 through 25 (of 84 total)
Skip to toolbar