Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

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

  • ctyldsley
    Participant

    @ctyldsley

    Thanks @bphelp! We’ve already made it so that the page content isn’t displayed if you’re not logged in, and instead it asks you to login. But that’s handy to know for the future! Really appreciate everyone’s help.


    ctyldsley
    Participant

    @ctyldsley

    Thanks for all of your help everyone!! Finally there, although it’s not the most beautiful thing, it works for this case.

    //Shortcode for getting user profile URL
    add_shortcode( 'CUSER-PROFILE', 'cuser_profile_shortocode_handler' );
    function cuser_profile_shortocode_handler( $atts ){
    	$atts = shortcode_atts( array( 
    		'text'		=> 'my profile',
    	), $atts );
    	
    	if( !is_user_logged_in() )
    		return '';
    	
    	$link = home_url( '/hbcmembers/' . bp_core_get_username( get_current_user_id() ) . '/profile/' );
    	return "<a href='". esc_attr( $link ) ."'>" . "<img src ='". $atts['text'] . "'> </a>";
    }

    Using the shortcode but rather than inputting text I just input the URL of the image along with it and it links the image.


    ctyldsley
    Participant

    @ctyldsley

    Thanks for trying to help with this @ckchaudhary! We really need to try solve it within the next 24 hours.

    This doesn’t seem to work in a HTML box but is working when I test it on a blank page. Almost there!

    How would I edit it to make my image file (/wp-content/uploads/2015/01/ManageProfile.png) link to the Profile page for whoever is logged in at the time?


    ctyldsley
    Participant

    @ctyldsley

    Thanks @HenryWright! But how would I get this into a html link? I can add a html block in the theme’s visual composer. Thanks in advance!

Viewing 4 replies - 1 through 4 (of 4 total)
Skip to toolbar