View Full Version : [Module] Announcements
Tom M
01-28-2006, 08:20 PM
dude seriously, I didn't even realize you could upload this stuff like that. I haven't had one module like thatIt really beats doing it the old way by creating things separately. Anything with a .module extension is pretty much plug'n play and makes life easy as it normally contains everythig needed to create a working module. It's a variation on the vb product/plugin concept and all the stuff I do for vBa 2 is built that way.
konceptz
01-31-2006, 10:26 PM
I can't see my announcement on the forum home... I see the other modules but not the announcement one, what's wrong?
Tom M
02-01-2006, 12:10 AM
I can't see my announcement on the forum home... I see the other modules but not the announcement one, what's wrong?Do the announcements show up on the forumhome page? If there are no announcements to be displayed the module doesn't appear.
konceptz
02-02-2006, 06:04 PM
The announcement doesn't apear on the front page of my site home... In the ACP however I can see the module there!
Tom M
02-02-2006, 06:44 PM
The announcement doesn't apear on the front page of my site home... In the ACP however I can see the module there!Does the announcement show on the FORUMHOME page (that's the one with the forum categories listed)? If not then it won't display on the CMPS page either. If it does appear on the fourm page then double check all the settings for the module.
Scott_H
02-07-2006, 04:14 AM
If it doesn't show up and the announcement does show up on FORUMHOME then something needs to be set up. One of several things could be wrong, including;
1. The module isn't marked as 'Active'.
2. It hasn't been selected to show on the page.
3. The date on the announcement isn't 'current'.
4. It hasn't been set to display Global announcements.
5. The forum the announcement is tied to hasn't been selected.
Finally found the trick, didn't read about number "2" in the install file. Went to the edit page section an there it was unchecked. Works fine now. Thanks
puertoblack2003
03-04-2006, 09:01 PM
installed it and working well with the lastest version of vb and portal...:)
also guys i had the problem everyone was having about the annoucement not poping up i did a test annoucement and after that test i was able to view annoucement..
it paid to read...:D
puertoblack2003
03-11-2006, 04:30 PM
i got this error when upload module
Database error in vBulletin 3.5.4:
Invalid SQL:
INSERT INTO phrase (languageid, varname, text, phrasetypeid) VALUES (0, 'setting_portal_ann_forumid_title', 'Announcement Forum ID', 5000);
MySQL Error : Duplicate entry 'setting_portal_ann_forumid_title-0-5000' for key 2
Error Number : 1062
Date : Saturday, March 11th 2006 @ 12:19:34 PM
Script : http://www.puertotech.com/admincp/vba_cmps_admin.php
Referrer : http://www.puertotech.com/admincp/vba_cmps_admin.php?do=download
IP Address : xxxxx.xxx.xxxxx
Username : puertoblack2003
Classname : vb_database
how can i fix error?
Tom M
03-11-2006, 05:27 PM
i got this error when upload module
Database error in vBulletin 3.5.4:
Invalid SQL:
INSERT INTO phrase (languageid, varname, text, phrasetypeid) VALUES (0, 'setting_portal_ann_forumid_title', 'Announcement Forum ID', 5000);
MySQL Error : Duplicate entry 'setting_portal_ann_forumid_title-0-5000' for key 2
Error Number : 1062
Date : Saturday, March 11th 2006 @ 12:19:34 PM
Script : http://www.puertotech.com/admincp/vba_cmps_admin.php
Referrer : http://www.puertotech.com/admincp/vba_cmps_admin.php?do=download
IP Address : xxxxx.xxx.xxxxx
Username : puertoblack2003
Classname : vb_database
how can i fix error?
Did you delete the module that you had working? The only way to get this error is to try and reload the module - which shouldn't be necessary if it was working. If it was deleted and you are trying to reinstall it then it's necessary to go in and manually delete the information from the db (this seems to be a bug in vBa).
puertoblack2003
03-11-2006, 05:40 PM
Did you delete the module that you had working? The only way to get this error is to try and reload the module - which shouldn't be necessary if it was working. If it was deleted and you are trying to reinstall it then it's necessary to go in and manually delete the information from the db (this seems to be a bug in vBa).
yes that did happen i was having problem with the portal bbcode and images after the upgrade so i uninstalled the portal and installed everything back but when i was adding the module back that's when i received that error i tried everything and i was in my phpsql but because i didn't know what to delete manuelly i left it alone actually i was scare and didn't want to mess up my database if you tell me what to look for i'll do it then.
Thank you for your quick response
Tom M
03-11-2006, 05:52 PM
yes that did happen i was having problem with the portal bbcode and images after the upgrade so i uninstalled the portal and installed everything back but when i was adding the module back that's when i received that error i tried everything and i was in my phpsql but because i didn't know what to delete manuelly i left it alone actually i was scare and didn't want to mess up my database if you tell me what to look for i'll do it then.
Thank you for your quick response
If you search phrases for things that are like '_portal_ann_' you can just delete them and you should be good to go.
puertoblack2003
03-11-2006, 06:41 PM
If you search phrases for things that are like '_portal_ann_' you can just delete them and you should be good to go.
sorry still no luck , because it's showing other part of annoucememt that i have install for the board nothing showing for the portal part is there a query to run to drop table just for that particular hack and not the other annoucement i have installed thanks
Tom M
03-11-2006, 06:54 PM
sorry still no luck , because it's showing other part of annoucememt that i have install for the board nothing showing for the portal part is there a query to run to drop table just for that particular hack and not the other annoucement i have installed thanks
You can drop them using phpMyAdmin. If you'd like me to do it for you send me a PM with the login access for you Cpanel.
puertoblack2003
03-11-2006, 07:13 PM
You can drop them using phpMyAdmin. If you'd like me to do it for you send me a PM with the login access for you Cpanel.
pm sent thank you.
centralp
06-13-2006, 11:36 AM
I downloaded the module. After installation, I found the following system error. Can anyone tell me what the problem is..."Fatal error: Call to a member function on a non-object in /home/centralp/public_html/forums/modules/announcements.php on line 44"
Thanks in advance.
Tom M
06-13-2006, 12:52 PM
I downloaded the module. After installation, I found the following system error. Can anyone tell me what the problem is..."Fatal error: Call to a member function on a non-object in /home/centralp/public_html/forums/modules/announcements.php on line 44"
Thanks in advance.Please post the section of code that has line 44 in it as in my version of the file there are no function calls on line 44. Perhaps you installed a different version?
centralp
06-13-2006, 01:56 PM
The file is posted on one of the treads http://www.vbadvanced.com/forum/showthread.php?p=88139#post88139
I will paste the instructions later when I am back in the office. Thanks very much![/I]
centralp
06-13-2006, 02:00 PM
Beginning of line 44....
$announcements = $DB_site->query("
SELECT
announcementid, startdate, title, announcement.views, forumid, enddate, pagetext, allowhtml, allowbbcode, allowsmilies,
user.username, user.userid, user.usertitle, user.customtitle
FROM " . TABLE_PREFIX . "announcement AS announcement
LEFT JOIN " . TABLE_PREFIX . "user AS user ON(user.userid = announcement.userid)
WHERE startdate <= " . (TIMENOW - $vboptions['hourdiff']) . "
AND enddate >= " . (TIMENOW - $vboptions['hourdiff']) . "
AND $sqltext
ORDER BY startdate DESC
$limit");
Tom M
06-13-2006, 02:09 PM
If that's your line 44 then the it looks like it wasn't installed properly.
Did you use ACP -> vBa CMPS -> Download / Upload Module to install the announcements.module file or did you simply copy the file to the modules directory?
GearTripper
06-21-2006, 04:17 PM
I installed ...no problem, but the link shows "Invalid Forum specified. If you followed a valid link, please notify the administrator"
Oops. Change the adv_portal_announcement template to point to a forumid that you actually have as it's presently hardcoded to 'f=1'. That should take care of it for you until I fix it in a future release.
i've just installed the most recent module available with the above error still present; just an FYI - thnx for a great module!
Tom M
06-21-2006, 04:20 PM
i've just installed the most recent module available with the above error still present; just an FYI - thnx for a great module!All you should need to do is modify the forumid specified in the php file to one that is valid.
GearTripper
06-21-2006, 04:26 PM
All you should need to do is modify the forumid specified in the php file to one that is valid.
i know, it was an easy fix (thnx). i just wasn't sure if you still knew about it or not. works perfectly on my vB 3.5.3 (patched) & vBA 2.1.0 - thnx again.
GearTripper
06-22-2006, 03:59 PM
question...
perhaps i'm just a bit tired, but what in the following announcement would be screwing up this module's display?
Just a few things...
For privacy reasons, we have removed all previous DONOR icons from our forums. If you would like your icon reinstated, please let us know via the Contact Us (http://mydomain.com/forums/sendmessage.php) form. We'll be happy to take care of that for you.
Please note that any donations made as of this post will result in the public display of your Donor Status. Within your UserCP's Privacy Options (http://mydomain.com/forums/profile.php?do=editoptions), you are able to disable this option.
please see attached...
Tom M
06-22-2006, 04:03 PM
Link? Which browser? What's the generated HTML look like?
GearTripper
06-22-2006, 04:13 PM
IE - here's the relevant generated html (link is not necessary);
<table align="center" border="0" cellpadding="6" cellspacing="1" class="tborder" width="100%">
<thead>
<tr>
<td class="tcat" colspan="2">
<a href="#top" onclick="return toggle_collapse('module_16')" style="float:right"><img alt="" border="0" id="collapseimg_module_16" src="http://mydomain.com/forums/army/buttons/collapse_tcat.gif" /></a>
<span class="smallfont"><strong>» Announcements</strong></span></td>
</tr>
</thead>
<tbody id="collapseobj_module_16" style="">
<tr>
<td class="alt2">
<div>
<span class="smallfont" style="float:left"><img src="http://mydomain.com/forums/army/statusicon/announcement_new.gif" border="0" alt="Announcement" /> </span>
</div>
<div>
<span class="smallfont" style="float:right"><strong>05-31-2006</strong> to <strong>12-31-2019</strong></span>
<strong><a href="http://mydomain.com/forums/announcement.php?f=79&announcementid=1" title="Click here to read entire announcement...">Attention all donors...</a></strong>
</div>
</td>
</tr>
<tr> <td class="alt1">
Just a few things...<ul><li>For privacy reasons, we have removed all previous <b>DONOR</b> icons from our forums. If you would like your icon reinstated, please let us know via the <a href="http://mydomain.com/forums/sendmessage.php" target="_blank">Contact Us</a> form. We'll be happy to take care of that for you.</li><li>Please note that any donations made as of this post will result in the public display of your Donor Status. Within your UserCP's <a href="http://mydomain.com/forums/profile.php...
</td>
</tr>
</tbody>
</table>
<div><img src="http://mydomain.com/forums/clear.gif" height="15" alt="" /></div>
GearTripper
06-22-2006, 04:16 PM
it appears as though that if the text size restriction cut's off in the middle of any html code, the module will corrupt. say for example if i have my settings to display 250 characters, but the html link is the 255th character... is there any way to push that, or not count html?
UserCP's <a href="http://mydomain.com/forums/profile.php...
</td>
</tr>
</tbody>
</table>
<div><img src="http://mydomain.com/forums/clear.gif" height="15" alt="" /></div>
Tom M
06-22-2006, 04:16 PM
IE - here's the relevant generated html (link is not necessary);Actually, a link is helpful as I like to check it in both FF and IE. If it's not a public link you can alsways send it via PM.
Tom M
06-22-2006, 04:22 PM
it appears as though that if the text size restriction cut's off in the middle of any html code, the module will corrupt. say for example if i have my settings to display 250 characters, but the html link is the 255th character... is there any way to push that, or not count html?The simplest solution is to increase the value to something greater than the total number of character if you will be dealing with html. Anything else takes a code change.
GearTripper
06-22-2006, 04:31 PM
i went ahead and adjusted my character limit. may i recommend at least one code change/addition... in addition to the maxcharacters code:
$mod_options['portal_ann_maxcharacters'])."...";
some added text with a link to the announcement similar to the title be added to the end, such as "... (more)" where more is hyperlinked. does that make sense?
anders
07-27-2006, 12:50 PM
received the following error:
mySQL Error : Unknown column 'allowhtml' in 'field list'
any ideas?
Tom M
07-27-2006, 01:49 PM
Which version of vb are you installing on?
anders
07-28-2006, 09:20 AM
Which version of vb are you installing on?
at the moment 3.6.0 Release Candidate 2 is this the issue? possible coding differences?
Tom M
07-28-2006, 12:33 PM
at the moment 3.6.0 Release Candidate 2 is this the issue? possible coding differences?Yup. The module was designed for 3.5.x so I'm not surprised that it has problems with the new release. It could be as simple as renaming an entry but since I don't have 3.6 installed I don't really have any way to verify what needs to be modified.
Kathy
07-29-2006, 11:15 PM
What I am finding is that the module creates announcements.php and when you create an announcment in the adminCP, the file is announcment.php. So it won't show up on the CMPS page if the file name is incorrect...
but feel free to correct me if I'm wrong. :P
Tom M
07-29-2006, 11:55 PM
What I am finding is that the module creates announcements.php and when you create an announcement in the adminCP, the file is announcment.php. So it won't show up on the CMPS page if the file name is incorrect...
but feel free to correct me if I'm wrong. :PYou are right about the file name differences but not on how it works. :rolleyes:
If you have the announcements module enabled and set to display then the file announcements.php is run from CMPS when the page displays. This file retrieves the vb announcements and then displays them on the CMPS page. The file announcement.php located in the vb forum directory has nothing to do with the file named announcements.php in the modules directory other than being similar in name. :D
Kathy
07-30-2006, 12:39 AM
You are right about the file name differences but not on how it works. :rolleyes:
If you have the announcements module enabled and set to display then the file announcements.php is run from CMPS when the page displays. This file retrieves the vb announcements and then displays them on the CMPS page. The file announcement.php located in the vb forum directory has nothing to do with the file named announcements.php in the modules directory other than being similar in name. :D
Ok, but my announcements do not show up what so ever...guess I am not clever enough, but I'm a noob as well.
Did all the steps over and over...still, no announcements...running vb 3.5.4 and cmps 2.0. I have tried and tried...I have an announcement in my forums...but no show on the cmps index page :(
Tom M
07-30-2006, 01:12 AM
Ok, but my announcements do not show up what so ever...guess I am not clever enough, but I'm a noob as well.
Did all the steps over and over...still, no announcements...running vb 3.5.4 and cmps 2.0. I have tried and tried...I have an announcement in my forums...but no show on the cmps index page :(Have you verified that the module is checked off to show on the page in addition to be marked as active?
Is the announcement set as a global one or tied to a forum? If it is a global announcement has the module been set up to display them?
Link?
anders
07-30-2006, 01:17 PM
Yup. The module was designed for 3.5.x so I'm not surprised that it has problems with the new release. It could be as simple as renaming an entry but since I don't have 3.6 installed I don't really have any way to verify what needs to be modified.
ok no problems will have to wait for a 3.6 release one day :) looks a nice feature still ;)
navjotjsingh
09-10-2006, 04:52 AM
I will also wait for it to be released for 3.6 since its not working in my 3.6.0 forum also!
Danuk2
09-10-2006, 12:29 PM
i would like this to work on 3.6.0 as well, looking forward to an update.
DMeNTED911
10-07-2006, 11:17 PM
running 3.6.2 I get:
Database error in vBulletin 3.6.2:
Invalid SQL:
SELECT announcementid, startdate, title, announcement.views, forumid, enddate, pagetext, allowhtml, allowbbcode, allowsmilies,
user.username, user.userid, user.usertitle, user.customtitle
FROM vb_announcement AS announcement
LEFT JOIN vb_user AS user ON(user.userid = announcement.userid)
WHERE startdate <= 1160277005
AND enddate >= 1160277005
AND forumid IN (9,-1)
ORDER BY startdate DESC
LIMIT 3;
Edit to add... I had to reinstall the mod and I was getting SQL errors so I turfed all the fields with settings_portal_ann% and was able to reinstall - now if I enable it on the homepage I get the above error.
Tom M
10-07-2006, 11:50 PM
The module needs to be updated to work properly with vb 3.6 and since I don't have that version installed it's likely to be a while before I get it updated.
DMeNTED911
10-07-2006, 11:51 PM
Well...
looking at the table in mysql it looks like allowhtml, allowbbcode, and allowsmilies have been replaced with "announcementoptions".
Edited the PHP file as follows and I now have announcements on my CMPS homepage - and smilies and BBCode still work.
replace "allowhtml, allowbbcode, allowsmilies," with "announcementoptions," and "$announcement['allowhtml'], $announcement['allowsmilies'], $announcement['allowbbcode'], $announcement['allowbbcode']);" with "$announcement['announcementoptions']);"
<?php
//------------------------------------------------------------------------
// notes
//------------------------------------------------------------------------
// Based on the original version for CMPS 1.0 and vBulletin 3.0.x
// posted here: http://www.vbadvanced.com/forum/showthread.php?t=2670
// Updated to work with CMPS 2.0 and vBulletin 3.5.x
// All settings are now controlled via the module ACP.
require_once('./global.php');
// Make sure we're actually looking for something
if (!empty($mod_options['portal_ann_forumid']) OR $mod_options['portal_ann_globalannouncements'])
{
// get announcements
$announcebits = '';
$announcements = $db->query_read("
SELECT announcementid, startdate, title, announcement.views, forumid, enddate, pagetext, announcementoptions,
user.username, user.userid, user.usertitle, user.customtitle
FROM " . TABLE_PREFIX . "announcement AS announcement
LEFT JOIN " . TABLE_PREFIX . "user AS user ON(user.userid = announcement.userid)
WHERE startdate <= " . (TIMENOW - $vbulletin->options['hourdiff']) . "
AND enddate >= " . (TIMENOW - $vbulletin->options['hourdiff']) . "
AND forumid IN (" . $mod_options['portal_ann_forumid'] . iif($mod_options['portal_ann_globalannouncements'], iif(empty($mod_options['portal_ann_forumid']), '', ',') . '-1', '') . ")" . "
ORDER BY startdate DESC
LIMIT " . $mod_options['portal_ann_maxannouncements']);
while ($announcement = $db->fetch_array($announcements))
{
if ($announcement['customtitle'] == 2)
{
$announcement['usertitle'] = htmlspecialchars_uni($announcement['usertitle']);
}
$announcement['postdate'] = vbdate($vbulletin->options['dateformat'], $announcement['startdate']);
$announcement['todate'] = vbdate($vbulletin->options['dateformat'], $announcement['enddate']);
$bbforumview = fetch_bbarray_cookie('forum_view', $announcement['forumid']);
if ($bbforumview > $bbuserinfo['lastvisit'])
{
$lastread = $bbforumview;
}
else
{
$lastread = $bbuserinfo['lastvisit'];
}
if ($announcement['startdate'] > $lastread)
{
$announcement['statusicon'] = 'new';
}
else
{
$announcement['statusicon'] = 'old';
}
$announcement['views'] = vb_number_format($announcement['views']);
$announcement['message'] = $bbcode_parser->do_parse($announcement['pagetext'], $announcement['announcementoptions']);
if (strlen($announcement['message']) > $mod_options['portal_ann_maxcharacters'])
{
$announcement['message'] = substr($announcement['message'], 0, $mod_options['portal_ann_maxcharacters'])."...";
}
eval('$announcebits .= "' . fetch_template('adv_portal_announcement') . '";');
}
$home["$mods[modid]"]['content'] = iif($announcebits, $announcebits, '');
}
?>
Tom M
10-08-2006, 01:51 AM
Well...
looking at the table in mysql it looks like allowhtml, allowbbcode, and allowsmilies have been replaced with "announcementoptions".
Edited the PHP file as follows and I now have announcements on my CMPS homepage - and smilies and BBCode still work.
Great! I knew it wouldn't be too hard :D
siphon
11-06-2006, 12:44 AM
I still couldnt get this to work. Everytime I tried to edit the .module file and saved it would no longer be recognized as a .module file in cmbs. Therefore not allowing me to upload it with the corrected code. Im still new to all this stuff but not being able to edit basic and simple code due to saving issues is frustrating. How the heck can I do this without screwing the .module file?
Tom M
11-06-2006, 12:49 AM
I still couldnt get this to work. Everytime I tried to edit the .module file and saved it would no longer be recognized as a .module file in cmbs. Therefore not allowing me to upload it with the corrected code. Im still new to all this stuff but not being able to edit basic and simple code due to saving issues is frustrating. How the heck can I do this without screwing the .module file?
You have to make any modifications that you want AFTER the module has been installed. If you edit the .module file the character counts won't match which is why you are getting that error.
asdek
11-29-2006, 06:20 AM
my version 3.6.2
Database error in vBulletin 3.6.2:
Invalid SQL:
SELECT announcementid, startdate, title, announcement.views, forumid, enddate, pagetext, allowhtml, allowbbcode, allowsmilies,
user.username, user.userid, user.usertitle, user.customtitle
FROM announcement AS announcement
LEFT JOIN user AS user ON(user.userid = announcement.userid)
WHERE startdate <= 1164780955
AND enddate >= 1164780955
AND forumid IN (2,-1)
ORDER BY startdate DESC
LIMIT 3;
MySQL Error : Unknown column 'allowhtml' in 'field list'
Error Number : 1054
Date : Wednesday, November 29th 2006 @ 12:15:56 PM
Script : http://www.netaktif.com/index2.php
Referrer : http://www.netaktif.com/forum/showthread.php/gloria-estefan-the-very-best-2420.html?t=2420
IP Address : 85.100.78.234
Username : James FOX .
Classname : vb_database
pls help !
Tom M
11-29-2006, 01:30 PM
my version 3.6.2
pls help !As indicated earlier, this module needs to be updates to work with 3.6.x and that's not going to happen in the near future. Sorry.
wil8x
12-05-2006, 06:46 AM
i'm using vba with vbb 3.6.3.
anyone have this module for it ?
i need it. who can share ?
Im getting this error, when importing the module.
Database error in vBulletin 3.6.4:
Invalid SQL:
INSERT INTO phrase (languageid, varname, text, fieldname) VALUES (0, 'setting_portal_ann_forumid_title', 'Announcement Forum ID', 'vbsettings');
MySQL Error : Duplicate entry 'setting_portal_ann_forumid_title-0-vbsettings' for key 2
Error Number : 1062
Date : Saturday, December 9th 2006 @ 01:13:47 PM
Script : http://www.xxxxxxxxxxx.com/admincp/vba_cmps_admin.php?do=uploadmodule
Referrer : http://www.xxxxxxxxxxx.com/admincp/vba_cmps_admin.php?do=download
IP Address : xxx.xxx.xxx.xxx
Username : Eros
Classname : vb_database
vBulletin® v3.7.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.