• Welcome to PHPVIBE Forums. Please log in.

[ Video Sharing CMS v4 ] Searching for specific videos in admin section

Started by thomaskloos,

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

thomaskloosTopic starter

I am wanting to have a search that will show me a list of all videos that are under 3 minutes, and offer the ability to un publish them. I don't even know where to start to develop this. Is there something like this that someone has created?

...Thomas
  •  

PHPVibe A.

A very fast and simple way is:

SELECT * FROM `vibe_videos` where duration <= 180


You can always double videos.php to a smallvideos.php and modify the query like up.
Then access/link it as moderator/?sk=smallvideos

thomaskloosTopic starter

I am assuming I change this line?

$videos = $db->get_results("select id,title,thumb, views, liked,featured, duration from ".DB_PREFIX."videos where pub > 0 ORDER BY ".DB_PREFIX."videos.id DESC ".this_limit()."");

?
  •  

PHPVibe A.

Yes, like this:
$videos = $db->get_results("select id,title,thumb, views, liked,featured, duration from ".DB_PREFIX."videos where pub > 0 and duration <= 180 ORDER BY ".DB_PREFIX."videos.id DESC ".this_limit()."");

thomaskloosTopic starter

OK that works well! Thanks!

Now how would I add that new page to the video management menu on the left?

Is there a document that describes what files do what functions so I don't have to keep asking you for where to do little changes?

Thanks a million!
...Thomas
  •  

Marius P.

Sorry Thomas, we are a bit low on documentation, but ask with no holds back till we release more tips.

Check
moderator/adm-functions.php



From what Alex provided I would suggest adding:



                 
    <a class="accordion-toggle green-leftstripe" href="'.admin_url('smallvideos').'"><span>Short Vids</span></a>





After/before:



                     
<a class="accordion-toggle green-leftstripe" href="'.admin_url('videos').'"><span>Video manager</span></a>



Clearly the choice is 100% yours!
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!
  •  

PHPVibe A.

Check adm-functions.php in moderator under:
//style
function adm_sidebar(){


Edit:  ;D I was slower

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!
  •  

PHPVibe A.


thomaskloosTopic starter

You guys are awesome! Thanks so much.

Now I want to figure out how I can create a text box to specify how many seconds to look for videos shorter than. I started out with 3 minutes but that catches almost all song videos.

I want to make this easy for my wife to help manage. =)

...Thomas
  •  

Marius P.

Drop this somewhere :
  <div class="row-fluid">
<form id="validate" class="form-horizontal styled" action="<?php echo admin_url('smallvideos');?>" enctype="multipart/form-data" method="get">
<input type="text" name="seconds" class="span3" value=""> 
<button type="submit" class="pull-right btn btn-success">Sort</button>    
</form>
<>


And modify the query to :
$d = (isset($_GET['seconds'])) ?  $_GET['seconds'] : 180;
$videos = $db->get_results("select id,title,thumb, views, liked,featured, duration from ".DB_PREFIX."videos where pub > 0 and duration <= ".$d." ORDER BY ".DB_PREFIX."videos.id DESC ".this_limit()."");


Change:



if(isset($_GET['sort']) ) {
$ps = admin_url('videos').'&sort='.$_GET['sort'].'&p=';
} else {
$ps = admin_url('videos').'&p=';
}



to:
if(isset($_GET['sort']) ) {
$ps = admin_url('videos').'&seconds='.$d.'&sort='.$_GET['sort'].'&p=';
} else {
$ps = admin_url('videos').'&seconds='.$d.'&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!
  •  

Marius P.

I haven't test it, but if it has any issues, just post the error and I will fix it right away.
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!
  •  

thomaskloosTopic starter

Well it keeps going back to the url

http://sermonfinder.net/moderator/?seconds=102. The url in the form when you view source is this

action="http://sermonfinder.net/moderator/?sk=tooshortvideos"

So that is OK. Somehow its losing the URL.

If I manually enter it: http://sermonfinder.net/moderator/?sk=tooshortvideos&seconds=102 it works!

I named the file tooshortvideos.php

  •  

PHPVibe A.

If that's the name, use this for pagination:

if(isset($_GET['sort']) ) {
$ps = admin_url('tooshortvideos').'&seconds='.$d.'&sort='.$_GET['sort'].'&p=';
} else {
$ps = admin_url('tooshortvideos').'&seconds='.$d.'&p=';
}

thomaskloosTopic starter

I have it set like that. But the URL that it goes to after clicking the button is not correct
  •  

PHPVibe A.

Have you also changed:

action="<?php echo admin_url('smallvideos');?>"



Do like this:

<form id="validate" class="form-horizontal styled" action="<?php echo admin_url('tooshortvideos');?>" enctype="multipart/form-data" method="post">


Noticed I've changed get to post in method.

and change:

$d = (isset($_GET['seconds'])) ?  $_GET['seconds'] : 180;


to:
$d = (isset($_REQUEST['seconds'])) ?  $_REQUEST['seconds'] : 180;

thomaskloosTopic starter

Yes I have changed all references to the tooshortvideos
  •  

PHPVibe A.


thomaskloosTopic starter

Yes I tried what you suggested. Still no go

I have attached my tooshortvideos.php file as a text file. I am sure I have missed something somewhere.

Thanks!
  •  

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!
  •  

thomaskloosTopic starter

  •  

PHPVibe A.

He forgot to keep the seconds in first's url , but this works,I've tested it also.

Marius P.

Quote from: Alexander on
He forgot to keep the seconds in first's url , but this works,I've tested it also.

:-[
Why you didn't notice?  :P

Glad to help Thomas!
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!
  •  

thomaskloosTopic starter

I didn't go through it to see, but did notice you used the search box instead. Brilliant my friend!

So it was something in the form code? I noticed the search using the standard input code with the other code used button code.

thanks so much!

...Thomas
  •  

PHPVibe A.

He didn't code the admin, so was not very familiar with it.
The code was ok normally, but the PHPVibe admin is coded a bit different than other scripts, better like this, pushed via a js.

Similar topics (7)