Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 25 replies - 1 through 25 (of 505 total)
  • Profile photo of Brajesh Singh
    Brajesh Singh
    Participant

    @sbrajesh

    Do you want to remove the “Alphabetical” in the Order By dropdown?

    If you are using a BuddyPress specific theme, please look into yourtheme/buddypress/members/index.php and you will see the code there for this option. Just remove that.

    if you are not using a BuddyPress specific theme or your theme does not have this file, you can copy index.php file from plugins/buddypress/bp-templates/bp-legacy/buddypress/members directory and put it in yourtheme/buddypress/members directory.

    then you can modify the file to remove the dropdown option.

    Hope that helps.

    Regards
    Brajesh

    Profile photo of Brajesh Singh
    Brajesh Singh
    Participant

    @sbrajesh

    You can do it like this

    
    bp_has_members( array ( 'search_terms'=> get_search_query() ) );
    
    

    get_search_query() is the function you are looking for.

    Hope that helps.

    Profile photo of Brajesh Singh
    Brajesh Singh
    Participant

    @sbrajesh

    Hi,
    most probably site tracking option is disabled. Please visit settings->BuddyPress and on the component page, please make sure that site tracking is enabled.

    Once it is enabled, the new post/comments will be recorded in the activity.

    Hope that helps.

    Profile photo of Brajesh Singh
    Brajesh Singh
    Participant

    @sbrajesh

    Congratulations!

    It’s good to see the newsletter back. Had my copy today. Was pleasantly surprised then 🙂

    Thank you and I am looking forward to more of it.

    All the best

    Profile photo of Brajesh Singh
    Brajesh Singh
    Participant

    @sbrajesh

    You may use

    
    bp_activity_post_update( array(
    'content'=> 'Something we wanted to say',
    'user_id'=> 32,//example, please change it
    ) );
    
    

    Please take a look at this

    https://github.com/buddypress/BuddyPress/blob/master/src/bp-activity/bp-activity-functions.php#L1938

    Hope that helps.

    Profile photo of Brajesh Singh
    Brajesh Singh
    Participant

    @sbrajesh

    You are welcome!

    I am not sure what do you mean by disabling the redirect. What purpose will it serve to show the registration page to the already logged in user? At the moment, if you want to show registration form to the logged in user, It can be done with some custom code, but it is not advisable.

    Regards
    Brajesh

    Profile photo of Brajesh Singh
    Brajesh Singh
    Participant

    @sbrajesh

    Hi, you can put the following code in your bp-custom.php

    
    /**
     * BuddyPress Logged In User redirection on Registration page
     *
     */
    function buddydev_loggedin_register_redirect( $redirect ) {
    
    	//you can do a lot here
    	//if you want to redirect based on profile field, member types or roles, you can do so
    	//$user_id = bp_loggedin_user_id();
    
    	//send to profile
    	//$redirect = bp_loggedin_user_domain();
    
    	// or you can simply hard code it
    	//$redirect = "http://yoursite.com/example-page"
    
    	return $redirect;
    }
    add_filter( 'bp_loggedin_register_page_redirect_to', 'buddydev_loggedin_register_redirect' );
    
    

    Now uncomment on of the //$redirect block or you can put your own link.

    Hope that helps.

    Profile photo of Brajesh Singh
    Brajesh Singh
    Participant

    @sbrajesh

    HI,
    Please visit Dashboard->Appearance->Menus and from the SCreen Options(Top right link), you can enable “BuddyPress”.

    Once you have checked it, A section named “BuddyPress” will appear under Pages. You can select the link/customize it for various profile links there.

    Hope that helps.

    Profile photo of Brajesh Singh
    Brajesh Singh
    Participant

    @sbrajesh

    Hi David,
    Most probably you are trying to access the member type directly in the functions.php. That is too early for it. A member type is only available on/after bp_init action. It is actually registered on bp_init priority 2.

    My suggestion will be to wrap the code that accesses the member type in a function and call it on bp_init or bp_template_redirect.

    Hope that helps.

    Profile photo of Brajesh Singh
    Brajesh Singh
    Participant

    @sbrajesh

    Hi,
    Looking at the screenshot, it seems you are logged in. Please logout and try viewing register page again. It will take you to register instead of redirecting to the home page.

    Hope that helps.

    Profile photo of Brajesh Singh
    Brajesh Singh
    Participant

    @sbrajesh

    Please put this code in your bp-custom.php

    
    function buddydev_hide_members_directory_from_all_except_admin() {
    
    	if ( bp_is_members_directory() && ! is_super_admin() ) {
    		//should we add a message too?
    		//bp_core_add_message( 'Private page.', 'error' );
    		bp_core_redirect( site_url('/') );
    	}
    }
    add_action( 'bp_template_redirect', 'buddydev_hide_members_directory_from_all_except_admin' );
    

    That should do it. Hoe it helps.

    Profile photo of Brajesh Singh
    Brajesh Singh
    Participant

    @sbrajesh

    You are welcome.

    Profile photo of Brajesh Singh
    Brajesh Singh
    Participant

    @sbrajesh

    Have you associated the newly created activate page in your BuddyPress settings? You can do it from Dashboard->Settings->BuddyPress->Pages screen.

    If you have already done that then please do post the error message that you are recieving.

    Profile photo of Brajesh Singh
    Brajesh Singh
    Participant

    @sbrajesh

    Hi there,
    You can use a loop to add notification for each user. The function you have mentioned is correct but accepts only one user at a time.
    Hope that points you in the right direction.

    Profile photo of Brajesh Singh
    Brajesh Singh
    Participant

    @sbrajesh

    The problem is BuddyPress does not uses wp_mail.

    The plugin postman-smtp overrides the wp_mail function to send emails, so any emails sent via wp_mail is sent through the smtp settings provided.

    BuddyPress uses custom instance of PHP Mailer to send emails and that’s why these settings are not effective. You can force BuddyPress to use wp_mail by putting the following code in your bp-custom.php

    
    add_filter('bp_email_use_wp_mail', '__return_true');
    

    But in that case BuddyPress will only send text emails (Not the rich html emails you might have seen earlier).

    Hope that helps.

    Profile photo of Brajesh Singh
    Brajesh Singh
    Participant

    @sbrajesh

    Hi Trecks,
    It’s a good question.
    The page that you see being loaded is actually register.php template file.

    Are you using a child theme? If yes, then look for buddypress/members/register.php in the child/parent theme and copy it to your child theme in buddypress/members/register.php and modify the text as required.

    If your theme does not come with it, you can copy the register.php from wp-content/plugins/buddypress/bp-templates/bp-legacy/members/register.php to yourtheme/buddypress/members/register.php and modify it.

    All we are doing here is overriding the registration template.

    Hope that helps.

    Regards
    Brajesh

    Profile photo of Brajesh Singh
    Brajesh Singh
    Participant

    @sbrajesh

    Hi Dan,
    Thank you for pointing @humiges in the right direction.

    It was a theme issue for him as communicated on mail. The plugin works fine with current version of BuddyPress 2.6.2/WordPress 4.6

    Profile photo of Brajesh Singh
    Brajesh Singh
    Participant

    @sbrajesh

    Do you have bbPress plugin installed. If not, please install “bbPress” plugin and on its settings page, enable forums for BuddyPress. That will do it.

    Profile photo of Brajesh Singh
    Brajesh Singh
    Participant

    @sbrajesh

    The above code at the moment is not doing anything.
    I will start by explaining.

    The action “bp_after_message_thread_content” is called on single thread page where all messages of a thread(conversation between two people) are listed. It happens at the bottom of that page.

    In your function, you are populating the variable $thread with current thread and all its messages

    The code

    
    
    end($thread->messages)
    

    Forwards the array pointer to the last message and on that object you are accessing the “id”. So it returns the id of the last message. You should store that in some variable and do some further processing to make it more meaningful.

    Hope that helps.

    Profile photo of Brajesh Singh
    Brajesh Singh
    Participant

    @sbrajesh

    Is your BuddyPress Network active? Deactivate and activate it only on the subsite. That should fix it.

    Profile photo of Brajesh Singh
    Brajesh Singh
    Participant

    @sbrajesh

    Also, I will suggest using the above plugin in combination with BuddyBlog for a better experience.

    BuddyBlog

    Profile photo of Brajesh Singh
    Brajesh Singh
    Participant

    @sbrajesh

    This may be considered as bug in current behavior. Currently, BuddyPress only looks for published pages when looking for component associated pages in bp_core_get_directory_pages().

    You may want to report it on the BuddyPress trac and the core developers and weigh their opinions on this.

    Profile photo of Brajesh Singh
    Brajesh Singh
    Participant

    @sbrajesh

    Hi George,
    No, There is no API function to fetch field group id from field group name and you will need to write your own sql query for the purpose.

    Also, In your example you have passed the profile_group_id to the bp_get_profile_field_data. Please note, it does not take that as a valid argument. It only accepts user_id and field. group id is not required for fetching field data.

    Now, If we forget about the group name API and come to the original requirement, Do you plan to fetch the data for multiple users(In loop) or just once/twice.

    For fetching data, these two functions work

    You can either use

    
    $data = xprofile_get_field_data( $field, $user_id = 0, $multi_format = 'array' )
    
    

    where $field is field id or name( If you know the id, It will fetch from any group, Name has the issue)

    or as you specified

    
    $data = bp_get_profile_field_data( array(
    	'user_id'	=> $user_id,
    	'field_id'	=> $field
    	
    ) );
    
    

    The xprofile data APIs do not allow passing group in general. You either pass a field id or name.

    The problem will happen when multiple fields have same name. In that case, the first field with the name matches if you use the above functions.

    Another point, In both the cases, There is no group arguement and if you use field name, that will need one extra query(field id should be preferred if the id is known).

    Honestly speaking, It is ok to use it one or 2 time on page but avoid using it inside the loop. If you plan to use it inside the loop, you should try to first fetch the xprofile data and cache and then use any of these functions. One way to cache will be by calling

    
    
    BP_XProfile_ProfileData::get_value_byid( $field_id, $user_ids )
    

    Where $field_id is the id of field(not name) and $user_ids is one or more user ids.

    Hope that helps.

    Profile photo of Brajesh Singh
    Brajesh Singh
    Participant

    @sbrajesh

    Hi,
    You need to override this js function

    
     bp_legacy_theme_hide_comments(
    

    There are many ways to do it. You can either put the following code in your theme’s js file

    
    function bp_legacy_theme_hide_comments() {
    	var comments_divs = jq('div.activity-comments'),
    		parent_li, comment_lis, comment_count;
    	
    		var max_show = 2;
    	
    	if ( !comments_divs.length ) {
    		return false;
    	}
    
    	comments_divs.each( function() {
    		if ( jq(this).children('ul').children('li').length < max_show ) {
    			return;
    		}
    
    		comments_div = jq(this);
    		parent_li = comments_div.parents('#activity-stream > li');
    		comment_lis = jq(this).children('ul').children('li');
    		comment_count = ' ';
    
    		if ( jq('#' + parent_li.attr('id') + ' a.acomment-reply span').length ) {
    			comment_count = jq('#' + parent_li.attr('id') + ' a.acomment-reply span').html();
    		}
    
    		comment_lis.each( function(i) {
    			/* Show the latest 5 root comments */
    			if ( i < comment_lis.length - max_show ) {
    				jq(this).addClass('hidden');
    				jq(this).toggle();
    
    				if ( !i ) {
    					jq(this).before( '<li class="show-all"><a href="#' + parent_li.attr('id') + '/show-all/" title="' + BP_DTheme.show_all_comments + '">' + BP_DTheme.show_x_comments.replace( '%d', comment_count ) + '</a></li>' );
    				}
    			}
    		});
    
    	});
    }
    
    

    or you can put the following php code in your bp-custom.php/functions.php

    
    
    function buddydev_override_legacy_theme_hide_comments_js() {
    	?>
    <script type="text/javascript">
    function bp_legacy_theme_hide_comments() {
    	var comments_divs = jq('div.activity-comments'),
    		parent_li, comment_lis, comment_count;
    	
    		var max_show = 2;
    	
    	if ( !comments_divs.length ) {
    		return false;
    	}
    
    	comments_divs.each( function() {
    		if ( jq(this).children('ul').children('li').length < max_show ) {
    			return;
    		}
    
    		comments_div = jq(this);
    		parent_li = comments_div.parents('#activity-stream > li');
    		comment_lis = jq(this).children('ul').children('li');
    		comment_count = ' ';
    
    		if ( jq('#' + parent_li.attr('id') + ' a.acomment-reply span').length ) {
    			comment_count = jq('#' + parent_li.attr('id') + ' a.acomment-reply span').html();
    		}
    
    		comment_lis.each( function(i) {
    			/* Show the latest 5 root comments */
    			if ( i < comment_lis.length - max_show ) {
    				jq(this).addClass('hidden');
    				jq(this).toggle();
    
    				if ( !i ) {
    					jq(this).before( '<li class="show-all"><a href="#' + parent_li.attr('id') + '/show-all/" title="' + BP_DTheme.show_all_comments + '">' + BP_DTheme.show_x_comments.replace( '%d', comment_count ) + '</a></li>' );
    				}
    			}
    		});
    
    	});
    }
    
    </script>
    
    <?php
    	
    }
    add_action( 'bp_after_activity_loop', 'buddydev_override_legacy_theme_hide_comments_js' );
    
    

    Both will work. you can change the max_show to any value. Hope that helps.

    Profile photo of Brajesh Singh
    Brajesh Singh
    Participant

    @sbrajesh

    Hi,
    Since I got this same question in my email today. Assuming that it was you or a coincidence, I will post the code here as well for everyone else.

    1. BuddyPress Needs the field_1, so you can not delete it. That gives us a solution, we can hide it using css/js and set it’s value to the value of username.

    There are two possible approaches.
    The first step is use following in css

    
    div.field_1{
    display:none;
    }
    
    

    That will hide the input box on the form.

    Now, we can update it using the js or PHP. I will post the simple solution using js

    You can put the following code in your bp-custom.php or functions.php

    
    function buddydev_disable_firstname() {
    	?>
    <script type="text/javascript">
    	jQuery(document).ready(function(){
    
    	var jq=jQuery;
    
    	jq("#signup_username").on("blur",function(){
    
    	jq("#field_1").val(jq("#signup_username").val());
    
    	});
    
    	});
    </script>
    <?php
    }
    add_action( 'bp_after_register_page', 'buddydev_disable_firstname');
    
    

    That should do it.

    There is another pure php solution by settings $_POST[‘field_1’] to the other value but I will leave that for others to figure out 🙂

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