PDA

View Full Version : Social Group and Album Enhancements - Social Group Calendars


Farcaster
03-06-2010, 10:00 PM
In short, this modification will allow social groups on your forum have their own calendar area and have upcoming events shown on their group page. Here is a list of features:
Upcoming events for a group are shown on the group's page, grouped by day.
The group's next event is shown in more detail and can be configured to show the entire event description or be trimmed to a certain number of characters.
Members can see events for all the social groups they belong to consolidated into one calendar.
The forum home index page can be setup to show upcoming events for social groups.
Non-members can see upcoming events for a public group by viewing the group's page if the group doesn't require joining to view content. They will not see events for these groups in the calendar view or on the forum homepage, which will help keep the clutter down.
Group's that are moderated, invite only, or must join to view content, will not display their upcoming events to non-members. Their events are also secured, so following a link to an event by a non-member will result in a no permissions error.
Group owners can optionally allow members to be able to post events, or they can set their group up so that only they can post events.
When clicking on the New Event link from the group's page, the event will automatically be assigned to the referring group.
When creating a new event from the calendar view, the creator can assign the event to any group he has permissions to post events. These events will appear in a drop down box on the event.
Admins and moderators can be set to be excluded from all filtering and permissions. This allows the administrator an unfiltered view of the social group calendar, and the ability to move or edit group's events as needed.
Plays nice with Farcaster's Event Attendance v3.0 (RSVP mod).Installation Instructions (Remember to Mark Installed)
Follow the installation instructions available here: 1999324

Revision Log
0.1.0 BETA - 01/28/09 - Initial Version
1.0.0 - 04/05/09 - Bug Fixes and Release
2.0 - 03/07/10 - Updated to work with vb4.
Known Issues
None at this time.

Farcaster
03-07-2010, 07:20 PM
Unfortunately, vBulletin lacks some hooks in key places for events, such as hooks to the event SQL statements. This means that there are a number of file edits needed for this modification. Sorry for that, but I hope it will be worth it! Enjoy!

Step One ? Backup Your Database and vBulletin Files!
This really needs to be said, especially since this version is in BETA. Loss of data/time/business is not the responsibility of the developer. Use at your own risk.

Step Two ? Import the Product File
In the Admin CP, import rah_socialgroup_calendars.xml.

Step Three ? Edit vBulletin File: includes/functions_calendar.php
Note: If you do not want to have Social Group Events show up in the upcoming events section on your forum homepage, then you only need do steps 1 through 7 in this section.

1. Find the first instance of (in function cache_events, near the beginning of the file):

$events = $vbulletin->db->query_read_slave("
SELECT event.*,2. Above that add:

// Social Group Calendar **************************************************

// Exempt administrators and other designated groups.
$exemptgroups = explode(',',str_replace(' ','',$vbulletin->options['rah_socialcal_admins']));

if (is_member_of($vbulletin->userinfo,$exemptgroups)) {
$exemptsql = " OR 1=1 ";
}
if ($vbulletin->userinfo['userid']) {
$eventjoin = " LEFT JOIN ".TABLE_PREFIX."socialgroupmember sgm ON sgm.userid = 0".$vbulletin->userinfo['userid']." AND sgm.groupid = event.socialgroupcalendar
LEFT JOIN (SELECT groupid, name FROM ".TABLE_PREFIX."socialgroup) sg ON sg.groupid = event.socialgroupcalendar";
$eventwhere = " AND (event.socialgroupcalendar = 0 OR sgm.groupid IS NOT NULL $exemptsql) ";
$eventselect = " sg.name as socialgroupname, ";
}

// Social Group Calendar END ***********************************************
3. Scroll back down and after the comma in ?SELECT event.*,? add:

$eventselect4. Scroll down about five lines to find:
LEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = event.userid)5. Below that add:
$eventjoin6. Scroll down about four lines to find:
visible = 17. Below that add:
$eventwhere8. Find the following (in function build_events, near the end of the file):

