PDA

View Full Version : vBulletin CMS Widgets - Latest Album Picture v2


Massamo
12-13-2009, 10:00 PM
Create a new widget
Widget Type: PHP Direct Execution
Title: Latest Picture

Then save find it again and click the configure change top box to

global $db;

// set how many to display
$hm = '1';

// replace dateline below with rand(NOW()) if you want it random
$orderby = "dateline";


$lpictures = $db->query_read("
SELECT * FROM " . TABLE_PREFIX . "attachment AS attach
WHERE attach.state = 'visible' and attach.contenttypeid = '1'
ORDER BY $orderby DESC LIMIT 0, $hm
");

$cols = $db->num_rows($lpictures);

while ($lpicture = $db->fetch_array($lpictures))
{

$templater = vB_Template::create('cms_albums_albumsbits');
$templater->register('lpicture' , $lpicture);
$albumpics .= $templater->render();

$templater = vB_Template::create('cms_albums');
$templater->register('lpicture' , $lpicture);
$templater->register('albumpics' , $albumpics);
$cms_albums = $templater->render();

}
$output = $cms_albums;

Then save

add 2 new templates below

Title: cms_albums
<link rel="stylesheet" type="text/css" href="css.php?styleid=1&amp;langid=1&amp;d=1260794007&amp;td=ltr&amp;she et=album.css" />

<link rel="stylesheet" type="text/css" href="css.php?styleid=1&amp;langid=1&amp;d=1260794007&amp;td=ltr&amp;she et=picture.css" />

<div class="block" id="album">
<ol id="thumbnails" class="blockbody floatcontainer">
$albumpics
</ol>
</div>Title: cms_albums_albumsbits

<li>

<center><a class="picture" href="$vboptions[bburl]/attachment.php?attachmentid=$lpicture[attachmentid]"><img src="$vboptions[bburl]/attachment.php?attachmentid=$lpicture[attachmentid]" alt="$lpicture[caption]" border="0" height="100" width="200" /></a></center>
</li>
all you need to do now is go into layout manager and add the widget where you want it

Cees
12-14-2009, 07:13 PM
Hi, searched for Widget Type: PHP Direct Execution, but couldnt find it. Maybe im in the wrong place , but im going to the widgetmanager choose new widget and then select Widget Type: PHP Direct Execution? Its not in the dropdown. (using Rc2)

Massamo
12-15-2009, 03:02 AM
have you updated all the way to rc2 without uploading new php files? it may not be in old files not to sure

yilmaz
12-15-2009, 06:14 AM
Hi, searched for Widget Type: PHP Direct Execution, but couldnt find it. Maybe im in the wrong place , but im going to the widgetmanager choose new widget and then select Widget Type: PHP Direct Execution? Its not in the dropdown. (using Rc2)

Clear the cache

ArcadeSyndicate
12-15-2009, 08:56 AM
thank you, works fine :cool:

worried
12-15-2009, 10:01 AM
This will definitely be my first vB 4.0 mod. I'll add this once 4.0 is officially released.

Cees
12-16-2009, 06:59 AM
That did it, works great. Thanks!

abroad
12-16-2009, 03:16 PM
Where can I change the background of each picture? I want to decrease the height of the white box behind the picture so that it has a similar size as the picture. Is this a specific CSS file? Where can I find it?

ThorstenA
12-16-2009, 08:41 PM
I think the album permissions are not queried. It's important to not show private albums to the user. It would be nice if I could look at a "friend only" album when I am the friend of that user, of course users that are not befriended with the album author should not be shown the image.

Massamo
12-17-2009, 12:45 AM
look into that sometime today it and it uses album.css and picture.css someones the album system uses

merlin_de
12-19-2009, 08:10 AM
Hello,
it works not in my cms. There is a Box with the title "Latest Picture", but without content. I have upload a new albumpicture, but nothing happens.
In the Template "cms_albums_almbumsbits" is a href to "album-picture.php". Where can i find this file ?
Greets,Micha

Allan
12-19-2009, 08:16 AM
Do you have one screen please ?

merlin_de
12-19-2009, 08:28 AM
Hello Allan,
many thanks for your answer. I can?t believe it: I had deleted the old (and incompatible) vB3 Styles in the ACP now, and it works:eek:. Maybee this will help other users who have problems with this nice widget.
However, here my screenshot from a working hack ;)

