• Resolved pixluser

    (@pixluser)


    Hello,

    I need help to do something too code related for me ??
    It’ would be awesome to have an option to display the publications of the buddypress member profile.

    I found this php code to get the buddypress firstname and lastname of the current memberpress user profile page displayed.

    add_shortcode('bp_nom', 'buddydev_modified_user_profile_name');
    
    function buddydev_modified_user_profile_name( $name ) {
    
        $user_id = bp_displayed_user_id(); // You can Manipulate $name value using this user id
    
        $name = bp_get_displayed_user_fullname();
    
        return $name;
    
    }

    with that code it’s possible to display the info onto buddypress page with :
    [bp_nom]

    If someone can help me to integrate this info inside a zotpress shortcode that we’ll awesome!

    [zotpress author="HERE" style="apa"]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Mark

    (@codeispoetry)

    So you have a linked Zotpress library that includes publications by authors whose name matches the BuddyPress last name?

    This means you want to generate shortcodes in a template, rather than use them manually in a post or page. I can only point you in the general direction here: the key is to use do_shortcode(). See documentation here: https://developer.www.ads-software.com/reference/functions/do_shortcode/

    Thread Starter pixluser

    (@pixluser)

    Hello Mark thanks’

    That’s what I did thanks :
    I used a BP custom menu plugin.
    then I put a custom shortcode : [publications_auteur]

    then I added :

    add_shortcode('publications_auteur', 'affiche_publications_auteur');
    function affiche_publications_auteur( $pubauteurs ) {
    
        $user_id = bp_displayed_user_id(); // You can Manipulate $name value using this user id
    
        $pubauteurs = bp_get_displayed_user_fullname();
    
    	echo do_shortcode( '[zotpress author="'. $pubauteurs . '" style="apa"]' );
    
    }
    Mark

    (@codeispoetry)

    Excellent, and thanks for posting back your solution. Others will be able to build on it. E.g. I can imagine this may also be useful on academic group blogs, or indeed to dynamically generate indexes by author.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Display the publications of an Buddypress member.’ is closed to new replies.