BuddyDev

Search

[Resolved] Max number of photos per one post

Tagged: 

  • Participant
    Level: Initiated
    Posts: 14
    bayshanac on #227

    Hello,

    I’m trying to limit users to upload max 4 photos per one post. In settings the are no such option. Can I do this with some hook or something?

    Thank you!

  • Keymaster
    (BuddyDev Team)
    Posts: 24149
    Brajesh Singh on #228

    I am sorry but by post, did you mean activity posting?

  • Participant
    Level: Initiated
    Posts: 14
    bayshanac on #245

    Yes, I mean limit on single activity post.

  • Keymaster
    (BuddyDev Team)
    Posts: 24149
    Brajesh Singh on #248

    I will look into this today. There are some other changes pending for MediaPress, Will be working on that first. Will get back to you tonight/tomorrow.

  • Participant
    Level: Initiated
    Posts: 14
    bayshanac on #263

    Thank you Brajesh.

    I need to implement this feature until 1st September. Can you give me some guidelines and I’ll try to find the solution.

  • Keymaster
    (BuddyDev Team)
    Posts: 24149
    Brajesh Singh on #264

    Hi,
    I have looked into it. It is a little bit complex than expected. We need to keep a count in the Activity Uploader instance and check when files are Added ( ‘FilesAdded’ event of plupload) to see if we have already adedd n number of files. We may not check the size of queue as the upload starts as soon as a file is selected.

    I will need to modify this inside the core to avoid any future issue.

    Since you need it by 1st september, I have got 2 days left, I will do my best to have it. I was trying to implement Accept Terms feature for upload and was facing almost identical issue, so please allow me to target in the core itself.

  • Participant
    Level: Initiated
    Posts: 14
    bayshanac on #266

    Thank you Brajesh.

    I am also trying to temporarily resolve this issue with hardcoding your core feature but I haven’t success until now.
    I’ll be very grateful if you can help me with this.

    Regards,
    Aleksandar

  • Keymaster
    (BuddyDev Team)
    Posts: 24149
    Brajesh Singh on #304

    Hi Again,
    I have pushed a change in may last commit that will allow you to restrict the number of uploads.

    Please this
    https://github.com/buddydev/mediapress/commit/93f6f36842ab32ae160943db286410604d181295

    And here is an implementation of it(code is commented)

    https://github.com/buddydev/mediapress/blob/master/assets/js/mpp.js#L127

    You can check the size of the queue using

    
    up.files.length
    

    hope that gives you enough to work with it.

  • Participant
    Level: Initiated
    Posts: 14
    bayshanac on #307

    Hello Brajesh

    That is it, works perfect.

    There is just one small issue. I restricted upload to 3 photos. When I try to restrict upload to 4 photos, I fire a message with limit of photos and after that I try to upload 3 photos but queue length is 7 (4+3) instead of 3 and upload doesn’t start. I temporarily “bypassed” this issue with page reload the page and with that I reset the queue. 🙂

  • Keymaster
    (BuddyDev Team)
    Posts: 24149
    Brajesh Singh on #308

    Hi,
    Thank you for the reply and confirming.

    Another way to deal with it is to reset the queue using plupload API.
    The ‘up’ object is an instance of plupload Uploader, so we can use all its methods there.

    Here is the link to their API.

    http://www.plupload.com/docs/Uploader

    Hope that helps.

    PS: I will be away for around 10 hours and my apologies in advance for any delay in reply.

The topic ‘ [Resolved] Max number of photos per one post’ is closed to new replies.

This topic is: resolved