https://vborg.vbsupport.ru/external/2009/12/67.jpg

Greets,Micha

abroad
12-19-2009, 10:01 AM
the pictures need to be larger...how is it possible to change it?

woffie
12-19-2009, 11:12 AM
I get an error when I use this.

Fatal error: Call to a member function query_read() on a non-object in /home/myforums/public_html/myforums/forums/packages/vbcms/widget/execphp.php(171) : eval()'d code on line 6

AWMGolfer
12-19-2009, 11:43 AM
Is there a way this can work on the new forum sidebar?

AndrewSpearin
12-19-2009, 09:28 PM
Thanks for this, I was able to adapt it to suit a needed feature perfectly :)

http://npac.ca/2010

abroad
12-23-2009, 07:55 AM
there is a problem with pictures which are set to private. Those are not displayed. The album is only displayed empty. They need to be filtered out.

Massamo
12-23-2009, 09:00 AM
This will fix the problem updated first post too


global $db;

// set how many to display
$hm = '1';

// replace dateline below with rand(NOW()) if you want it random
$orderby = "dateline";


$lpictures = $db->query_read("
SELECT albumpicture.*, album.*, user.username, user.usergroupid,
IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid
FROM " . TABLE_PREFIX . "attachment AS albumpicture
LEFT JOIN " . TABLE_PREFIX . "album AS album ON(album.albumid = albumpicture.contentid)
LEFT JOIN " . TABLE_PREFIX . "user AS user ON(user.userid = album.userid)
WHERE album.state = 'public' and albumpicture.contenttypeid = '8'
ORDER BY $orderby DESC LIMIT 0, $hm
");


$cols = $db->num_rows($lpictures);

while ($lpicture = $db->fetch_array($lpictures))
{
$lpicture['musername'] = fetch_musername($lpicture);
$lpicture['title'] = trim(strip_quotes($lpicture['title']));


$templater = vB_Template::create('cms_albums_albumsbits');
$templater->register('lpicture' , $lpicture);
$albumpics .= $templater->render();

$templater = vB_Template::create('cms_albums');
$templater->register('lpicture' , $lpicture);
$templater->register('albumpics' , $albumpics);
$cms_albums = $templater->render();

}
$output = $cms_albums;

abroad
12-23-2009, 09:13 AM
thanks a lot!

kevinfx
01-02-2010, 07:32 PM
how do i display pix in 2 column (side by side like this : pix 1 | pix 2

thanks

Verionia
01-04-2010, 12:28 AM
How do I display this as a block on the forum?

ARadarDetector
01-04-2010, 02:27 AM
I added this to my cms homepage: http://www.Radar-Detector.net

As you can see the pictures don't fill that box up fully, I went into template to make the edit to make it bigger not sure which one i need to increase? How would I make the preview images seen on my homepage appear bigger to fill out the boxes more?

Thanks!

gsipromotions
01-05-2010, 01:49 PM
I get an error when I use this.

Fatal error: Call to a member function query_read() on a non-object in /home/myforums/public_html/myforums/forums/packages/vbcms/widget/execphp.php(171) : eval()'d code on line 6

Yep, I got that as well.

worried
01-08-2010, 09:19 AM
The center tag in your script isn't working for me. I think there is css from the album.css or picture.css that fixes the left margin. However, I see ARadarDetector's is centered perfectly. I have mine installed in vB 4.0 Gold.

kersti
01-09-2010, 11:13 AM
How do I add in two new templates?

antua al toro
01-18-2010, 02:28 PM
How do I add in two new templates?

+1
i wonder
maybe i don't get it, spend 3 hours and didn't find how to add new templates.
help, please

ahmedipa
01-23-2010, 03:14 PM
thank you so much

Juggernaut
02-05-2010, 04:44 AM
Thank you very much for this widget, it's awesome :D

aberg
02-05-2010, 05:57 PM
the pictures need to be larger...how is it possible to change it?
That's my question to, but there is no answer yet.
Is there someone who knows a solution?

How do I add in two new templates?
In the admin menu go to Styles & Templates.
Click on Style Manager
In the drop down menu click on Add New Template.
If you have more styles you must add templates for each style

dancop
02-05-2010, 10:54 PM
Is there a way to limit the widget to pull the pictures from the given album only not from all the albums?

Juggernaut
02-06-2010, 01:58 AM
Yes the pictures are to small, but otherwise this is a good widget :D

dodgechargerfan
02-06-2010, 05:38 PM
I like this a lot but I am seeing the same problem as others - the picture is smaller than the box so there's a lot of white background to look at.

Bergler
02-07-2010, 12:08 AM
Like this,

Bergler
02-07-2010, 02:02 AM
Like this,

How do you fix that?

Moondust
02-07-2010, 07:23 AM
I need the last 6 Pictures from ALL Pictures on my Forum.... and display it in the Forumhome under the Navbar.... please code this... many People miss this Addon :-)

Moondust
02-07-2010, 07:36 AM
Its not work in 4.0.1 ? Only the Date see, but not a Picture.

Juggernaut
02-07-2010, 07:45 AM
^^ It does work on 4.0.1, I have it in my forum, butthis is only for the homepage, it's not
for the navbar, you want New Album Picture Forum Home mod for that. :)

