Related Topics


[Video CMS v4]Daily upload limit per user /How to limit daily uploads in PHPVibe  (Read 2549 times) Print

1 2 3  All B


ASDF  September 19, 2014, 08:56:47 PM

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... :) .

Logged


mihai  September 19, 2014, 11:33:34 PM

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)

Logged


ASDF  September 20, 2014, 09:43:26 AM

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.

Logged


ASDF  September 20, 2014, 09:40:26 PM

???

Logged


@Mario  September 20, 2014, 10:08:53 PM

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

Code
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.

Logged
Hello!
If you wish to learn how to start coding on the PHPVibe Video CMS head to the blog.

Please use the search before opening a new topic!


ASDF  September 20, 2014, 10:11:34 PM

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

Logged


@Mario  September 20, 2014, 10:16:06 PM

Always com/com_add.php for video uploads :)

Logged
Hello!
If you wish to learn how to start coding on the PHPVibe Video CMS head to the blog.

Please use the search before opening a new topic!


ASDF  September 20, 2014, 10:27:43 PM

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

Logged


ASDF  September 21, 2014, 03:51:08 PM

???

Logged


ASDF  September 22, 2014, 08:02:43 PM

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

Logged


@Mario  September 22, 2014, 08:43:56 PM

If you want to copy/paste it you'll just get that $uservids->nr is undefined :)

Logged
Hello!
If you wish to learn how to start coding on the PHPVibe Video CMS head to the blog.

Please use the search before opening a new topic!


ASDF  September 23, 2014, 09:34:39 AM

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. :( :( :(.

Logged


ASDF  September 23, 2014, 12:59:09 PM

Please Mario.... :( :-\ :-\.

Logged


@Mario  September 23, 2014, 01:03:42 PM

Here is the sql query examples returning what you need.

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


For pictures:


Code
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:


Code
$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


Code
$uservids->nr

and you can easily do an if:


Code
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.


Logged
Hello!
If you wish to learn how to start coding on the PHPVibe Video CMS head to the blog.

Please use the search before opening a new topic!


@Mario  September 23, 2014, 01:12:08 PM

Please Mario.... :( :-\ :-\.

You saw me typing here and you decided I need a push? :)
I was anyways answering you.

Logged
Hello!
If you wish to learn how to start coding on the PHPVibe Video CMS head to the blog.

Please use the search before opening a new topic!


ASDF  September 23, 2014, 02:01:15 PM

Hahaha.... ;D.

Logged


ASDF  September 23, 2014, 02:26:35 PM

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.

Logged


@Mario  September 23, 2014, 03:11:12 PM

I've even code exampled you how to limit...

Logged
Hello!
If you wish to learn how to start coding on the PHPVibe Video CMS head to the blog.

Please use the search before opening a new topic!


ASDF  September 23, 2014, 03:23:04 PM

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.

Logged


@Mario  September 23, 2014, 03:35:51 PM

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  ??? )

Logged
Hello!
If you wish to learn how to start coding on the PHPVibe Video CMS head to the blog.

Please use the search before opening a new topic!


@Mario  September 23, 2014, 03:36:41 PM

I'm not pissed, I know I'm not all sugar, pretty hard to be when you eyes and head hurt 24/7.

Logged
Hello!
If you wish to learn how to start coding on the PHPVibe Video CMS head to the blog.

Please use the search before opening a new topic!


ASDF  September 23, 2014, 06:51:25 PM

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

Logged


@Mario  September 23, 2014, 07:47:37 PM

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


All you need is this area:


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


like:



Code

/* 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 :)

Logged
Hello!
If you wish to learn how to start coding on the PHPVibe Video CMS head to the blog.

Please use the search before opening a new topic!


ASDF  September 23, 2014, 08:27:53 PM

Hahaha....honestly bro, i am interested in learning it from you. :) :P :P.

Logged


ASDF  September 23, 2014, 08:50:24 PM

Getting error on line 142... :(.

Logged