• Welcome to PHPVIBE Forums. Please log in.

[ Video Sharing CMS v4 ] Daily upload limit per user /How to limit daily uploads in PHPVibe

Started by ASDF,

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

ASDFTopic starter

Hi Mario...i don't want my users to upload, say (X)number of files per day, or let's just say that i want to limit number of uploads per user per day... :) .
  •  

mihai

I am curious about if is posible to don''t let them share the same file
ex(user:Alice shared the link x so user:Marius can"t share the link x anymore becouse is already shared)
  •  

ASDFTopic starter

Stopping users from sharing the same file....acc to me is impossible, and the rest depends on Mario, if he has some codes
If you are talking about,images, then you should make it mandatory for users to add a watermark, so that you can delete the multiple uploads, the same thing can be applied on videos too, if uploading is enabled for users, i don't think you will be able to stop them from sharing the same file via youtube link....but you can delete them by yourself. Another solution is,ask your user to search first if the file he is uploading,by tags and related search terms, if the file has been already uploaded by someone,then they should upload that again, or else we will delete the file, resulting in total waste of time and money/data. Repeating that might lead to termination of account or something like that.
  •  

ASDFTopic starter

  •  

Marius P.

Kinder garden questions :)
Query a count on the user's videos uploaded today , build your if on the upload page:)

if($uservids->nr > 5) {
echo "No more dude!"
} else {
//render normal upload page
}



Don't ask for true code today, is weekend, I'm on an tablet traveling.
Happy with my help? Buy me a coffee.
Please, always use the search before opening a new topic! We're all here on our (limited) free time! Make sure you help yourself too!
  •  

ASDFTopic starter

No more dude.... :p :p :p, good one.
But dude, which file to edit?
  •  

Marius P.

Always com/com_add.php for video uploads :)
Happy with my help? Buy me a coffee.
Please, always use the search before opening a new topic! We're all here on our (limited) free time! Make sure you help yourself too!
  •  

ASDFTopic starter

Hey Mario...can you tell me where to insert that code....is it possible for you?
  •  

ASDFTopic starter

  •  

ASDFTopic starter

 ;D....can you tell me where to insert the above code for limiting uploads by user.
  •  

Marius P.

If you want to copy/paste it you'll just get that $uservids->nr is undefined :)
Happy with my help? Buy me a coffee.
Please, always use the search before opening a new topic! We're all here on our (limited) free time! Make sure you help yourself too!
  •  

ASDFTopic starter

Sorry bro, i don't know if it's the same, but i have to limit the users by from uploading (X) number of photos....sorry,i only mentioned the uploads earlier and not the type.
You said for video related things, i should always look into com_add.php.....but what about the photos.
Com_image.php? and can it be done. Sorry again.
Please please help me with this one.
This is a must for me right now. :( :( :(.
  •  

ASDFTopic starter

  •  

Marius P.

#13
Here is the sql query examples returning what you need.

For videos:
SELECT COUNT( * ) 
FROM `vibe_videos` 
WHERE `user_id` =1
AND DATE( DATE ) = DATE( NOW( ) ) 
AND media = '1'



For pictures:


SELECT COUNT( * ) 
FROM `vibe_videos` 
WHERE `user_id` =1
AND DATE( DATE ) = DATE( NOW( ) ) 
AND media = '3'



Now that you know the logic query here is how it goes in PHPVibe:


$uservids = $db->get_row("Select count(*) as nr from ".DB_PREFIX."videos WHERE `user_id` = '".user_id()."' AND DATE( DATE ) = DATE( NOW( ) ) AND media = '1' ");



now


$uservids->nr


and you can easily do an if:


if($uservids->nr > 4){
echo "You have reached the daily number of 5 videos.";

}

Holds the number of videos uploaded today by the current user.


Same for pictures, just media is 3 in that case, for music is 2.

Happy with my help? Buy me a coffee.
Please, always use the search before opening a new topic! We're all here on our (limited) free time! Make sure you help yourself too!
  •  

Marius P.

Quote from: ASDF on
Please Mario.... :( :-\ :-\.

You saw me typing here and you decided I need a push? :)
I was anyways answering you.
Happy with my help? Buy me a coffee.
Please, always use the search before opening a new topic! We're all here on our (limited) free time! Make sure you help yourself too!
  •  

ASDFTopic starter

  •  

ASDFTopic starter

Hey Mario...your this line...Holds the number of videos uploaded today by the current user.
Has confused me totally, the above code is for limiting the user from uploading the X number of images (media 3 )?
If, yes...then where am i supposed to insert that code now and where in the particular file....com_add.php or com_images.php?
:p.
  •  

Marius P.

Happy with my help? Buy me a coffee.
Please, always use the search before opening a new topic! We're all here on our (limited) free time! Make sure you help yourself too!
  •  

ASDFTopic starter

In which file for limiting image uploads....com_add.php or com_image.php and where.....i know bro you will literally beat the hell out of me if i show you up, as you are pissed, but i even know a minor mistake in coding can bring the whole website down.
  •  

Marius P.

Do you read what your are asking? Or think about it for a second? I've already told you before com_add is for video, com_image is for images (it has 'image' in it  ??? )
Happy with my help? Buy me a coffee.
Please, always use the search before opening a new topic! We're all here on our (limited) free time! Make sure you help yourself too!
  •  

Marius P.

I'm not pissed, I know I'm not all sugar, pretty hard to be when you eyes and head hurt 24/7.
Happy with my help? Buy me a coffee.
Please, always use the search before opening a new topic! We're all here on our (limited) free time! Make sure you help yourself too!
  •  

ASDFTopic starter

Sorry mate  :p...getting different types of errors, that's why i have given you the codes ^-^ :) :).
  •  

Marius P.

Want me to make you an paid subscription for coding lessons?  :p


All you need is this area:


if((get_option('uploadrule') == 1) ||  is_moderator()) {    
add_filter( 'the_defaults', 'modify_content' );
} else {
add_filter( 'the_defaults', _lang("Uploading is disabled") );
}



like:



/* New line */ if(($uservids->nr > 4) && !is_moderator()){
if((get_option('uploadrule') == 1) ||  is_moderator()) {   
add_filter( 'the_defaults', 'modify_content' );
} else {
add_filter( 'the_defaults', _lang("Uploading is disabled") );
}

/* New condition */
} else {
add_filter( 'the_defaults', _lang("You have passed your daily limit of X videos/images/music bla bla") );
}



Don't forget to place the actual query right before this code :)
Happy with my help? Buy me a coffee.
Please, always use the search before opening a new topic! We're all here on our (limited) free time! Make sure you help yourself too!
  •  

ASDFTopic starter

  •  

ASDFTopic starter

  •  

Similar topics (7)