Skip to:
Content
Pages
Categories
Search
Top
Bottom

Member Profile URL with User ID instead of Username

Viewing 11 replies - 1 through 11 (of 11 total)
  • Avatar of Virtuali
    Virtuali
    Participant

    @gunju2221

    Check this out, for customizing labels and URLs: http://codex.buddypress.org/extending-buddypress/customizing-labels-messages-and-urls/

    You can get the current logged in user id from here: http://codex.buddypress.org/developer-docs/the-bp-global/

    check out the `$bp->loggedin_user object` section

    I’d be more interested in the displayed_user object, but I’m not sure where to go from there. To globally change the profile slug not just for /members/ but for /members/[username] to /members/[user_id]. Any other suggestions?

    Anyone?

    @scylderon hi, have ??? solved this quest?

    I am looking for a similar solution

    Avatar of phatjay
    phatjay
    Participant

    @phatjay

    Looking for same answer as well

    Avatar of meg@info
    meg@info
    Participant

    @megainfo

    Hi,

    I was made a hack for that and it work partially!!

    The code need more tests, all feeback’s are welcome.

    Add this code to your functions.php

    https://gist.github.com/dzmounir/5503865

    Avatar of meg@info
    meg@info
    Participant

    @megainfo

    The problem is from js code who animate #whats-new-options div, he make a div 40px hight.

    i find fix, i will fix the plugin by ading this code in js file

    
            jQuery('#whats-new').off('focus');
            jQuery('#whats-new').on('focus', function(){
                jQuery("#whats-new-options").css('height','auto');
                jQuery("form#whats-new-form textarea").animate({
                    height:'50px'
                });
                jQuery("#aw-whats-new-submit").prop("disabled", false);
            });
    
    Avatar of phatjay
    phatjay
    Participant

    @phatjay

    Regarding the code on github, yes, that did partially fix it. Now all users can be found via their user id # rather than username.

    /members/id #/

    The only problem I see so far is that the code didnt update the activity feed. If you click a name for a user in the activity feed it is still trying to locate user the old way but the user icons on the newsfeed are correct and try to take you to user profile with their user id #.

    So say for example:

    James Gill wrote a new post, Gluten

    The name James Gill is still trying to render the /members/username/ but not the /members/user id#/

    but the rest of the site except activity feed appears to be working right now. only the icons on the activity feed try to render /members/user id#/

    Avatar of meg@info
    meg@info
    Participant

    @megainfo

    Yes @phatjay,

    I think for the old activities, he dont update because the link of members and all content of activity is storeed in databse,

    you try to post a new activity and see if the link is /members/id #/

    thanks for feedback.

    Avatar of phatjay
    phatjay
    Participant

    @phatjay

    Ah, nice. Yep, the old activities save in the db. Now I am going to go in the db and just drop the old activities

    Avatar of mteshy
    mteshy
    Participant

    @mteshy

    Hi,
    I would like to change the buddypress profile page url ‘/members /user_id’ from ‘/member /usersname’.

    https://gist.github.com/dzmounir/5503865

    I tried to use above code on fanctions.php.
    Profile page url has been changed as ‘/members/user_id’,but it was not displayed.

    ————————————————————————————————–
    Warning: Missing argument 2 for bp_get_userid_with_id() in /wp-content/themes/my-theme/functions.php on line 117

    Warning message appered from the following code.

    function bp_get_userid_with_id($userid, $username){
    //function bp_get_userid_with_id($username){
    //if the username is an userid ?
    if(ctype_digit($username)){
    // check if a user with userid equal to $username exist
    $aux = get_userdata( $username );
    if( get_userdata( $username ) )
    $userid = $username;
    }
    return $userid;
    }
    add_filter(‘bp_core_get_userid’, ‘bp_get_userid_with_id’, 10, 2);

    ————————————————————————————————–
    I am sorry about the insufficient study in the buddypress’s hook,
    please tell me how to change profile page url as ‘/members/user_id’ .

Viewing 11 replies - 1 through 11 (of 11 total)

You must be logged in to reply to this topic.