BuddyDev

Search

Requiring only Username at sign up.

  • Participant
    Level: Enlightened
    Posts: 69
    Christopher Niedzwiecki on #2321

    I think having 2 different names is extremely confusing, especially to new comers. I would like to only require the username in registration, and have the “visible” name exactly what the username is. Is this possible?

  • Participant
    Level: Enlightened
    Posts: 69
    Christopher Niedzwiecki on #2322

    I have found the solution to this (I think). Put this code into the header. Need to test to see if its changeable after you log in and see if @mentions is broken with it, but hopefully not.

    <script>
    var url = document.location.href;
    jQuery(document).ready(function() {
    //copy profile name to account name during registration
    if (url.indexOf(“register/”) >= 0) {
    jQuery(‘label[for=field_1],#field_1’).css(‘display’,’none’);
    jQuery(‘#signup_username’).blur(function(){
    jQuery(“#field_1”).val(jQuery(“#signup_username”).val());
    });
    }
    });
    </script>

  • Participant
    Level: Enlightened
    Posts: 69
    Christopher Niedzwiecki on #2323

    Works good, just will have a loophole if you use Buddydev’s username changer. A hack to make it possible to still change usernames would be awesome 😀 if not I still love you. Hope this helps someone

  • Participant
    Level: Enlightened
    Posts: 69
    Christopher Niedzwiecki on #2324

    By the way…the css code to get rid of the “visible username” options so that they can’t change it.

    #profile-details-section {
    display: none;
    }

    #profile-edit-form {
    display: none;
    }

  • Keymaster
    (BuddyDev Team)
    Posts: 22176
    Brajesh Singh on #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.

  • Participant
    Level: Enlightened
    Posts: 69
    Christopher Niedzwiecki on #2327

    ah thats awesome. Does it work with your change username plugin, so that if they change their username in settings, it will rechange the visible name? Also, does that go in the header or functions?

  • Keymaster
    (BuddyDev Team)
    Posts: 22176
    Brajesh Singh on #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.

  • Participant
    Level: Enlightened
    Posts: 69
    Christopher Niedzwiecki on #2329

    I think it’s just redundant to have it there 😛 Also, when I get my next school check, I’m going to subscribe to your membership. I greatly appreciate what you’re doing. Thanks a lot!

  • Keymaster
    (BuddyDev Team)
    Posts: 22176
    Brajesh Singh on #2330

    Thank you for the kind words 🙂

    Instead of hiding via css, I suggested the other plugin because that will make sure that a field marked as non editable can not be edited(Will be excluded from the form page).

    PS: It is a pleasure to have you here. You are welcome to ask any question here and no worries about membership. I sincerely appreciate the feeling 🙂

  • Participant
    Level: Enlightened
    Posts: 69
    Christopher Niedzwiecki on #2331

    Oh, good idea. I’ll definitely get it. 😀 thanks!

You must be logged in to reply to this topic.

This topic is: not resolved