vBulletin calendar on homepage

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • molleeb
    New Member
    • Oct 2007
    • 11
    • 3.6.x

    [CMS] vBulletin calendar on homepage

    Where is the widget code for the calendar than you have on the vBulletin 4 homepage? I'd love to add it to mine. Is it available?
  • Edwin Brown
    Former vBulletin Developer
    • Mar 2009
    • 1393
    • 5.5.x

    #2
    Have you read the documentation? The process for creating new widgets is explained. http://www.vbulletin.com/forum/content.php?151

    The CMS release calendar? admincp > vbulletin cms> widgets > create new widget , select CMS Published Calendar. Then admincp > vbulletin cms> layouts and drag it onto whatever layout you are using.
    Please- I'm not tech support. Don't send your problem reports to me unless I've asked you to.

    Comment

    • wonderfulwat
      New Member
      • Jun 2010
      • 28
      • 4.1.x

      #3
      Is there a way to create a widget on the Home Page for the forum calendar?

      I'm trying to get a small version of this to show up here.

      Thanks,
      www.WonderfulWaterloo.com

      Comment

      • PBPR
        Senior Member
        • May 2009
        • 214
        • 4.0.x

        #4
        I want to create a widget for the online users
        Vbulletin Rocks!!!
        What you do in life, echoes in eternity

        Comment

        • dholt
          Senior Member
          • Aug 2006
          • 128

          #5
          Originally posted by wonderfulwat
          Is there a way to create a widget on the Home Page for the forum calendar?

          I'm trying to get a small version of this to show up here.

          Thanks,

          Edwin Brown
          just Answered your question very simple

          Comment

          • dholt
            Senior Member
            • Aug 2006
            • 128

            #6
            Originally posted by PBPR
            I want to create a widget for the online users
            Vbulletin.org

            Comment

            • Edwin Brown
              Former vBulletin Developer
              • Mar 2009
              • 1393
              • 5.5.x

              #7
              If you're willing to live with a simple list of events, this will work. A couple of comments:

              • This is unsupported. Use at your own risk.
              • It assumes that the calendar is public. This bypasses the permissions checking.
              • This checks from the last 24 hours and some number of days (14 by default) into the future. You can chance "$daysforward" to a different value to get more or fewer.
              • I would set the widget configuration cache time to 0. The included code caches for a time of one hour.
              • $calendarid determines which calendar you get.Change that to whichever calendar you want.
              • $cache_ttl determines how often the data is updated. If you want changes to be immediate feel free to change it, BUT NOT TO zero! Keep it at least five (five minutes between updates.
              • Where the 'output .=' code is, if you know html, you could make the output a bit fancier if you like.

              To use this
              1. in admincp > vbulletin cms > widget manager create a PHP Direct Execution
              2. in admincp > vbulletin cms > widget manager configure it by pasting in the code below, and set a cache time of zero.
              3. in admincp > vbulletin cms > layout manager drop it onto your layout.



              PHP Code:
              $cache_ttl 60;
              $daysforward 14;
              $calendarid 1;

              $cachekey 'cmswidget_calendar_' $this->widget->getId() ;
              $events vB_Cache::instance()->read($cachekeyfalsetrue);
              $output '';
              if (!
              $events)
              {
                  
              $start TIMENOW 86400;
                  
              $end TIMENOW + ($daysforward 86400);
                  
              $sql "SELECT * FROM " TABLE_PREFIX "event WHERE
                  calendarid = 
              $calendarid AND dateline BETWEEN $start AND $end ORDER BY dateline";
                  
              $eventlist vB::$db->query_read($sql);
                  if (
              $eventlist)
                  {
                      while(
              $event vB::$db->fetch_array($eventlist))
                      {
                          
              $events[] = $event;
                      }
                  }
                  
              vB_Cache::instance()->write($cachekey,
                      
              $events$cache_ttl );
              }
              foreach (
              $events as $event)
              {
                      
              $output .= "<a href=\"" 'calendar.php?' $vbulletin->session->vars['sessionurl'] .
                          
              "do=getinfo&amp;e=" $event['eventid']. "\">" htmlspecialchars_uni($event['title']) .
                          
              '&nbsp;' vbdate(vB::$vbulletin->options['dateformat'], $event['dateline'])
                          .
              "</a><br />\n";
                  

              If anyone tries this I'd be interested in what you think.
              Please- I'm not tech support. Don't send your problem reports to me unless I've asked you to.

              Comment

              • Dreadan
                New Member
                • Oct 2010
                • 2
                • 4.0.x

                #8
                It doesn't seem to be picking up reoccurring events.

                I just noticed I'm getting an error with it.

                Warning: Invalid argument supplied for foreach() in [path]/packages/vbcms/widget/execphp
                Last edited by Dreadan; Mon 1 Nov '10, 2:32pm.

                Comment

                • Anders P
                  Senior Member
                  • Feb 2002
                  • 512

                  #9
                  Originally posted by Edwin Brown
                  If anyone tries this I'd be interested in what you think.
                  I would really like to have something like this to work.
                  Ayway, I tried on a test site (localhost) and if the calender is emtyp I get some sort of error message, then I added to events (one day events) one a mont from now and one some years from now. they both showed up in the widget but had todays date next to them. ??

                  I hope this will be a standard thing soon. We have the opportunity to show upcoming events in the Whats going on area on forum home page, but having this in a widget in the cms is really needed.

                  /Anders
                  Anders Pettersson
                  Don't send me requests by PM to email you the Swedish language file that I have done. My translation is only available here at vbulletin.com to licensed users.
                  If you want updates on when a new version of the Swedish language packs (forum & suite) are available, subscribe to this discussion.
                  Don't PM me for support on how to install language files etc. please post in the appropriate forum, that will most likely give you help quicker.

                  Comment

                  • Top Dogs 360
                    New Member
                    • Jul 2010
                    • 4
                    • 4.0.x

                    #10
                    above php code does not work, gives error on line 25 code. Really would love the wgo upcoming events for cms page. the one everyone keeps linking to .org does not work as it does not show the events on the current day they are running.

                    Comment

                    • hyppa
                      Senior Member
                      • Dec 2007
                      • 164
                      • 4.2.X

                      #11
                      I have just upgraded, but still can not find CMS in my admin controlpanel?

                      Comment

                      widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                      Working...