Skip to:
Content
Pages
Categories
Search
Top
Bottom

Creating links to profile pages


  • stargirl2
    Participant

    @stargirl2

    Hi there, I’m a newbie to BP and so far most things have been fairly self-explanatory but I’m running into a bit of an issue creating a link from my homepage that will go to the member’s logged in profile page. I know this has been discussed before but either I’m missing something or the solutions offered aren’t really solving my problem. My issue is that I am trying to modify the Sidebar Login widget for wordpress (http://wordpress.org/extend/plugins/sidebar-login/) to work with my bp profile and I can’t figure out how to get the profile link to take users to the bp profile rather than the backend admin page. In the tools section for the widget, there is a field in which I enter the links, and I’ve been testing:

    < a href=”http://www.techettes.com/&lt;?php echo the_author_login(); ?>/”>Profile< /a>

    < a href=”<?php echo bp_core_get_userurl($bp[‘loggedin_userid’]) ?>activity/my-friends”>Your Friends Activity< /a>

    but am taken to the URL:

    http://www.example.com/?php%20echo%20the_author_login;%20?/

    and

    http://example.com/&lt;?php%20echo%20bp_core_get_userurl($bp[‘loggedin_userid’])%20?>activity/my-friends

    I would be very grateful for any help here!

    Alternately, if someone could suggest a sidebar login widget that works better with BP, that would be appreciated as well!

Viewing 16 replies - 1 through 16 (of 16 total)
  • I am not familiar with this widget, but I imagine it has a text box where you write what you want to appear in your sidebar. The problem is, that sort of input is protected against malicious attacks or accidents; it escapes javascript and php.

    This is the problem. You need to find a diff way of doing this :)


    stargirl2
    Participant

    @stargirl2

    Darn, I was very much hoping that wouldn’t be the answer. Alright, thanks for that, better to know that struggling with it :).

    Cheers!


    Scotm
    Participant

    @scotm

    I’m using that plugin as well and I’ve asked that same question here on the forum with no success. However, whether you’re using that sidebar plugin or not, I’m still having trouble getting a clear answer on how to replace WP code linking to the author in your custom theme to the profile page in Buddypress.

    In other words, how do I change <?php the_author_posts_link(); ?> from my custom home theme to <‘author’s buddypress profile link’> in order to reach that author’s profile page?

    Thx


    Burt Adsit
    Participant

    @burtadsit

    If you have a user id then bp_core_get_userlink() in bp-core.php has lots of options. Check out all the functions in there that are bp_core_get_[something]().


    Scotm
    Participant

    @scotm

    I’m trying to add a link to the Buddypress profile for each author on the author page of my custom home theme. I’m trying:

    <?php echo bp_core_get_userlink( $user->user_id ) ?>

    This simply takes me to the same author page found by the existing:

    <?php the_author_posts_link(); ?>

    What am i missing?


    Burt Adsit
    Participant

    @burtadsit

    I dunno guy. The fn bp_core_get_userlink() really just wraps fancy stuff around this fn: function bp_core_get_userurl( $uid ) in bp-core.php. If you look in there, you can see what that does. Direct to the member profile page.


    skritek
    Participant

    @skritek

    Hi Burt. Sorry for cross post but I’m under the gun. I’m trying bp_core_get_userlink() with submitting the_auhtor_id() as the argument and it returns the integer author id. If I submit the author ID as a simple string as in bp_core_get_userlink(6) I get the right link to the profile. What am I missing?


    PH (porsche)
    Participant

    @porscheheritage

    bp. 1.1.2

    wpmu 2.8.5.2

    I’ve inserted this:

    <?php the_author_posts_link(); ?>

    to my templates.. it seems to work..

    anythoughts on this..?


    cyrus6
    Participant

    @cyrus6

    @Scotm – I’m trying to do the exact same thing – did you ever get this resolved?

    Thanks!

    God damn! I’ve been trying to do this now and I really cant figure out how to get this done. Shame that its been a year since this was posted and yet no solution.


    Mel
    Participant

    @mixheat

    what i did was copy the bp_core_get_userlink function in bp-core.php and copy and paste it again as bp_core_get_userlinkurl replacing all instances of “bp_core_get_userlink” with “bp_core_get_userlinkurl” and set display only url parameter to “true”.

    Works like a charm :)

    late to the party but I think $bp->loggedin_user->domain will do it if you global $bp;
    I saw this @ https://codex.buddypress.org/developer-docs/the-bp-global/ FYI


    Andrea Rennick
    Participant

    @andrea_r

    I didn’t like the the plugin solution since it wasn’t quite what I wanted so I created my own. I wanted to be able to put a link to a user profile where ever I want by displaying the users name. You could hard code this if you know the users name but what if you want it to be dynamic and work for any user? I came up with this simple solution which is easy even if you don’t know php.

    In the functions.php file add the following to the bottom.
    `
    function post_author_profile(){
    /* Return authors profile link*/
    echo( ‘‘); echo get_the_author(); echo(‘‘);
    }

    `

    Then simply include the following php line of code any where in loop-index.php where you’d like the current posts users name displayed as a link linking to their profile. It knows what post it’s referring to based on each one it’s printed in as it goes through the loop. I’m using it in the following code in loop-index.php
    `

    <div id="post-” >

    <a href="” title=”” rel=”bookmark”>


    `

    Live long and prosper.

    -Elliot Robert

    Use BP Redirect to Profile for Buddypress plugin to redirect users to their profile page after login.


    David Jay
    Participant

    @david-jay

    I was able to get this (create a link to the post author’s BP profile) to work using Boones suggestion here http://wordpress.stackexchange.com/questions/43528/how-to-get-a-buddypress-user-profile-link-and-a-certain-user-profile-field-for-t

    To get it to work in the sidebar (running Genesis and the Content Aware Sidebar plugin) I had to use the code below to pull the author id outside the loop. I am strictly an amateur but this may be where folks are having trouble adding a link in sidebars, plugins or widgets?

    http://wordpress.stackexchange.com/questions/39493/getting-user-id-for-the-author-meta-outside-the-loop-in-multisite

    If you are like me, and not a coder, below is the exact code I used:

    <?php
    $temp_post = get_post($post_id);
    $user_id = $temp_post->post_author;
    $author_bp_profile = bp_core_get_user_domain( $user_id );
    ?><a href="<?php echo $author_bp_profile;?>">View the author's profile</a>
Viewing 16 replies - 1 through 16 (of 16 total)
  • The topic ‘Creating links to profile pages’ is closed to new replies.
Skip to toolbar