BuddyDev

Search

On activity stream image click does not open the lightbox

  • Participant
    Level: Enlightened
    Posts: 79
    Leo on #2361

    Hi all,

    On my websitein MediaPress Settings – Themeing the lightbox option is ON and it was working normally, however it doesn’t work anymore.
    Even if I set the lightbox option to OFF, on image click it doesn’t take me to the image page.

    Console show an error:

    Uncaught TypeError: Cannot read property ‘parsed’ of undefined
    o.updateItemHTML @ magnific.min.js?ver=3.1.3:3
    o.open @ magnific.min.js?ver=3.1.3:3
    a.magnificPopup.open @ magnific.min.js?ver=3.1.3:3
    (anonymous function) @ mpp.js?ver=4.4.1:427
    j @ jquery.js?ver=1.11.3:2
    k.fireWith @ jquery.js?ver=1.11.3:2
    x @ jquery.js?ver=1.11.3:5
    b @ jquery.js?ver=1.11.3:5

    I don’t seem to have made any changes to it, neither installed any new plugin.
    Any ideas why it doesn’t work and how to solve it?

    Please let me know if you need any additional information.

    Thanks,
    Leo

  • Keymaster
    (BuddyDev Team)
    Posts: 22218
    Brajesh Singh on #2362

    Hi Leo,
    Most prbably the response from server is not valid json. Is it happening on the same server where we were testing or somewhere else?

  • Participant
    Level: Enlightened
    Posts: 79
    Leo on #2365

    Hi Brajesh,
    yes it is the same website on the same server still, but it was working perfectly before.
    Do you think the problem is the server?

    Thanks,
    Leo

  • Keymaster
    (BuddyDev Team)
    Posts: 22218
    Brajesh Singh on #2366

    Hi Leo,
    Are you using some custom code for MediaPress media status or preventing access. Everything seems fine to me but whenever I try to access the lightbox, the server is sending empty list( most probably permission issue with media visibility).

    Also, I am not able to visit my own media in my personal galleris.

    There can be only 2 reasons.

    1. Either there is some custom code preventing the media from being listable/accessible or
    2. the _mpp_is_mpp_media meta is not being stored.

    I doubt it is the first issue.

    Have you made any changes/upgrades or custom code?

  • Participant
    Level: Enlightened
    Posts: 79
    Leo on #2369

    Hi Brajesh,

    Thank you!

    Yes I did, I have added the below code to restrict WP search for posts only, however it restricted much more.
    I have removed it from my child theme functions.php and it was solved, I will find another way for this, though I do not understand why it would affect the lightbox.

    function SearchFilter($query) {
    if ($query->is_search) {
    $query->set(‘post_type’, ‘post’);
    }
    return $query;
    }
    add_filter(‘pre_get_posts’,’SearchFilter’);

    Thank you,
    Leo

  • Keymaster
    (BuddyDev Team)
    Posts: 22218
    Brajesh Singh on #2370

    Hi Leo,
    Thank you for the details.

    I can understand it now. Since in MediaPress, The MPP_Media_Query and MPP_Gallery_Query extends WP_Query, any action/filter applied on the WP_Query also affects it.

    There is an easy solution though.

    
    
    function SearchFilter($query) {
    	
    	if ( $query->is_main_query() && $query->is_search) {
    		$query->set( 'post_type', 'post' );
    	}
    	
    	return $query;
    }
    add_action( 'pre_get_posts', 'SearchFilter' );
    
    

    Make sure to check for is_main_query() on the query object and it will not affect any other loop.

    More details on MPP_Media_Query and MPP_Gallery_Quey below.

    https://buddydev.com/mediapress/topics/api-reference/core/mpp_media_query/
    https://buddydev.com/mediapress/topics/api-reference/core/mpp_gallery_query/

    Hope that helps

    Thank you
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 79
    Leo on #2371

    Thanks a lot, Brajesh. That works perfect!

    There’s another problem with the lightbox, though.

    The user avatar doesn’t appear on it.
    When I open the lightbox on a user profile activities page, the avatar is ok, but on the main activities page, there’s no avatar.

    I tried to check it myself, there is no img tag in the ‘mpp-lightbox-media-uploader-avatar’ div.
    I found this in lightbox-component.php
    <?php echo bp_core_fetch_avatar ( array( ‘object’=> ‘members’, ‘width’ => bp_core_avatar_thumb_width(), ‘height’=> bp_core_avatar_thumb_height() ) ); ?>

    I thought it may be because of some custom codes? I tried to undo every change I made, but no success.

    Could you please check it out?

    Thank you,
    Leo

You must be logged in to reply to this topic.

This topic is: not resolved