vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Graveyard (https://vborg.vbsupport.ru/forumdisplay.php?f=224)
-   -   Add-On Releases - vBulletin Raffles (https://vborg.vbsupport.ru/showthread.php?t=262901)

tommyxv 02-21-2012 06:53 AM

Quote:

Originally Posted by nhawk (Post 2226544)
AdminCP->vBulletin CMS->Widgets

Click the "Create New Widget" button.

Widget Type = PHP Direct Execution
Title = Current Raffles
Description = Current Raffle List

Click "Save"

Click "Configure"

Paste this code in the box that comes up..

Code:

global $vbulletin;

if ($vbulletin->options['raffle_mode'] && $vbulletin->options['raffle_showsidebar'] && !is_member_of($vbulletin->userinfo, explode(',', $vbulletin->options['raffle_perms'])))
{
        $timenow = TIMENOW;
        $raffle_getactive = $vbulletin->db->query_read_slave("SELECT * FROM " . TABLE_PREFIX . "raffle
                        WHERE enddate > $timenow AND startdate <= $timenow
                        ORDER BY id DESC
                        ");

        if ($vbulletin->db->num_rows($raffle_getactive))
        {
                while($raffle = $vbulletin->db->fetch_array($raffle_getactive))
                {
                        if (is_member_of($vbulletin->userinfo, explode(',', $raffle['groupperm'])))
                        {
                                if($raffle_list)
                                {
                                        $raffle_list .= '<br />';
                                }
                                $raffle_list .= '<a href="raffles.php?' . $session[sessionurl] . 'do=raffle&id=' . $raffle[id] . '" title="' . $raffle[name] . '" />' . $raffle[name] . '<br />';
                                if($raffle['showimage'])
                                {
                                        if(empty($raffle['prizeimg']))
                                        {
                                                $raffle['prizeimg'] =  'images/raffles/default.gif';
                                        }

                                        $target =  $vbulletin->options['raffle_sidebar_maxpicture'];
                                        $picturesize = getimagesize($raffle['prizeimg']);
                                        $percentage = ($target / $picturesize[0]);
                                        $picture_width = round($picturesize[0] * $percentage);
                                        $picture_height = round($picturesize[1] * $percentage);
                                        $raffle_list .= '<img class="display" src="' . $raffle['prizeimg'] . '" width="' . $picture_width . '" height="' . $picture_height . '" alt="' . $raffle['name'] . '" border="0" /></a><br />';
                                }
                        }
                }
        }

        unset($raffle_getactive);

        $output = $raffle_list;   
}

Click "Save"

Then add the widget to the layout manager.


Couple of questions...

1) How can I limit the number of raffles shown in the widget. Say I only want 4.
2) How can I have the output horizontal, say 4 across?

Thanks

nhawk 02-21-2012 10:29 AM

Quote:

Originally Posted by tommyxv (Post 2301835)
Couple of questions...

1) How can I limit the number of raffles shown in the widget. Say I only want 4.
2) How can I have the output horizontal, say 4 across?

Thanks

To limit the number of raffles in the widget, change this code...
Code:

$raffle_getactive = $vbulletin->db->query_read_slave("SELECT * FROM " . TABLE_PREFIX . "raffle
                        WHERE enddate > $timenow AND startdate <= $timenow
                        ORDER BY id DESC
                        ");


To this..
Code:

$raffle_getactive = $vbulletin->db->query_read_slave("SELECT * FROM " . TABLE_PREFIX . "raffle
                        WHERE enddate > $timenow AND startdate <= $timenow
                        ORDER BY id DESC
                        LIMIT 4
                        ");


So far as I know, widgets are only displayed vertically. But, you could try formatting it horizontally with a table to see if that works.

insidegames 02-21-2012 03:04 PM

I have installed this mod on vBulletin 4.1.10, but it always says "Sorry, there are no raffles in progress at this time!"

tommyxv 02-21-2012 03:25 PM

Quote:

Originally Posted by nhawk (Post 2301878)

So far as I know, widgets are only displayed vertically. But, you could try formatting it horizontally with a table to see if that works.

I was trying to see what it would look like having 4 raffle going left to right, Ill see what I can do. Thanks

nhawk 02-21-2012 05:05 PM

Quote:

Originally Posted by insidegames (Post 2301959)
I have installed this mod on vBulletin 4.1.10, but it always says "Sorry, there are no raffles in progress at this time!"

Either your usergroup doesn't have permission to enter the raffle or you've set the post count requirement higher than the number of posts you have, or you've set the start date later than today's date.

insidegames 02-21-2012 08:01 PM

Quote:

Originally Posted by nhawk (Post 2302001)
Either your usergroup doesn't have permission to enter the raffle or you've set the post count requirement higher than the number of posts you have, or you've set the start date later than today's date.

No, no i try it with differnts option and it works definelty not. would you like to take a look at my testforum?

nhawk 02-22-2012 08:41 AM

Quote:

Originally Posted by insidegames (Post 2302072)
No, no i try it with differnts option and it works definelty not. would you like to take a look at my testforum?

Sure. I'll have a look at it.

insidegames 02-22-2012 03:48 PM

i send you a message with details :)

fevredsuk 02-24-2012 10:52 PM

just upgrading forum to 4.1.10.

hope this still works lol

any update on the additions I asked about.

also I want another one lol, I would pay for it.

its a bit of a pain only admin being able to create raffles.

Would fantastic if members could create raffles.

I have a few reps on one of my forums, it would be great if i could give the reps usergroup permission to create raffles so the couls give away their products etc.

well worth 10-20 $$ lol like the post winers in athread addition

and saves me and other admin from creating raffles for people

nhawk 02-25-2012 06:25 AM

Quote:

Originally Posted by fevredsuk (Post 2303094)
just upgrading forum to 4.1.10.

hope this still works lol

any update on the additions I asked about.

also I want another one lol, I would pay for it.

its a bit of a pain only admin being able to create raffles.

Would fantastic if members could create raffles.

I have a few reps on one of my forums, it would be great if i could give the reps usergroup permission to create raffles so the couls give away their products etc.

well worth 10-20 $$ lol like the post winers in athread addition

and saves me and other admin from creating raffles for people

It still works with 4.1.10 without problems.

I haven't had the time to even consider your last request. I've been working on several mods for private clients. But the PM mode might be possible.

So far as people other than Admin making raffles, I'm not to keen on that one. Let me think about it.


All times are GMT. The time now is 12:19 AM.

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.01600 seconds
  • Memory Usage 1,759KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (7)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (2)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete