[Resolved] Code is not working correctly when inserted into a hook element

Home Forums Support Code is not working correctly when inserted into a hook element

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1325651
    Carsten

    Hi there, I have added this code to an element, which is intended to show profiles own gallery. It does show a gallery, but it’s the total records outputted to all profiles.

    The developer of the Flexi gallery plugin, gives this explanation, to why it is not working:

    It will only work on buddypress profile page.
    I have not idea about elements where you are inserting.

    <?php
     $user_info = bp_get_displayed_user_username();
      echo do_shortcode('[flexi-gallery user="' . $user_info . '" ] ');
    ?>

    I use a BuddyPress custom hook bp_after_profile_content so it is on the profile page.

    Any idea, why this code should not work, when inserted into a hook element?

    #1325708
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Not sure why it wouldn’t work in an Element, but you can try a manual hook:

    add_action( 'bp_after_profile_content', function() {
        $user_info = bp_get_displayed_user_username();
        echo do_shortcode('[flexi-gallery user="' . $user_info . '" ] ');
    } );

    If that doesn’t work, you can show it to the developer, as they should know about regular actions/hooks.

    #1326055
    Carsten

    Hi there, thanks for your reply, I have tested the manual action hook with same result, so it definitely rules out any issues with the element.

    Thanks again for helping out.

    #1326535
    Tom
    Lead Developer
    Lead Developer
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.