BuddyDev

Search

Mediapres & Powerpoint

  • Participant
    Level: Master
    Posts: 279
    NikB on #37669

    Hi there

    I followed the code here https://buddydev.com/mediapress/media-type/mpp_register_type/ to add a new gallery type called “Presentation” for Powerpoint presentations (which is exactly what I needed) but there doesn’t seem to be any way to actually view the .pptx files which have been uploaded.

    I’m already super impressed with the way Mediapress creates a preview of .docx and .pdf files and maybe expecting this to work for PowerPoint files is just a step too far but since it was given as an example, I’m just hoping that maybe I’ve simply missed something and/or possibly it’s a conflict elsewhere that I need to address.

    Any thoughts would (as always) be very much appreciated.

    With many thanks in advance.
    Nik

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on #37706

    Hello Nik,

    Sorry for the inconvenience. MediaPress uses Google Docs viewer for previewing documents. Please try the following link by putting your ppt URL

    
    https://docs.google.com/viewer?url=http://example.com/wp-content/uploads/2021/04/xyz.pptx
    
    

    And let me know if Google shows the preview for your ppt or not.

    Regards
    Ravi

  • Participant
    Level: Master
    Posts: 279
    NikB on #37709

    Hi Ravi

    Thank you so much for getting back to me.

    Viewing the file in the format you have described works perfectly but not when viewing the gallery. I don’t think I can upload a screenshot here but the gallery appears as follows –

    Edit
    Add Media
    Your Gallery/My Test Presentation Gallery

    Then a line of scribbled text… which isn’t “clickable”.

    I’ve tried disabling all plugins except BuddyBoss and MediaPress and reverting to Twenty Twenty theme.

    I’m really hoping it’s not a BuddyBoss issue (unfortunately my clients’ choice, not mine) and something simpler such as a setting I may have missed?

    With many thanks in advance.

    Nik

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on #37716

    Hello Nik,

    Are you using a custom media loop? If yes, please share the complete code so that I can check.

    Regards
    Ravi

  • Participant
    Level: Master
    Posts: 279
    NikB on #37718

    Hi Ravi

    Many thanks for your reply and I’m not aware of using any custom media loop.

    If it makes any difference, “documents” work fine. It’s only the newly added “presentations” that don’t.

    Warm Regards
    Nik

  • Participant
    Level: Master
    Posts: 279
    NikB on #37734

    PS. I was doing some more investigation into this and notice that there is an error message appearing in the code “Unable to display content. Needs a registered view.”

    I also noticed that in settings under “Members Gallery Default Views”, for the newly added “Presentations” there is no option to select Grid or List view but simply the words “It will be used as the default view. It can be overridden per gallery”…

    I’m just wondering if either of these may give a hint to the issue. Possibly Mediapress has been updated since the code I copied (see link given in original post) was created and it needs tweaking slightly?

    With many thanks again for any thoughts.
    Nik

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #37769

    Hi Nik,
    Thank you for the details.

    When you register a new type, you will need to register a custom view for it(or atleast enable the default view support).

    Can you please share the code you are using to register custom type. Ravi or I can extend that with the new gallery view.

    Regards
    Brajesh

  • Participant
    Level: Master
    Posts: 279
    NikB on #37780

    Hi Brajesh
    Thank you for getting back to me.

    I (possibly rather lazily) simply copied the text from the link above ie.

    function mpp_custom_register_presentation_type() {
            
        //video
        mpp_register_type( array(
                'key'           => 'presentation',
                'label'         => __( 'Presentation', 'mediapress' ),
                'labels'        => array(
                                    'singular_name'    => __( 'Presentation', 'mediapress' ),
                                    'plural_name'    => __( 'Presentations', 'mediapress' )
                ),
                'description'   => __( 'Presentation media type taxonomy', 'mediapress' ),
                'extensions'    => array( 'ppt', 'pps', 'pptx', 'odp' )
        ) );
            
    }
     
    add_action( 'mpp_setup', 'mpp_custom_register_presentation_type', 11 );

    Followed by –

    function mpp_custom_register_presentation_type_support() {
     
        
        mpp_component_add_type_support( 'sitewide', 'presentation');
        mpp_component_add_type_support( 'members', 'presentation');
            
    }
     
    add_action( 'mpp_setup', 'mpp_custom_register_presentation_type', 12 );

    From what you say, it sounds as if I also need to use mpp_register_gallery_view and mpp_register_media view (which seems quite obvious now I think about it)?

    Assuming that’s the case, I guess I may be able to figure things out myself but again, any suggestions much appreciated.

    With many thanks as always
    Nik

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on #37781

    Hello Nikk,

    Look at the. following how we are registering a custom view for a custom gallery type.

    https://github.com/mediapress/mpp-light-gallery/blob/master/mpp-light-gallery.php#L73

    Regards
    Ravi

  • Participant
    Level: Master
    Posts: 279
    NikB on #37783

    Hi Ravi

    Many thanks again although I’m sorry, I think I’m even more confused now. Do I need to use all of that code (which makes reference to additional plugin files, scripts etc)?

    All(?) I want to do is to be able to display presentations (gallery and single media) in a similar way as currently happens for documents.

    Regards
    Nik

    PS. I tried adding –

    function mpp_custom_register_default_gallery_view() {
        
        $view = MPP_Gallery_View_Default::get_instance();
        mpp_register_gallery_view( 'presentation', $view );
            
    }
     
    add_action( 'mpp_setup', 'mpp_custom_register_default_gallery_view', 11 );

    … which seemed to be a step in the right direction but then adding –

    function mpp_custom_register_presentation_default_view() {
    mpp_register_media_view( 'presentation', 'default', new MPP_Media_View_Presentation() );      
    }
     
    add_action( 'mpp_setup', 'mpp_custom_register_presentation_default_view', 11 );

    … caused an error so I’m clearly not quite there yet.

You must be logged in to reply to this topic.

This topic is: not resolved