PDA

View Full Version : vBulletin CMS Widgets - Media Library CMS Sidebar


ngcoders
06-05-2010, 10:00 PM
Media Library CMS Sidebar

Released 06-06-2010
By Vikas - http://www.ngcoders.com
For Plugin - https://vborg.vbsupport.ru/showthread.php?t=240677 (8WayRun.Com - Media Library)
For Demo - http://www.roboticsindia.com/ ( Left Sidebar )

Installation


Goto Admincp->vBullietin CMS->Widgets->Create New Widget
Choose PHP Direct Execution as Widget's Type
Place a Title. eg Latest Videos. Keep it short as this is what will appear as title on your pages.
Click Save
Click Configure on the right of the new created widget.
Remove the default code that appears. Be sure to not leave behind even a single letter.
Copy and Paste the code that you can find below.
Leave the template name as is (vbcms_widget_execphp_page)
Click Save
Goto Admincp->vBullietin CMS->Layout Manager
Click Go on the Default Layout
Add the Widget to your Layout
Click Save
That's all !!


PHP Code



global $vbulletin;
require_once(DIR.'/media/media_functions_hrefs.php');

// %d
$show_count = 5;

$medias = $vbulletin->db->query_read("
SELECT media.*, media_service.*
FROM " . TABLE_PREFIX . "media AS media
LEFT JOIN " . TABLE_PREFIX . "media_service AS media_service ON(media_service.serviceID = media.serviceID)
ORDER BY media.dateline DESC
LIMIT ".$show_count);


$output = '
<style type="text/css">
.thumbnail img{
width: 90px;
height: 70px;
border: 1px solid #ccc;
padding: 5px;
margin: 5px;
float: left;
}

.video_bit {
min-height: 90px;
}

</style>

';

while ($media = $vbulletin->db->fetch_array($medias))
{

$media['thumbnail'] = $vbulletin->options['media_thumb_dir']."/thumbs/". $media['mediaID'] .".jpg";
$media['href'] = construct_href_details($media);

extract($media);

$title = substr($title,0,60);

$mediabits .= sprintf('<div class="cms_widget_post_bit video_bit"><div class="thumbnail"><a href="%s"><img src="%s"></a></div><div class="cms_widget_post_header"><a href="%s">%s</a></div><div class="cms_widget_post_userinfo"><a href="member.php/u=%d">%s</a> On %s</div></div>',$href,$thumbnail,$href,$title,$userid,$username, date('F j, Y, g:i a',$dateline));
}



$output .= $mediabits;

Xencored
06-06-2010, 11:42 AM
Hey mate i think its best if you change the title to CMS sidebar
Jaxel added a forums sidebar one in his mods page (just not a CMS one) i think it will be easyer for people to find
Good Work too :up::up:

rotor
06-06-2010, 12:55 PM
Been waiting for this..... thx much appreciated :up: :D

ngcoders
06-06-2010, 01:30 PM
Changed to CMS side bar.

schlottkej
06-06-2010, 03:04 PM
Where is the Forums Sidebar version in his thread?

schlottkej
06-06-2010, 03:47 PM
Wow.. I found it... Ill repost

# NEW FEATURE: Widget support for both the ForumHome Sidebar and the vbCMS.

This has been updated since the previous versions, so please update your codes.

Sidebar Block:
Code:

global $vbulletin;
require_once(DIR.'/media/media_functions_hrefs.php');

$medias = $vbulletin->db->query_read("
SELECT media.*, media_service.*
FROM " . TABLE_PREFIX . "media AS media
LEFT JOIN " . TABLE_PREFIX . "media_service AS media_service ON(media_service.serviceID = media.serviceID)
ORDER BY media.dateline DESC
LIMIT 3
");

while ($media = $vbulletin->db->fetch_array($medias))
{
if ($media['length'] == 0)
{
$media['length'] = "???";
}
else
{
$duration = $media['length'];
$minutes = floor($duration / 60);
$seconds = $duration % 60;
$seconds = str_pad($seconds, 2, "0", STR_PAD_LEFT);
$media['length'] = "$minutes:$seconds";
}

$media['intrate'] = intval($media['rating']);
$media['thumbnail'] = $vbulletin->options['media_thumb_dir']."/thumbs/". $media['mediaID'] .".jpg";
$media['href'] = construct_href_details($media);

$templater = vB_Template::create('8WR_media_WIDGET');
$templater->register('media', $media);
$mediabits .= $templater->render();
}

return $mediabits;

CMS Widget:
Code:

require_once(DIR.'/media/media_functions_hrefs.php');

$medias = vB::$vbulletin->db->query_read("
SELECT media.*, media_service.*
FROM " . TABLE_PREFIX . "media AS media
LEFT JOIN " . TABLE_PREFIX . "media_service AS media_service ON(media_service.serviceID = media.serviceID)
ORDER BY media.dateline DESC
LIMIT 3
");

while ($media = vB::$vbulletin->db->fetch_array($medias))
{
if ($media['length'] == 0)
{
$media['length'] = "???";
}
else
{
$duration = $media['length'];
$minutes = floor($duration / 60);
$seconds = $duration % 60;
$seconds = str_pad($seconds, 2, "0", STR_PAD_LEFT);
$media['length'] = "$minutes:$seconds";
}

$media['intrate'] = intval($media['rating']);
$media['thumbnail'] = vB::$vbulletin->options['media_thumb_dir']."/thumbs/". $media['mediaID'] .".jpg";
$media['href'] = construct_href_details($media);

$templater = vB_Template::create('8WR_media_WIDGET');
$templater->register('media', $media);
$mediabits .= $templater->render();
}

$output = $mediabits;

# BUG FIX: Fixed formatting buttons on quick reply for comments.
# BUG FIX: Fixed MySQLi errors for those who happen to be using it.
# BUG FIX: Fixed service constructs for non-SEO slugged links.
# BUG FIX: Fixed RSS feeds for tags in table prefix settings.

nomoreturn
06-06-2010, 11:18 PM
Installed but didnt got the thumbnil of videos

akxt660
06-15-2010, 09:22 PM
Have a way to add the userinfo bellow off any midia?

Reef Man
06-28-2010, 07:03 PM
do you know how I can configure this on a vbadvanced block?

LouisB
06-29-2010, 01:15 PM
Sidebar block works great. Thanks.

WeMovie.co.uk
07-15-2010, 03:31 PM
The videos arent updating on the CMS...

SunrunnerSWG
08-11-2010, 01:44 AM
This widget was a fantastic addition to my website. I appreciate your hard work!

How would I go about changing the widget so that it doesn't display a date or a username? I'd like to only display a thumbnail with a description.

Veer
08-11-2010, 01:24 PM
This widget was a fantastic addition to my website. I appreciate your hard work!

How would I go about changing the widget so that it doesn't display a date or a username? I'd like to only display a thumbnail with a description.
+1 this.

RobbieZ
08-11-2010, 05:09 PM
This widget was a fantastic addition to my website. I appreciate your hard work!

How would I go about changing the widget so that it doesn't display a date or a username? I'd like to only display a thumbnail with a description.

Let me install it and see if I can remove it for you.


* Tried and failed :( lol

Veer
08-11-2010, 07:36 PM
Let me install it and see if I can remove it for you.


* Tried and failed :( lol
lol :D

kho91
08-23-2010, 03:16 AM
please how can i remplace tatset video by more popular video?

capy
08-27-2010, 02:58 PM
Is it possible to get only one clip from one user? That way if someone is uploading 4 clips the widget will only show the newest clip from that user and the 3 next clips will be from other users.

capy
08-27-2010, 03:02 PM
Another thing. Is it possible to get the pictures side by side and having the text under the pictures?

cloferba
09-01-2010, 06:30 PM
thanks!

bada_bing
09-01-2010, 08:32 PM
Installed Thanks!!!

You can see it in action here http://www.teenzspot.net

ercollins
09-02-2010, 09:47 PM
yes if anyone gets this working on vbadvanced please post up........

capy
01-16-2011, 11:41 AM
Looks like i need a fix after upgrading from 4.0.5 to 4.1.1. Now the pictures does not display under each other. Take a look: www.fpv.no

Can anyone think of a quick fix?

capy
01-21-2011, 06:55 AM
Can no one help me on this?

Mark4865
01-21-2011, 09:33 AM
Hello,

this is exactly what I need but cant seem to get it to work on 4.1.1 get error message below not sure what I am doing wrong, help anyone??

Warning: require_once([path]/media/media_functions_hrefs.php) [function.require-once]: failed to open stream: No such file or directory in [path]/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 2

Fatal error: require_once() [function.require]: Failed opening required '/var/www/clients/client11/web26/web/media/media_functions_hrefs.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/clients/client11/web26/web/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 2

sgbmad
01-21-2011, 10:54 AM
Works great but I'm looking for the same horizontal widget.

Thanks.

Mark4865
01-25-2011, 06:40 AM
Hello,

this is exactly what I need but cant seem to get it to work on 4.1.1 get error message below not sure what I am doing wrong, help anyone??

Warning: require_once([path]/media/media_functions_hrefs.php) [function.require-once]: failed to open stream: No such file or directory in [path]/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 2

Fatal error: require_once() [function.require]: Failed opening required '/var/www/clients/client11/web26/web/media/media_functions_hrefs.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/clients/client11/web26/web/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 2

Mark4865
01-31-2011, 01:37 PM
hello,

Any one out there who can help PLEASE, this is perfect for my needs if only I could get it to work. What am I missing here???

Warning: require_once([path]/media/media_functions_hrefs.php) [function.require-once]: failed to open stream: No such file or directory in [path]/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 1

Fatal error: require_once() [function.require]: Failed opening required '/var/www/clients/client11/web26/web/media/media_functions_hrefs.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/clients/client11/web26/web/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 1

Mark4865
02-06-2011, 07:17 AM
Some one help PLEASE?

Mark4865
02-11-2011, 05:21 AM
Help anyone PLEASE, willing to pay someone to help me get this working???

Mark4865
02-17-2011, 10:31 AM
do I have to offer to sell a kidney to get someone to help me with this??

Anyone please??

rafiul
02-27-2011, 07:38 PM
Re upload all files and try again. Looks like some files are missing.

Mark4865
02-28-2011, 04:44 AM
Re upload all files and try again. Looks like some files are missing.

Thanks for advice but what am I missing here, what files??

I just loaded the widget code as specified. Maybe my problems is my video files, I have them loaded in a section as static pages would that be an issue???

:)

joeman
03-01-2011, 08:55 PM
Hello,

this is exactly what I need but cant seem to get it to work on 4.1.1 get error message below not sure what I am doing wrong, help anyone??

Warning: require_once([path]/media/media_functions_hrefs.php) [function.require-once]: failed to open stream: No such file or directory in [path]/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 2

Fatal error: require_once() [function.require]: Failed opening required '/var/www/clients/client11/web26/web/media/media_functions_hrefs.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/clients/client11/web26/web/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 2


I'm having the same issue you are having with this CMS widget mod... Did everything exactly as said in directions on page one but same error message like yours keeps coming up.

Mark4865
03-02-2011, 04:49 AM
Can someone please assist with this issue???

Doganay YILDIZ
03-03-2011, 03:38 PM
hello
This plug-in , Can we change the subject instead of insvideo?

Bob_R
03-03-2011, 08:34 PM
Up at the top of the instructions there is a link to a plug-in. I'm sorry it's been a long day. Do I need that plugin in addition to adding the code. :confused:

Also, how do the videos get inserted into the media? By the poster themselves or me as admin?

Thanks!! :)

Mark4865
03-04-2011, 04:48 AM
Can someone who has this working in 4.1.1 PLEASE tell those asking how to get this mod to work

all help appreciated

Mark4865
03-06-2011, 09:01 AM
going to sound really dumb but then you are working with a technical idiot here so understand before you laugh.

just noticed the plugin add on so I assume it only works with the plugin??

Need a recent video widget the works by drawing info from videos I created using embed code in static pages any ideas anyone

Bob_R
03-08-2011, 06:46 PM
going to sound really dumb but then you are working with a technical idiot here so understand before you laugh.

just noticed the plugin add on so I assume it only works with the plugin??


I asked the same question above (post #36) and a 2nd one. Waiting for answers.

3rd question. You know how when you embed a code on your site and youtube doesn't allow it to be viewed unless you go to youtube?

Would this not occur anymore since it's being added to a media library?

BF777
03-26-2011, 02:48 AM
How does one get rid of the "php" logo to the left of "Latest Videos?"

BorisPeace
06-01-2011, 06:52 AM
This is really great, though it seems a little off on my page.

Here is how it looks: http://i52.tinypic.com/dr9r8x.jpg

Is there a way to fix this?

Vi3t4Lov3
06-02-2011, 05:18 PM
I really like the tag cloud on your demo. can you help me to make the tag move like that? please
thank you very much

SeanE
06-12-2011, 07:59 AM
I just upgraded to vB 4.1.4 - does this hack support 4.1.4?

Thanks,
SeanE

ProFifaLeagues
06-12-2011, 08:51 AM
Yes its working fine for us mate

ARSamo
06-25-2011, 03:02 PM
working fine for me too.........

doctorsexy
09-07-2011, 10:11 AM
Installed Working 4.1.5 thank you....

K4GAP
09-10-2011, 09:17 AM
Thanks for this!

Works exactly as described on 4.1.5

Gemma
09-10-2011, 10:06 AM
Thanks for this :)

K4GAP
12-24-2011, 05:12 AM
Working on 4.1.8 just fine.

bada_bing
01-11-2012, 05:07 PM
working on 4.19

Mariner1
01-11-2012, 06:25 PM
Thanks for the mod,however i have probs.Ive followed your instructions but the widget does not show.Using 4.18

1320Nation
01-14-2012, 02:35 AM
Is anyone able to get this working for vbadvance cmps?

bada_bing
01-22-2012, 10:35 PM
yes if anyone gets this working on vbadvanced please post up........

Working check out my site for a demo

ilbianconiglio
02-20-2012, 09:06 PM
is possible choice only latest video of a category?anyone know how to do it?

alhidaya
04-15-2012, 08:16 AM
This is really great, though it seems a little off on my page.

Here is how it looks: http://i52.tinypic.com/dr9r8x.jpg

Is there a way to fix this?

Hello,

I have the same problem and yet I have the latest version. Thank you to want to do with this topic

skido
04-17-2012, 12:42 PM
Thanks, working perfect :D

victorvu
05-23-2012, 02:17 PM
Hi:

A question: how can you build a scroll bar into this cms side block or form side block?

Victor

Mark4865
01-05-2013, 12:49 PM
Would this work for other media players like vbtube

naveeid
01-11-2013, 04:57 AM
i am also getting this error

Warning: require_once([path]/media/media_functions_hrefs.php) [function.require-once]: failed to open stream: No such file or directory in [path]/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 2

Fatal error: require_once() [function.require]: Failed opening required '/home/naveed/public_html/media/media_functions_hrefs.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/naveed/public_html/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 2

RichieBoy67
01-18-2013, 02:54 AM
Do you guys have the media library installed? This only works if that is installed first...

marccap
02-11-2013, 10:30 PM
Hello,

I have the same problem and yet I have the latest version. Thank you to want to do with this topic

Try amending the widget coding measurements. I amended the padding and margin from 5px to 4px and seem to fix the problem :eek:

$output = '
<style type="text/css">
.thumbnail img{
width: 90px;
height: 70px;
border: 1px solid #ccc;
padding: 5px;
margin: 5px;
float: left;

rotor
12-04-2013, 01:41 AM
I'd really like to get this to work on my site and any help would be greatly appreciated...........

I am running 4.2.2 and when I try to use the code it gives me a database error ....

Anyone got any ideas??????

rotor
01-13-2014, 06:59 AM
Anyone????????

RichieBoy67
01-13-2014, 07:43 AM
What is the error?

rotor
07-29-2015, 08:20 PM
oops just noticed your reply - heres the error that I get -

PHP Warning: require_once(..../media/media_functions_hrefs.php): failed to open stream: No such file or directory in ..../packages/vbcms/widget/execphp.php(191) : eval()'d code on line 2

Fatal error: require_once(): Failed opening required '/home/xxxxxxxxxxxx/public_html/xxxxxxxxxxxxxx/media/media_functions_hrefs.php' (include_path='.:/usr/local/php54/pear') in /home/xxxxxxxx/public_html/xxxxxxxxxxx/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 2