BuddyDev

Search

[Resolved] mediaPress shortcode returning strange results

  • Participant
    Level: Master
    Posts: 279
    Richard Foley on #20167

    hi Brajesh,

    I’m using a mediaPress shortcode to pull a selection of “public” images onto a page, with pagination. The results vary depending on the user. Given the status=”public” one would expect the same selection, regardless of examining each image permissions. Here is the shorcode I’m using:

    [mpp-list-media type="photo" component="members" status="public" orderby=date per_page=12 pagination=1]

    with various user accounts produces the following page content:

    Administrator – 88 pages

    Standard site member – 101 pages

    Not-logged-in user (guest) 262 pages!

    This is very weird, and it’s been a problem for a while, but I’ve only just gotten around to looking at this. Do you have any ideas what might be causing this…?

    Many thanks

    R.

  • Keymaster
    (BuddyDev Team)
    Posts: 24427
    Brajesh Singh on #20213

    Hi Richard,
    I am sorry but I am not sure of the issue.

    Public galleries should list same for everyone.

    Are you using any custom filter for MediaPress query modification or is there a plugin that filters on pre_get_posts or WordPress post query?

    Regards
    Brajesh

  • Participant
    Level: Master
    Posts: 279
    Richard Foley on #20220

    I don’t think I’m doing anything special, but I’ll have a deeper check through the code and feedback here.

  • Keymaster
    (BuddyDev Team)
    Posts: 24427
    Brajesh Singh on #20225

    Thank you. Please do let me know when you have the time.

    Regards
    Brajesh

  • Participant
    Level: Master
    Posts: 279
    Richard Foley on #20246

    hi Brajesh,

    found it, <slaps head>, I was handling a special case (friends only) but writing to the default case (main MP query). This screwed up what was expected with what was received.

    
    function buddydev_list_friends_media( $args ) {
            if ( empty( $args['include_users'] ) && is_user_logged_in() ) {
                                    $args['include_users'] = bp_get_friend_ids( bp_loggedin_user_id() );
                                           }
                   return $args;
    }
    add_filter( 'mpp_shortcode_list_media_defaults', 'buddydev_list_friends_media' );
    

    I was trying a listing of “media of friends”. This is similar to “media set to friends-only”, but the not quite the same thing as I only want to see the media from MY friends. I’ll have to have another look at this.

    Apologies for wasting your time, closing.

    R.

  • Keymaster
    (BuddyDev Team)
    Posts: 24427
    Brajesh Singh on #20255

    Hi Richard,
    No Problem. I am glad you found it and resolved it.

    Best Regards
    Brajesh

The topic ‘ [Resolved] mediaPress shortcode returning strange results’ is closed to new replies.

This topic is: resolved