BuddyDev

Search

Replies

  • Participant
    Level: Master
    Posts: 279

    Thank you so much Ravi. That works perfectly.

    Warm regards
    Nik

  • Participant
    Level: Master
    Posts: 279
    NikB on in reply to: [Resolved] rtMedia to Mediapress #14973

    Hi Brajesh

    Yes my code was definitely just a quick and dirty version for my own purposes but I’d be pleased if the general concept was some help.

    And yes… I also found it strange that RTMedia seems to use both wp_posts and its own separate table in the database too, perhaps one is a legacy of the other? I think I’m right in saying that if you wanted to import views/specify privacy etc, that would need to come from the RTMedia table but for my purposes, the information in the wp_posts table was enough.

    If you’d like any further info, please do let me know. It’s the least I can do in return for such great support.

    Regards
    Nik

  • Participant
    Level: Master
    Posts: 279
    NikB on in reply to: BuddyPress Activity Comment Notifier #14958

    Agh… so sorry, the light has dawned! It was a conflict with rtMedia (which I had running while I was doing the conversion). Deactivated rtMedia and it’s all working as expected (apart from the notifications/emails).

    OK so… now I see what is supposed to happen more clearly, it does look a little untidy… is there a way of –

    a) preventing comments on comments in the lightbox?
    b) preventing users (apart from Admin) from deleting their comments in the lightbox?

    And finally, if I can just sneak another question in here…

    Is there a template for the site-wide gallery? I’d really like to tweak the layout a bit (and possibly add filter by user – although that might have to wait for now!)

    With many thanks again… I’m just wishing I found Mediapress sooner (but already so glad I switched).

    Warm regards
    Nik

  • Participant
    Level: Master
    Posts: 279
    NikB on in reply to: BuddyPress Activity Comment Notifier #14957

    Update on this… I’ve been testing commenting on images again and have found the following –

    1. User comments on an update (new image) in the activity stream
    Comment is shown in the activity stream, a BP notication appears and the image owner is sent an email BUT… the link in the email takes them to a page eg. mywebsite/members/nik/mediapress/my-new-one/#activity-345 which shows the image but no comment so have no way of knowing what was actually said.

    2. User comments in the light box or single media page
    Comment is shown in the activity stream but no notification or email is sent out, and more crucially, if anyone clicks on the lightbox again, the comment is no longer visible.

    I can live without the notifications/emails on 2 for a while (I assume that’s what you’re planning to fix) but being unable to see comments at all when viewing the lightbox or the gallery is really not good. As mentioned above, I’ve tried using the TwentySeventeen theme and even deactivating my bp_custom.php but doesn’t seem to make any difference.

    Any/all suggestions gratefully received.

    Warm regards
    Nik

  • Participant
    Level: Master
    Posts: 279
    NikB on in reply to: [Resolved] rtMedia to Mediapress #14956

    Hi Brajesh

    Thanks to your helpful hints… I did it! I’m still fairly new to writing my own PHP, so there is probably a more elegant way of doing this, but in case it’s any help, here’s the code I used…

    function my_update_posts() {
       
        $args = array(
            'post_type' => 'rtmedia_album',
            'numberposts' => -1
        );
        $myposts = get_posts($args);
    	
    	foreach ($myposts as $mypost){
    		
    		if ( ! function_exists( 'mpp_is_user_gallery_component' ) ) { 
    		return;
    	}
    		
    		$gallery_id = mpp_create_gallery( array(
    		'creator_id'	 => $mypost->post_author,
    		'title'			 => $mypost->post_title,
    		'description'	 => '',
    		'status'		 => 'public',
    		'component'		 => 'members',
    		'component_id'	 => $mypost->post_author,
    		'type'			 => 'photo',
    		'date_created' => $mypost->post_date,
    		'date_updated' => $mypost->post_modified
    	) );
    	
    	if ( $gallery_id ) {					
    		mpp_update_wall_gallery_id( array(
    			'component'		=> 'members',
    			'component_id'	=> $mypost->post_author,
    			'media_type'	=> 'photo',
    			'gallery_id'	=> $gallery_id
    		) );
    	}
    	
    	  $args2 = array(
            'post_type' => 'attachment',
            'post_parent' => $mypost->ID,
            'numberposts' => -1
        );
        $myposts2 = get_posts($args2);
    	
    	foreach ($myposts2 as $mypost2){
    	
    	mpp_import_attachment( $mypost2->ID, $gallery_id);
    		
    	}
    	
    	}
        
    }

    Important notes to anyone thinking of trying this…

    Back up your database (and image files) first! You can only run this code once – if it goes wrong, the references to rtMedia_albums will have gone/attachments will have moved, and you’ll need to start afresh.

    I’d hoped that adding date_created and date_updated to the code would mean the galleries/albums would retain the dates when they were originally uploaded but this didn’t seem to work. Possibly there’s a fault in my code somewhere but I’m just happy that it worked as well as it did!

    It’s not fast… I had about 10,000 images and it took about an hour to run… then again, it’s not that slow either 😉

    Hope this might be of some help to someone, especially if you can write neater code.

    Warm regards
    Nik

    PS. Now… if I can just figure out why comments on photos keep disappearing (see my other post), I’ll be a happy girl!

  • Participant
    Level: Master
    Posts: 279
    NikB on in reply to: BuddyPress Activity Comment Notifier #14950

    Hi Brajesh

    Thank you for getting back to me. From what you say, I can certainly live without the Activity Comment Notifier for now.

    > For MediaPress Comments:- Do you mean commenting using lightbox or single media page?

    Both have the same 2 issues ie.

    1. Comments do not appear after they’ve been posted eg. open lightbox (or single media page), comment on photo, close then re-open and no comments appear (although the comments are logged in the activity table and they do appear in the activity stream). Note: this also happens with TwentyTwelve theme so I’m really at a loss and it’s obviously a rather major issue…

    2. Regardless of where the comments are posted, no notifications appear in the menu nor are sent out as emails (and I definitely need both). If I understand correctly, this is the issue you hope to fix soon? (If you have a patch in the meantime, that would be great… otherwise can wait until Thursday if necessary 😉 )

    Thank you again and warm regards
    Nik

  • Participant
    Level: Master
    Posts: 279
    NikB on in reply to: BuddyPress Activity Comment Notifier #14948

    PS. Not sure if this related or a completely different issue, but I’ve noticed that although comments appear in the Activity Stream, they don’t appear in the lightbox or on the media page itself.

    Maybe this is a settings issue but definitely seems very odd…

  • Participant
    Level: Master
    Posts: 279
    NikB on in reply to: [Resolved] rtMedia to Mediapress #14941

    Thank you so much for such a quick reply.

    A few quick comments in return…

    I am not so bothered about activity as users have been told it’s a new site but their existing galleries will be imported, so activity can start afresh once the site goes live.

    rtMedia creates a post in wp_posts for each album/gallery (ie. post type ‘rtmedia_album’) and a post for each image in wp_posts (ie. post type ‘attachment’ with the parent_ID set to the album/gallery post). In that sense, from what I understand it’s fairly similar to Mediapress.

    Somewhat confusingly, rtMedia then goes on to add entries in a separate table (wp_rt_rtm_media) for each album/gallery and for each photo but I think/hope I can actually ignore this and get all the information I need from the wp_posts table.

    I’ve only just had a quick look at the examples you’ve given, but if I’m understanding correctly, I’d somehow need to create a query which generates all the necessary galleries and then somehow loop through the function mpp_create_gallery() for each one, then do the same for the media (in my case, it’s just images) using either mpp_import_file() or mpp_import_attachment() ?

    As far as the metadata goes… from my tests it would appear that these are as follows –

    Galleries –

    _mpp_media_count
    _mpp_cover_id
    _mpp_component_id

    Are all of these essential or can the first 2 be added later? Or perhaps the function you have given will automatically do this?

    Images –

    _wp_attached_file
    _mpp_component_id
    _mpp_is_mpp_media
    _wp_attachment_metadata

    Again will the function you have given add these automatically? I’m guessing WordPress will generate the first and last?

    Hope this makes sense and thank you again. I really do appreciate your help.
    Warm regards
    Nik

    PS. If it makes any difference, all the image files are already stored in the uploads folder under uploads/rtmedia/users/userid/year/month but of course, I can always move them manually if necessary.

  • Participant
    Level: Master
    Posts: 279
    NikB on in reply to: Rtmedia email notification #14845

    Ah thanks Brajesh… sorry I didn’t realise (and you guys have always been so helpful with other things). Perhaps I should be using MediaPress instead 😉

  • Participant
    Level: Master
    Posts: 279
    NikB on in reply to: [Resolved] Read more link in activity feed #14410

    @Ravi… you’re a star! That works like a dream…

    I thought there might be a relatively easy way but Google certainly wasn’t being much help 😉

    Thank you so much for the prompt attention, I really appreciate it.