Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Latest Album Picture v2 Details »»
Latest Album Picture v2
Version: 0.3, by Massamo Massamo is offline
Developer Last Online: Apr 2022 Show Printable Version Email this Page

Category: vBulletin CMS Widgets - Version: 4.0.3 Rating:
Released: 12-13-2009 Last Update: Never Installs: 63
Template Edits
Re-useable Code Translations Is in Beta Stage  
No support by the author.

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
Code:
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
Code:
    <link rel="stylesheet" type="text/css" href="css.php?styleid=1&amp;langid=1&amp;d=1260794007&amp;td=ltr&amp;sheet=album.css" />

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

<div class="block" id="album">
    <ol id="thumbnails" class="blockbody floatcontainer">
        $albumpics
</ol>    
</div>
Title: cms_albums_albumsbits
Code:
<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

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #12  
Old 12-19-2009, 08:10 AM
merlin_de merlin_de is offline
 
Join Date: Aug 2005
Location: Duisburg,Germany
Posts: 32
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #13  
Old 12-19-2009, 08:16 AM
Allan's Avatar
Allan Allan is offline
 
Join Date: Jun 2003
Location: France
Posts: 1,513
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Do you have one screen please ?
Reply With Quote
  #14  
Old 12-19-2009, 08:28 AM
merlin_de merlin_de is offline
 
Join Date: Aug 2005
Location: Duisburg,Germany
Posts: 32
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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. Maybee this will help other users who have problems with this nice widget.
However, here my screenshot from a working hack



Greets,Micha
Reply With Quote
  #15  
Old 12-19-2009, 10:01 AM
abroad abroad is offline
 
Join Date: Mar 2007
Posts: 231
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

the pictures need to be larger...how is it possible to change it?
Reply With Quote
  #16  
Old 12-19-2009, 11:12 AM
woffie's Avatar
woffie woffie is offline
 
Join Date: Jan 2009
Location: Michigan
Posts: 264
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #17  
Old 12-19-2009, 11:43 AM
AWMGolfer AWMGolfer is offline
 
Join Date: Dec 2007
Posts: 120
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Is there a way this can work on the new forum sidebar?
Reply With Quote
  #18  
Old 12-19-2009, 09:28 PM
AndrewSpearin AndrewSpearin is offline
 
Join Date: Dec 2009
Location: Toronto
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for this, I was able to adapt it to suit a needed feature perfectly

http://npac.ca/2010
Reply With Quote
  #19  
Old 12-23-2009, 07:55 AM
abroad abroad is offline
 
Join Date: Mar 2007
Posts: 231
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #20  
Old 12-23-2009, 09:00 AM
Massamo Massamo is offline
 
Join Date: Nov 2009
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This will fix the problem updated first post too

Code:
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;
Reply With Quote
  #21  
Old 12-23-2009, 09:13 AM
abroad abroad is offline
 
Join Date: Mar 2007
Posts: 231
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks a lot!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:45 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04750 seconds
  • Memory Usage 2,322KB
  • Queries Executed 26 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (4)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete