Skip to:
Content
Pages
Categories
Search
Top
Bottom

Create html image link to logged in user's profile

  • Avatar of flexclique
    flexclique
    Participant

    @flexclique

    I am trying to create a page to act as a UI dashboard with custom image links to the main parts of Buddypress. I have searched everywhere and can’t figure out how to create a link to the user profile page or any of the dynamic areas for that matter.

    Thanks for any help!

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

    @matt-mcfarland

    Hi there,

    IF you’re familiar with wp_nav_menu() (see wp codex) bp_nav_menu() behaves the same way, and that’s the easiest way, I”ve found, to customize it. I hope this helps

    Avatar of Matt McFarland
    Matt McFarland
    Participant

    @matt-mcfarland

    If you just want to get a link to the current user that is logged in’s profile, and you’re using permalinks, this will work:

    <a href="/members/<?php echo wp_get_current_user()->user_login; ?>/profile/">
    //your html here
    </a>
    Avatar of flexclique
    flexclique
    Participant

    @flexclique

    I’m using permalinks…

    What I’m trying to accomplish is: I have an image, this image will be on a standard wordpress page and I want a logged in user to click on the image and be taken to their profile page.

    Avatar of flexclique
    flexclique
    Participant

    @flexclique

    I put this in the wordpress page on the text tab…

    <a href="/members/<?php echo wp_get_current_user()->user_login; ?>/profile/">
    <img src="http://mydomain.com/images/myprofile.png>
    </a>

    Nothing renders. I saw where you can’t run php from a page… could this be my issue?

    Avatar of Matt McFarland
    Matt McFarland
    Participant

    @matt-mcfarland

    Great! the code I posted above should work then. I havent tested it but that will work if you’re using permalinks. becuase bp will do members/user_login/profile/ by default so you jsut need their user_login which you can ECHO out via the PHP using wordpress alone.

    Avatar of Matt McFarland
    Matt McFarland
    Participant

    @matt-mcfarland

    You’re putting that in the page itself? Yeah you have to use a php file.

    You could use hanacode plugin http://wordpress.org/plugins/hana-code-insert/ to insert php

    Avatar of Matt McFarland
    Matt McFarland
    Participant

    @matt-mcfarland

    Also just take a look at this: http://codex.wordpress.org/Function_Reference/wp_get_current_user;

    $current_user = wp_get_current_user();

    Then you can do:

    $current_user->user_login instead of wp_get_current_user()->user_login just in case. altho I think both would work.

    Avatar of Matt McFarland
    Matt McFarland
    Participant

    @matt-mcfarland

    Or you could just make your own theme and throw in the php ;)

    The following tutorial changed my life forever and I’ll never look back to the days I used much of the dashboard page editor at all:

    http://themeshaper.com/2012/10/22/the-themeshaper-wordpress-theme-tutorial-2nd-edition/

    Avatar of shanebpdev
    shanebp
    Participant

    @shanebp

    <a href="<?php echo bp_loggedin_user_domain; ?>profile/">
    <img src="http://mydomain.com/images/myprofile.png>
    </a>
    Avatar of flexclique
    flexclique
    Participant

    @flexclique

    Well, I’m making progress…

    I installed the plugin and now the code displays on the page… not executed, but just as it was typed. So it’s similar to putting bat ticks around it in this forum. I even checked the box that says allow execution of php in the plugin’s settings.

    Avatar of flexclique
    flexclique
    Participant

    @flexclique

    Thank you! I got it sorted out now… there were actually 2 places in the plugin that you had to check to execute the php.

    I should be in great shape now!

    I appreciate the help!

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

You must be logged in to reply to this topic.