Lightbox Issue


#1

Hi, I want to report an Issue with the lightbox, I Used buddypress custom excerpt to force a load more on activity stream content that works perfectly, and show correctly the attached media on the post, but the lightbox stops working, I think is a problem with the js

I’d Like to know a solution for this please.

Thanks


#2

@Dark Lord
Kindly cross check the console errors of Javascript, I think there must be some other plugins or theme js conflict with rtMedia.


#3

Hi Nitun,

I’ve rechecked with the buddypress and rtmedia plugins activated (only those two) with the last versions of wordpress and the plugins and it goes to simple media view (with I’d recommed to add some pagination there, would be nice).

I triggered the excerpt changing the code on the in the bp-activity-filters.php file on line 381

$excerpt_length = apply_filters( 'bp_activity_excerpt_length', 5 );    

To show the excerpt with 5 characters of text, to hide the images (for testing) and they load perfectly with the rest of the text but the lightbox stops working there.

Just to let you know this issue, if you need more help finding it I can record a video for you.

Thanks


#4

Yes, got your point.
We need to check why the excerpt + Lightbox not working.
Give us sometime, we will reproduce that issue and fix it.

Thanks.
–Nitun


#5

Add following js code in your theme’s js file.

apply_rtMagnificPopup(’.rtmedia-list-media, .rtmedia-activity-container ul.rtmedia-list, #bp-media-list,.bp-media-sc-list, li.media.album_updated ul,ul.bp-media-list-media, li.activity-item div.activity-content div.activity-inner div.bp_media_content, .rtm-bbp-container’);

Call it after you load the whole content. The problem is I think lightbox is not getting bind if element is not present so you need to bind it again after loading the whole content.


#6

Hi, Ritesh, Excuse my lack of knowledge but I creted a js file with the given code above on my js folder, and I try to call it with

but where does it go (the script call) to make it work? on the bp-activity-filters.php because I just use the core function of buddypress to force the action, I Dont call the exceprt creation on my theme.

Thanks


#7

I actually don’t know how this excerpt works as I haven’t came across to it yet.

Is it load the content via ajax call or the content was hidden and it just show them on click of load more?

If content loads via ajax than you may need to use ajaxprefilter and after successfully content loaded, you need to call the code I gave you above.


#8

Hi, Retish.

Well As far as I know it loads them via AJAX and all what I could find out if that the Characters condition to show the excerpt and the text to be displayed its on bp-activity-filters.php, and the ajax function its on buddypress.js file on the templates folder of buddypress/legacy (Templates Folder) that call the ajax and even you can condition the miliseconds to be displayed, you can open both files and see what I mean, on the buddypress.js file search for “Read More” and you shall see the js function.

But the thing is that I don’t know how to call the code that your provide earlier, because the excerpt it built in the bp-activity-filters.php and the funcion itselft its on the buddypress.js

You see my point??

Sorry for this inconvinience.


#9

As I stated earlier you need to use ajaxprefilter and check for this action get_single_activity_content. Have a look at here -> https://github.com/rtCamp/rtMedia/blob/master/app/assets/js/rtMedia.backbone.js#L806 Here we had used ajaxprefilter and check for which action it is. If it match the condition than call the js code I gave you above.


#10

Thanks Ritesh,

I got it working all thought I don’t know why when you click next on an image on the lightbox it loads the same image twice, I got to click two times to get the next one, you have the same issue?


#11

No I haven’t face such issue. Exactly where and when you are facing this issue?


#12

Hi,

Well I made the call of the code you gave to me on the Buddypress.js File after loading the content, and when I click Read More Button it loads the images, I click on an Image and the lightbox Shows Well, and then when I click Next or Previous Arrow, I get the double display, It Shows the same Image Again, and If I click next or Previous one more time, it shows the following or previous Image.


#13

Does it happening for first click or for all the clicks? I haven’t used BuddyPress excerpt so didn’t face this issue. Can you share the code you had wrote for BuddyPress excerpt?


#14

Sure, Let me break it down for you.

So the thing is that I wanted to create an excerpt to load all media when the user really wanted to see them on the activity stream, so i figure out that buddypress has an embedded excerpt function for all activity stream related content.

Its located in two files:

First file: /buddypress/bp-activity/bp-activity-filters.php

Between lines 373 and 397:

$append_text = apply_filters( ‘bp_activity_excerpt_append_text’, __( ‘[Load Images]’, ‘buddypress’ ) ); //Here You set the name for the excerpt

$excerpt_length = apply_filters( ‘bp_activity_excerpt_length’, 140 ); //Here you set the characters, set it to 10 characters or something like that or less to make it appear with a few words of text, then attach the images with the rtmedia and post the content, it shall appear.

Second file: /Buddypress/bp-templates/bp-legacy/js/buddypress.js

Here is the js function to call in action. Lines 445-467

// Activity "Read More" links  
jq('div.activity').on('click', '.activity-read-more a', function(event) {  
	var target = jq(event.target);  
	var link_id = target.parent().attr('id').split('-');  
	var a_id = link_id[3];  
	var type = link_id[0]; /* activity or acomment */  

	var inner_class = type == 'acomment' ? 'acomment-content' : 'activity-inner';  
	var a_inner = jq('#' + type + '-' + a_id + ' .' + inner_class + ':first' );  
	jq(target).addClass('loading');  

	jq.post( ajaxurl, {  
		action: 'get_single_activity_content',  
		'activity_id': a_id  
	},  
	function(response) {  
		jq(a_inner).slideUp(0).html(response).slideDown(300);  
		apply_rtMagnificPopup('.rtmedia-list-media, .rtmedia-activity-container ul.rtmedia-list, #bp-media-list,.bp-media-sc-list, li.media.album_updated ul,ul.bp-media-list-media, li.activity-item div.activity-content div.activity-inner div.bp_media_content, .rtm-bbp-container');  

	});  

	return false;  
});  

There you have it.


#15

Ok, I faced the issue. We are looking into it and find the cause. It will be fixed in future update.


#16

Hi Ritesh, Sorry for being stubborn with this, but the issue we discussed earlier was not fixed with the 3.7 release,I can Still see the double show of the same image after loading the content with the Load More Function from buddypress…

Thanks for the help anyway… :slight_smile:


#17

Hi Dark Lord,

Please have some patience, as I told in my last reply, this issue will be fixed in future release and not the next release. Don’t worry this issue will be fixed.


#18