Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 25 replies - 1 through 25 (of 1,608 total)
  • Profile photo of shanebp
    shanebp
    Moderator

    @shanebp

    Profile photo of shanebp
    shanebp
    Moderator

    @shanebp

    Use this function xprofile_insert_field

    Profile photo of shanebp
    shanebp
    Moderator

    @shanebp

    Don’t use bp_has_members.

    $members = my_custom_ids( 'country', 'Spain' );

    Don’t implode the array in my_custom_ids, just return the array.

    $query = new WP_Query( array( 'author__in' => $members ) );

    Profile photo of shanebp
    shanebp
    Moderator

    @shanebp

    You can have a login widget on your home page.
    But register needs a separate page – afaik.

    To repair, create a blank page – just add the title ‘Register’.
    And then assign the page.

    Profile photo of shanebp
    shanebp
    Moderator

    @shanebp

    Please use the code button.

    Store your meta in the bp_activity_meta table when an activity entry is created.
    Then you can use an Activity Meta Query to filter activities.
    https://codex.buddypress.org/plugindev/add-custom-filters-to-loops-and-enjoy-them-within-your-plugin/

    Profile photo of shanebp
    shanebp
    Moderator

    @shanebp

    There is a filter hook for displaying profile fields – so you don’t need to hack core files.

    apply_filters( 'bp_get_the_profile_field_value', $field->data->value, $field->type, $field->id );

    Use str_replace to insert your target blank string.

    function swiss_target_blank( $field_value, $field_type, $field_id ){
    	
    	if( $field_id == 123 ) { // get the field_id from edit field url in wp-admin
    
    		$field_value = str_replace('rel="nofollow"', 'rel="nofollow" target="_blank"', $field_value);
    	}
    
    	return $field_value;
    }
    add_filter('bp_get_the_profile_field_value', 'swiss_target_blank', 11, 3);
    Profile photo of shanebp
    shanebp
    Moderator

    @shanebp

    Did you read the link re author__in?
    It uses ids, not country.

    As we’ve said, it’s a two-step process.

    Look at function my_custom_ids on this codex page for an example of gathering ids from xprofile.

    Then pass the ids to author__in.

    Profile photo of shanebp
    shanebp
    Moderator

    @shanebp

    Please use the code button when posting code.

    You’re querying against user_meta.
    But the data is an xprofile field.

    You need to collect the user ids of all members who have a certain xprofile value re the country field.
    Then use the author__in parameter in WP_Query
    https://codex.wordpress.org/Class_Reference/WP_Query#Author_Parameters

    Profile photo of shanebp
    shanebp
    Moderator

    @shanebp

    You shouldn’t need to disable the activity stream commenting – but try it.

    There are several plugins re bbPress spam, such as:
    https://wordpress.org/plugins/stop-spammer-registrations-plugin/

    Profile photo of shanebp
    shanebp
    Moderator

    @shanebp

    Not sure what you mean by ‘comments’.
    Did you check your comment settings?
    …/wp-admin/options-discussion.php

    Profile photo of shanebp
    shanebp
    Moderator

    @shanebp

    Did you enable anonymous posting?
    Look at: …/wp-admin/options-general.php?page=bbpress > Anonymous posting

    btw – this is the BuddyPress support site.
    The bbPress support site is here.

    Profile photo of shanebp
    shanebp
    Moderator

    @shanebp

    Profile photo of shanebp
    shanebp
    Moderator

    @shanebp

    You have some custom code or another plugin that is adding that behaviour.
    It is not default BP behaviour.

    Profile photo of shanebp
    shanebp
    Moderator

    @shanebp

    BP doesn’t track who is logged-in.
    It does track last_activity which is based on actually doing something on the site – not just being logged-in and having the site open in a browser.

    So the best you can do is to show a number based on the number of members with last_activity within the last x minutes.

    Try:

    function boris_online_number( ) {
    	global $wpdb;
    	
    	$time = date('Y-m-d H:i:s', time() - ( 15 * 60) );  // minutes * seconds
    	
    	$a_number = $wpdb->get_var( "SELECT COUNT(user_id) FROM {$wpdb->prefix}bp_activity WHERE component = 'members' AND date_recorded > '$time' ");
    	
    	echo 'Online: ' . $a_number;
    }
    add_action( 'bp_ready', 'boris_online_number' );
    Profile photo of shanebp
    shanebp
    Moderator

    @shanebp

    It’s a security issue, it sanitizes input.
    More info: http://ottopress.com/2010/wp-quickie-kses/
    Also shows how to allow tags.

    When I removed that filter, nothing was stripped anymore and it worked fine.

    Are you removing it based on how it was added?
    See all the add_filter calls in bp-messages\bp-messages-filters.php
    Use remove_filter to disable specific items.

    Profile photo of shanebp
    shanebp
    Moderator

    @shanebp

    This is an issue for bbPress support.

    Or you could try changing the display function in class BBP_Forums_Group_Extension from:
    public function display() {
    to
    public function display($group_id = NULL) {

    Profile photo of shanebp
    shanebp
    Moderator

    @shanebp

    I believe that it uses the built-in wordpress “post” function.

    Why would you think that? Even a quick look at the code would show that’s not the case.

    Use this hook:
    apply_filters( 'bp_activity_post_update_content', $_POST['whats-new'] );

    Try:

    function allow_empty_whatsnew( $content ) {
    	if ( empty( $content ) )
    		$content = ' '; // cannot be empty
    		
    	return $content;
    }
    add_filter('bp_activity_post_update_content', 'allow_empty_whatsnew');
    
    Profile photo of shanebp
    shanebp
    Moderator

    @shanebp

    >I still can’t seem to figure out where that @username went.

    Look in this file, hopefully in [your-theme]\buddypress\members\single\member-header.php

    Look near the top for bp_displayed_user_mentionname();

    btw – you should not use ‘admin’ as a username.
    https://codex.wordpress.org/Hardening_WordPress#Security_through_obscurity

    http://www.wpbeginner.com/wp-tutorials/how-to-change-your-wordpress-username/

    Profile photo of shanebp
    shanebp
    Moderator

    @shanebp

    This is possible but requires custom code.
    Writing and implementing that code will probably require you to hire a developer.
    You can post a job here.

    Profile photo of shanebp
    shanebp
    Moderator

    @shanebp

    Profile photo of shanebp
    shanebp
    Moderator

    @shanebp

    Try this in your theme/functions.php

    function laurie_excerpt_length( $length ) {
    
      $length = 125; // adjust the length to desired number of characters 
    
      return $length;
    }
    add_filter( 'bp_excerpt_length', 'laurie_excerpt_length', 11, 1 );
    Profile photo of shanebp
    shanebp
    Moderator

    @shanebp

    If the role is set to vendor and xprofile fields are not involved, then there is a WP hook for that.

    Assuming the group_id is 8, try:

    function jeffery_join_vendor_group( $user_id, $role, $old_roles ) {
    	if( $role == 'vendor' ) {
    		groups_accept_invite( $user_id, 8 );
    	}
    }
    add_action( 'set_user_role', 'jeffery_join_vendor_group', 11, 3 );
    Profile photo of shanebp
    shanebp
    Moderator

    @shanebp

    This should provide the general idea:

    function add_category_automatically($post_ID) {
    	global $post;
    	$author_id = $post->post_author;
    
            $dog = xprofile_get_field_data('Dog', $author_id, $multi_format = 'comma');
    
    	if( $dog == 'poodle' ) {
    		$cat = 9547;
    		wp_set_object_terms($post_ID, $cat, 'category', true);
    	}
    
    }
    add_action('publish_post', 'add_category_automatically');
    Profile photo of shanebp
    shanebp
    Moderator

    @shanebp

    That’s a tricky one. And I don’t have a solution.

    It’s probably a timing issue. The hook fires before the dir is updated.
    Or maybe bp_core_fetch_avatar is cached.

    Which version of BP are you using?
    The issue may be related to the new approach to avatar uploads using the BP_Attachments class.

    Profile photo of shanebp
    shanebp
    Moderator

    @shanebp

    To prevent new entries, try adding this to your theme functions.php
    remove_action( 'bp_register_activity_actions', 'friends_register_activity_actions' );

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