$events = $vbulletin->db->query_read_slave("
SELECT eventid, userid, event.title, recurring, recuroption, dateline_from, dateline_to, event.calendarid, IF (dateline_to = 0, 1, 0) AS singleday, customfields,
dateline_from AS dateline_from_user, dateline_to AS dateline_to_user, utc, dst
9. Above that add:
// Social Group Calendar **************************************************
$eventjoin = " LEFT JOIN (SELECT groupid, name FROM ".TABLE_PREFIX."socialgroup) sg ON sg.groupid = event.socialgroupcalendar ";
$eventselect = ", event.socialgroupcalendar, sg.name as socialgroupname ";
// Social Group Calendar END ***********************************************10. After ?dateline_to AS dateline_to_user, utc, dst?, add:
$eventselect11. Scroll down about two lines and find:
INNER JOIN " . TABLE_PREFIX . "calendar AS calendar USING (calendarid)12. Below that add:
$eventjoinStep Four ? Edit vBulletin File: forum.php
Note: If you do not want to have Social Group Events show up in the upcoming events section on your forum homepage, you can skip this section entirely. Keep in mind though that if you do have your calendar options set to show events from the calendar that social group events will be posted to, the list will not be filtered and everyone will see them.

1. Find the following:
// ### TODAY'S EVENTS #################################################
if ($vbulletin->options['showevents'])
{2. Below that add:
// Social Group Calendar **************************************************
// Get Social Group Memberships
$usersocialgroups = array();
if ($vbulletin->userinfo['userid']) {

$getsocialgroups = $vbulletin->db->query_read_slave("
SELECT groupid
FROM ".TABLE_PREFIX."socialgroupmember sgm
WHERE sgm.userid = ".intval($vbulletin->userinfo['userid']));

while ($group = $vbulletin->db->fetch_array($getsocialgroups)) {
$usersocialgroups[]=$group['groupid'];

}
}

// Exempt administrators and other designated groups.
$exemptgroups = explode(',',str_replace(' ','',$vbulletin->options['rah_socialcal_admins']));

if (is_member_of($vbulletin->userinfo,$exemptgroups)) {
$exempt = true;
}
// Social Group Calendar END ***********************************************
3. Find the following:
{
$sub = $eventinfo['dateline_from_user'] - (86400 * (intval($eventinfo['dateline_from_user'] / 86400)));
}
4. Below that add:
// Social Group Calendar **********************************************
$filterevent = false;
if ($eventinfo['socialgroupcalendar'] AND !in_array($eventinfo['socialgroupcalendar'],$usersocialgroups)) {
// This is a social group event, and this is not a member. Suppress the event
$filterevent = true;
}

// Add exception for admins and other designated groups.
if ($exempt) {
$filterevent = false;
}

// Add social group name to event title.
if ($eventinfo['socialgroupcalendar']) {
$eventstore[$eventinfo[eventid]]['title'] = "<font style=\"font-weight:bold\">[$eventinfo[socialgroupname]]</font> $eventinfo[title]";
}
// Social Group Calendar END *******************************************
5. Immediately below the code you just entered, find:
if ($vbulletin->userinfo['calendarpermissions']["$eventinfo[calendarid]"] & $vbulletin->bf_ugp_calendarpermissions['canviewcalendar'] OR ($eventinfo['holidayid'] AND $vbulletin->options['showholidays']))
{
6. Replace with:
// Edited from original for Social Group Calendar
if (!$filterevent AND $vbulletin->userinfo['calendarpermissions']["$eventinfo[calendarid]"] & $vbulletin->bf_ugp_calendarpermissions['canviewcalendar'] OR ($eventinfo['holidayid'] AND $vbulletin->options['showholidays']))
{Step Five ? Upload Files
Upload the modified files to the appropriate directory in your forum.

Step Six ? Edit Template: socialgroups_form
1. Find the following:
<vb:if condition="$show['enable_group_messages']">
<li>
<label for="enable_group_messages">
<input type="checkbox" name="options[enable_group_messages]" id="enable_group_messages" value="1" {vb:raw checked.enable_group_messages} tabindex="1" />
{vb:rawphrase enable_messages}
</label>
</li>
</vb:if>
2. Below that add:
<li>
<label for="member_entered_events">
<input type="checkbox" name="member_entered_events" id="member_entered_events" value="1" {vb:raw checked.member_entered_events} />
{vb:rawphrase member_entered_events}
</label>
</li>Step Seven ? Edit Template: socialgroups_group

Note: You can adjust the placement of the event block to your liking by changing the positioning in the socialgroups_group template.
1. Find the following:
</vb:if><vb:comment>$show['groupinfo']</vb:comment>2. Above that add:
<br/>{vb:raw socialgroups_events}<br/>


Step Eight ? Edit Template: calendar_edit
1. Find the following:
<h2 class="blockhead">{vb:raw pagetitle}</h2>
<div class="blockbody formcontrols">{

2. Below that add:
{vb:raw socialgroup_dropdown}


Step Nine? Configuration
In the Admin CP, go into vBulletin Options -> Social Group Calendar. Set the options as desired. The product will not start working until a calendar ID is entered in this section. Make sure to configure the calendar selected to allow members to post events.

cindy helmond
03-07-2010, 08:34 PM
wow thx we needed this for the normal calender !!
Can you fix that ?

Farcaster
03-08-2010, 02:29 AM
wow thx we needed this for the normal calender !!
Can you fix that ?

Cindy, what do you mean? What this mod does is provide a cross over from the calendar into social groups.

cindy helmond
03-08-2010, 08:36 AM
Cindy, what do you mean? What this mod does is provide a cross over from the calendar into social groups.

o ok i mean if i dont have an social group i can use this for my default calendar ?
thx

Farcaster
03-08-2010, 03:13 PM
Cindy,

This doesn't add any functionality to the calendar other than the tie in with social groups, so no, if your site doesn't use social groups, this mod will not do anything for you.

DivineMessenger
03-11-2010, 03:41 AM
This hack doesn't show events on the main calendar unless the member is in the group in which the event is for, correct? Is there a way to make it so everyone can see the event regardless of if they are in the group or not on the main calendar?

Farcaster
03-14-2010, 02:55 AM
Is there a way to make it so everyone can see the event regardless of if they are in the group or not on the main calendar?

It is possible, but it isn't a feature of the modification at this point.

ScottiG
03-20-2010, 04:27 AM
Will this work with vb 3.8.4? Or do you have a version that does? I have installed your RSVP system on 3.8.4 and it works well, but I am hoping to add calendar functionality to social groups AND the RSVP system, THAT would work VERY well on our forum!

alessai
03-26-2010, 04:41 PM
Installed,

Verionia
04-05-2010, 05:04 AM
Can I get a screenshot?

chri55555
05-11-2010, 08:29 PM
Hi,

in my groups I get the Message "This group currently has no upcoming events within the next 15 days."

Where do I have to edit to change that period?

It would be nice to have it variable on a per-group basis. As we have some groups with a lot of events, there the 15 days is fine. then there are others with very few ones where I would like to increase it to 3-6 months ..

great mod so ... thx

cad2go
09-12-2010, 11:38 AM
Hi,

in my groups I get the Message "This group currently has no upcoming events within the next 15 days."

Where do I have to edit to change that period?

It would be nice to have it variable on a per-group basis. As we have some groups with a lot of events, there the 15 days is fine. then there are others with very few ones where I would like to increase it to 3-6 months ..

great mod so ... thx

I'd guess it's based on the number in admincp>Forums Home Page Options>Display Calendar Events

unknown22
09-26-2010, 09:16 PM
How Can I add upcoming events in the next 30 days under forum here's a picture, so the events would be posted onto a forum board and like this.

https://vborg.vbsupport.ru/

Phototrope
11-12-2010, 02:50 PM
Erm, wow. Seems like exactly what I was looking for.
Tagged and can't wait to install.

TRS_Chris
01-12-2011, 10:17 PM
If you don't want invite only events showing up in forums (they already are hidden in calendar) this is a quick mod I made.

Note on one problem: The count for this forum will be off. There's no way I've found to get around it - hook_query_where won't work with COUNT(*) since it's joining tables.

Disclaimer: This has only been tested on vb 4.1

Hook: forumdisplay_query_threadid


global $vbulletin;

$hook_query_fields = ", socialgroup.groupid, socialgroup.type AS grouptype" . ($vbulletin->userinfo['userid'] ? ", socialgroupmember.type AS membertype" : "");

$hook_query_joins = "LEFT JOIN " . TABLE_PREFIX . "event AS event ON event.lv_vb_eventforums_threadid=thread.threadid LEFT JOIN " . TABLE_PREFIX . "socialgroup AS socialgroup ON socialgroup.groupid=event.socialgroupcalendar
LEFT JOIN " . TABLE_PREFIX . "socialgroupmember AS socialgroupmember ON (socialgroupmember.userid = " . $vbulletin->userinfo['userid'] . " AND socialgroupmember.groupid = socialgroup.groupid)";

$hook_query_where = " AND (socialgroupmember.type='member' OR socialgroup.type!='inviteonly' OR ISNULL( socialgroup.groupid) )";

$visiblethreads = str_replace(" AND visible", " AND thread.visible", $visiblethreads);

ivang
04-02-2011, 06:33 AM
Does it works with 4.1.2?

arekieh
05-30-2011, 01:18 AM
Hi,
Is it possible to add the functionality to vote on events? Ie what time to have a certain event at?
Thanks

yahooooh
07-19-2011, 10:05 PM
can any one confirm if this addon worked perfect in vb 4.1.4+

starman?
08-10-2011, 03:28 PM
Working on 4.1.5

mrt12345
09-04-2011, 04:09 PM
i have tis error would anybody have any ideas ?

Database error in vBulletin 4.1.5:

Invalid SQL:

SELECT event. sg.name as socialgroupname, *,
user.username, IF(user.displaygroupid = 0, user.usergroupid, user.displaygroupid) AS displaygroupid,
user.adminoptions, user.usergroupid, user.usertitle, user.membergroupids, user.infractiongroupids, IF(options & 8192, 1, 0) AS hasaccessmask,
IF(dateline_to = 0, 1, 0) AS singleday
, subscribeevent.eventid AS subscribed
,avatar.avatarpath, NOT ISNULL(customavatar.userid) AS hascustomavatar, customavatar.dateline AS avatardateline,
customavatar.width AS avwidth,customavatar.height AS avheight, customavatar.width_thumb AS avwidth_thumb, user.avatarrevision,
customavatar.height_thumb AS avheight_thumb, customavatar.filedata_thumb, NOT ISNULL(customavatar.userid) AS hascustom
FROM vb_event AS event
LEFT JOIN vb_user AS user ON (user.userid = event.userid)
LEFT JOIN vb_socialgroupmember sgm ON sgm.userid = 01 AND sgm.groupid = event.socialgroupcalendar
LEFT JOIN (SELECT groupid, name FROM vb_socialgroup) sg ON sg.groupid = event.socialgroupcalendar
LEFT JOIN vb_subscribeevent AS subscribeevent ON (subscribeevent.eventid = event.eventid AND subscribeevent.userid = 1)
LEFT JOIN vb_avatar AS avatar ON(avatar.avatarid = user.avatarid) LEFT JOIN vb_customavatar AS customavatar ON(customavatar.userid = user.userid)
WHERE calendarid = 1 AND
((dateline_to >= 1312113600 AND dateline_from < 1320148800) OR (dateline_to = 0 AND dateline_from >= 1312113600 AND dateline_from <= 1320148800 )) AND
event.visible = 1
AND (event.socialgroupcalendar = 0 OR sgm.groupid IS NOT NULL OR 1=1 )
ORDER BY dateline_from;

MySQL Error : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '*,
user.username, IF(user.displaygroupid = 0, user.usergroupid, user.displaygr' at line 1
Error Number : 1064

mmoore5553
11-01-2011, 03:55 PM
I have this on 4.1.7 and it says no calendar specified. I am unsure where to go to fix this. I have added a calendar but not sure how to associate it to the group

mmoore5553
11-20-2011, 01:23 AM
I have found one issue that I am administrator I can not click add event from inside the group it says i do not have permission. But if i go to calendar I can edit and add events.

mmoore5553
11-21-2011, 11:22 PM
Developer...I have emailed you and wrote to see if you can help. I have problem with it and need help. I installed and gives error. Please let me know . I am willing to pay.

steve k.
02-08-2012, 10:07 PM
Installed on 4.1.10. Works great. I think. I am still in process of building my alpha forum, but all looks good with one group. I found in the xml where to change the color of teh calendar icon on the groups page. Is there a way ti set that to use a stylevar?

Also, is the a way to make the events section on the group page to have the same look and feel as the "Group Photos" section?

my current example http://alpha.bmw2002faq.com/group.php?groupid=1

thanks,
steve k

Morrus
02-21-2012, 06:27 PM
Dunno what I'm doing wrong, but I'm trying to add this to a clean vB4 install and it's not working. Calendar.php won't load at all.

Maybe my code editing skills are weak (I've tried a half dozen times now). Anyone got copies of the correctly edited files and templates I could just use as-is, since it's a clean vB4 install?

(Edit - ah, I see the developer hasn't posted to this thread in nearly 2 years.)

ywwz
03-12-2012, 02:43 AM
tooooo many editing...

ywwz
03-12-2012, 02:55 PM
Calendar
Set this to the calendar ID that social group events should be saved in.
Social Group Members will still need to be in a user group that has access to the calendar to be able to view event details or add events, so be sure to setup the desired security
(It is planned in the future to allow more than one calendar to be configured for Social Group Events)

what number should i give this ID?

ywwz
03-12-2012, 03:24 PM
installed anyway, very good!!! cool mod!

popmyzit
06-01-2012, 03:05 AM
tried on VB 4.2 can't get to work. Getting php error:

Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: socialgroups_events in [path]/includes/functions.php on line 4734

fxdigi-cash
06-15-2013, 02:01 AM
any update for this great mod???

Toorak Times
06-30-2013, 11:57 AM
Farcaster,

I see you've been here recently, your insights into developing these Calendar mods is some of the most important work I've found on vB.org.

I, unlike most here am pushing the limits of the CMS as native as possible using lots of great mods and NOT using my forums in the traditional manner, more for their RSS abilties to feed my CMS widgets.

This is connected to your other mod and another fantastic mod that creates forum posts parallel to the calendars but it is not 4.2.1 ready either...

If I can help fund this and future calendar mods I would love to help and I'm sure many others would.

There also seems a tendency for smaller mod builders to license their work to the bigger ops...this is a goer...

xTu
07-19-2013, 11:36 PM
Update would be nice....

Toorak Times
07-20-2013, 12:11 PM
Update would be nice....

Farcaster, you seem to have your head around this stuff like no other, we NEED these calendar enhancements. What do I need to do to activate your interest again?

xxdestinyxx
03-07-2014, 05:40 PM
Is anyone else around who is active and can help me with this?

Admins can post events without an issue, but a nonadmin gets this error on the top of their page

Warning: Invalid argument supplied for foreach() in [path]/calendar.php(2164) : eval()'d code on line 67

And the dates don't appear properly for her to add anything to the calendar. Her screenshot is here:

http://tinypic.com/r/y07sw/8

EDIT: This seems to be affecting her only, but it's weird because it has an error at the top of the page for her. I checked other accounts (same usergroups as her!) and she is the only one having this problem.

EDIT 2: We also have a member getting emails anytime a new event is posted in her group. I don't see how to disable this. - This was fixed by subscribing and choosing control panel. By not subscribing it was just emailing anyway.

daviex2259
08-26-2014, 12:52 PM
Awesome sounding mod, but I have had a number of problems getting it to work with 4.2.2. I assume it's not compatible?