Skip to:

displaying events by a user in their profile page

  • lfeddern



    I want to display the events that a buddypress user has submitted on their profile page under their profile fields.

    I tried to make a custom shortcode based on some stuff found in the forums but it displayed all events, here is the code for that

    function custom_shortcode(){
                 $user_id = get_the_author_meta( 'ID' ); //returns id of user profile
                 return do_shortcode( '[eo_events author='.$user_id.']' ); }
    add_shortcode( 'eo_custom_shortcode', 'custom_shortcode' );

    I then displayed the shortcode in profile-loop.php like this:

    /** This action is documented in bp-templates/bp-legacy/buddypress/members/single/profile/profile-wp.php */
    do_action( 'bp_after_profile_loop_content' ); ?>
    <h5 class="event_profile_title_random"> Upcoming Events & Deadlines... </h5>
    <div id="event_profileinfo_random">  [eo_custom_shortcode] </div>

    This works when I specify a fixed know user id but is not working dynamically. I guess get_the_author_meta() is being used wrong. Do I need to use it inside profile-loop.php instead? I have tried this with no luck. COuld someone help me out? I am a php begineer trying to learn! thanks so much for your help!

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘displaying events by a user in their profile page’ is closed to new replies.
Skip to toolbar