Skip to:
Content
Pages
Categories
Search
Top
Bottom

print of echo bp_displayed_user_id in a shortcode


  • entoen
    Participant

    @kamerhuren

    I am trying to print or echo bp_displayed_user_id in a shortcode.

    echo bp_displayed_user_id();
    inside the working function (replacing 123)

    echo do_shortcode ( '[job-type author="123"]' );
    The job by author 123 is displayed fine when entered like above. I cant seem to find a way to print or echo the displayed user id.

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

  • shanebp
    Moderator

    @shanebp

    You don’t explain the context of usage – iow. where are you trying to show it.

    bp_displayed_user_id() only works in the context of profile pages.
    So if your shortcode is called in that context, you don’t need to set author parameter.
    So you would call bp_displayed_user_id() in the function, not in the call.

    Or you could try using dot notation, something like:

    echo do_shortcode ( '[job-type author="'. bp_displayed_user_id() .'"]' );


    entoen
    Participant

    @kamerhuren

    Shane, after my three days it took you three minutes tops probably.

    Thank you so much.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar