Black Friday: Grab all our memberships, plugins and themes at the biggest-ever 30% discount. Use coupon BLACKFRIDAY2025 before December 1st

BuddyDev

Search

Replies

  • Keymaster
    (BuddyDev Team)
    Posts: 25231
    Brajesh Singh on in reply to: Requiring only Username at sign up. #2328

    You can put this code in your bp-custom.php or theme’s functions.php

    It will be only injected on register page. Yes, The display name will be set to username.

    It has no relation with change username plugin, so will certainly work with that without any issue. Please give it a try and let me know.

    PS: Instead of hiding on profile edit, why don’t you make the firstname field non editable, A user will not be able to change it after registration. You can use my other plugin Non Editable Profile field for the same.

  • Keymaster
    (BuddyDev Team)
    Posts: 25231
    Brajesh Singh on in reply to: Requiring only Username at sign up. #2326

    Hi Christopher,
    Thank you for asking and posting the code.
    Here is the code that I had posted on our old forum for one of our members and it still works. It does not need you to change css

    
    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');
    
    

    It is almost same as yours, just does not need any css modification.

    Hope that helps.

  • Keymaster
    (BuddyDev Team)
    Posts: 25231
    Brajesh Singh on in reply to: BP Ajax registration – Ajax Login #2318

    Hi Markus,
    My apologies for the delayed reply.

    The plugin does not contain login window. It is easy to implement login but I haven’t done that due to design issues.

    What do you think will be the best way to have it? How do you imagine for your community(I need design ideas here). please do let me know and I will do it.

  • Keymaster
    (BuddyDev Team)
    Posts: 25231

    Hi Rodolfo,
    Which version of BuddyPress & WordPress are you using? Is it a multisite install? Also, the user posting was a normal user or admin?

  • Keymaster
    (BuddyDev Team)
    Posts: 25231
  • Keymaster
    (BuddyDev Team)
    Posts: 25231
    Brajesh Singh on in reply to: [Resolved] BBpress – restrict topic creation #2311

    You are most welcome. Glad, I was able to help 🙂

  • Keymaster
    (BuddyDev Team)
    Posts: 25231
    Brajesh Singh on in reply to: [Resolved] BBpress Thread Prefix Plugin Idea #2310

    Thank you Joshua.
    I looked at it. Looks perfect to me 🙂

  • Keymaster
    (BuddyDev Team)
    Posts: 25231
    Brajesh Singh on in reply to: [Resolved] How to modify wp-admin-bar-my-account? #2307

    Thank Christopher for taking time to reply. Appreciate it 🙂

    PS: I wrote a blog post yesterday to make t available for everyone. Thank you Hans for bringing it 🙂
    https://buddydev.com/buddypress/enhancing-my-account-menu-with-buddypress-in-the-adminbar/

  • Keymaster
    (BuddyDev Team)
    Posts: 25231
    Brajesh Singh on in reply to: [Resolved] BBpress – restrict topic creation #2306

    Hi Joshua,
    I have updated the code.
    There was a logical issue where I used bpp_is_forum() that does not check for current forum just the post type. Have updated the code now.

  • Keymaster
    (BuddyDev Team)
    Posts: 25231
    Brajesh Singh on in reply to: [Resolved] BBpress – restrict topic creation #2300

    Hi Joshua,
    Thank you.
    You can put the following code in your theme’s functions.php and it will work

    
    
    function buddydev_bbp_restrict_topic_creation( $can ) {
    		
    	$forum_id = 222;//change your forum id
    	
    	if ( ! bbp_is_user_keymaster() &&  bbp_is_single_forum() &&  $forum_id ==  bbp_get_forum_id() ) {
    		$can = false;
    		
    	}
    	
    	return $can;
    	
    
    }
    add_filter( 'bbp_current_user_can_publish_topics', 'buddydev_bbp_restrict_topic_creation' );
    
    function buddydev_restrict_from_posting_topic( $forum_id ) {
    	
    	$restricted_forum_id = 222;
    	
    	if ( ! bbp_is_user_keymaster() && $forum_id == $restricted_forum_id ) {
    		//set error on bbpress and it will not allow creating topic
    		//not the best idea but I personaly don't like the way bbpress does not provide any forum info at other places to hook
    		bbp_add_error( 403, __( 'Not allowed' ) );
    		
    	}
    }
    add_action( 'bbp_new_topic_pre_extras', 'buddydev_restrict_from_posting_topic' );//
    
    

    The first filter prevents showing the topic creation form on single forum screen. The second action hook checks at the time of publish and restricts. Most of the time, the first one will suffice but that just hides the form, so I used the other hook to make sure the user is never able to post new topic.

    Please let me know how it goes.

    • This reply was modified 9 years, 10 months ago by Brajesh Singh. Reason: Fixing the bug in code