Moondust
02-07-2010, 03:37 PM
^^ It does work on 4.0.1, I have it in my forum, butthis is only for the homepage, it's not
for the navbar, you want New Album Picture Forum Home mod for that. :)

This Widget is for the CMS, really... but is not work... show only the Date from today.


I am search a Mod for all Pictures, not only the Album Pictures :-)

Juggernaut
02-07-2010, 04:18 PM
<i>^^ You have to make the template edit as swell, after you create the widget.
Yes a mod for all pictures would be great, and it would be awesome to have
a mod like that.</i>

Juggernaut
02-14-2010, 07:15 AM
So this mod won't be supported anymore by the developer?
Might as well delete it then. :(

svandanam
02-25-2010, 09:54 PM
How do you fix that?

I fixed it by changing the layout to 2 Column + Sidebar (33%,66%, 240px)

antua al toro
03-04-2010, 02:26 PM
does not work in 4.0.2.
but worked in 4.0.0 Gold

way2xtreme
03-13-2010, 06:55 AM
Hello,

Do you have a way for this to work in forum sidebar?

Thanks
WC

NNJJ
05-17-2010, 05:42 PM
any screen please?

Massamo
06-14-2010, 10:13 AM
been away sorry have a look at it now redo it for new version

abroad
10-22-2010, 04:34 PM
does not work for 4.08 :(

abroad
12-01-2010, 09:08 AM
this does not work anymore with vb 4.1.

Sean S
01-29-2011, 09:25 PM
Works like a charm on vB 4.1.1 based on the updated code. I don't have the CMS so I added this to my forum home's sidebar,

http://www.amgpower.com/forums/forum.php

Thanks :)

DirtRider
03-10-2011, 03:48 AM
I get the latest picture widget showing up but with nothing in it?

shadowbreed
08-25-2011, 02:13 AM
I had the empty widget issue as well, and fixed it by using the code in post 19 instead.

This is apparently not updated in the original post yet.

Thanks for the mod! :D

benative
08-30-2011, 08:21 PM
I had the empty widget issue as well, and fixed it by using the code in post 19 instead.

This is apparently not updated in the original post yet.

Thanks for the mod! :D

I did the same thing as you. but mine is little strange. when you click on the image it does not go to that album.. it just opens that image in a new window...

lazytown
01-25-2012, 04:35 AM
In my case, the thumbs shown are extremely WIDE and the photo-shadow outline is too small.

lazytown
01-25-2012, 02:14 PM
I fixed the width issue, but this widget is using the full-size images as thumbnails, thus causing a huge page load increase... It could just as easily use the actual thumbnails instead of shrinking full size images.

AlBundy
02-25-2014, 01:42 PM
Hi.
It run on vb 4, but i see only attachments, but not pictures from album :(
it should not show attachments, only pictures.

how can i change it?
thanks!