Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
New Non Popup Version of Announcements f
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / v2.08 / v2.08 Mods Completed

Unknown User
2013-08-15 19:33:31
Ok this is basically an re-do of this [url="https://www.torrenttrader.org/topic/10965-addon-announcements/?hl=announcement"]https://www.torrenttrader.org/topic/10965-addon-announcements/?hl=announcement[/url]

I thing I did not like about that was it was an popup and really hard if possible to link the annnouncement page to other pages if wanted to  :(

you will need the sql from the old topic

or this.

CREATE TABLE IF NOT EXISTS `announcements` (
 `id` int(10) unsigned NOT NULL auto_increment,
 `subject` varchar(64) NOT NULL,
 `message` text NOT NULL,
 `by` varchar(16) NOT NULL default 'Admin',
 `added` datetime NOT NULL default '0000-00-00 00:00:00',
 `minclassread` tinyint(3) unsigned NOT NULL,
 `active` enum('yes','no') NOT NULL default 'yes',
 PRIMARY KEY  (`id`),
 KEY `subject` (`subject`),
 KEY `minclass_idx` (`minclassread`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
Ok 1st off the new sql if did not use the new above version,cause this new version can set announcements active or inactive instead of just plain deleting them


ALTER TABLE `announcements` ADD `active` enum('yes','no') NOT NULL default 'yes';
ALTER TABLE `announcements` ADD INDEX `minclass_idx` ( `minclassread` );

you will still need these in functions.php if you dont already have it.

New:

function announcement () {
GLOBAL $CURUSER;
if ($CURUSER && $CURUSER['announce_read'] == "no") {
$res = mysql_query("SELECT * FROM announcements WHERE minclassread <= $CURUSER[class] ORDER by added DESC LIMIT 1");
$ret = mysql_fetch_array($res);
}
return $ret;
}
if (!function_exists("pingto")) {
   function pingto($url)
   {
       if (headers_sent()) {
?>
<script language="javascript"> window.location.href='<?php echo $url;?>';</script>
<meta http-equiv="refresh" content="2;<?php echo $url;?>">
<?php echo sprintf("Redirecting", $url);
       } else
           header('Location: ' . $url);
       die();
   }
}
now upload the new attached announcements.php to your site.

[url="http://devscorner.xyz/applications/core/interface/file/attachment.php?id=6899"]announcements.php[/url]

i use an classifieds_block.php to display the link myself on the top of the pages but you dont then in index.php (or header.php after middleblocks):

replace

if ($CURUSER && $CURUSER["announce_read"] == "no" && $arr = announcement()) {
?>
<script type="text/javascript" src="scripts/announcement.js"></script>
<script type="text/javascript" src="scripts/preview.js"></script>
<!-- annoucement start #<?=$arr[id];?> -->
<div id="dropin" style="position:absolute;visibility:hidden;left:300px;top:100px;width:500px;height:100px">
<table border="0" cellpadding="0" cellspacing="0" width="650" class="error">
<tbody><tr><td class="none" style="padding: 2px 0 0 10px; background: red">
<font color=black><b>Title:</b> <?=$arr["subject"]?> -- <b>Created on"</b> <?=$arr["added"]?> -- <b>By:</b> <?=$arr["by"]?></b></font></td>
<td width="50" align="right" class="none" style="padding: 2px; background: red"><a href="#" onClick="dismissbox();return false"><img src="images/close.jpg" border="0"></a></td></tr>
<tr><td colspan="2" class=none width="650" style="padding: 0 0 0 10px;" bgcolor="#ffffff">
<p>
<?=format_comment($arr["message"])?>
</p>

<img id="loading" style=" visibility: hidden" src="images/load.gif">
<span style="color:red" name="preview" id="previewr" align="left">
<a href="#" onclick="java script:clearannouncement(this.parentNode,'clear_ann.php')">Click here to mark announcement read.</a>
</span><br><br></form>
</td></tr></tbody></table>
</div>
<!-- annoucement end #<?=$arr[id];?>-->
<span id="new_ann" style="visibility: visible"><table border=0 cellspacing=0 cellpadding=10 bgcolor=red width=100% align=center><tr><td style='padding: 10px; background: red' align='center'>
<b><a href="java script:show_announcement()"><font color=white>New announcement! Please click here to read!</font></a></b></td></tr></table></span><br />
<?php
}
with

        if ($CURUSER["announce_read"] == "no" && $arr_annouce = announcement()) {
?>
       <span id="new_ann" style="visibility: visible"><table border=0 cellspacing=0 cellpadding=10 bgcolor=#AB0000 width=100% align=center><tr><td style='padding: 10px; background: #AB0000' align='center'>
       <div style='font: bold 14px Times New Roman; color:#FFBF00'>There is a New Announcement! Please click <a href="<?php echo $SITEURL;?>/announcements.php"><font size=3 color=#CBCBCB>HERE</font></a> to read!</div></td></tr></table></span><br />
       <?php
       }

Note: Make sure you change this in announcements.php if your classes dont match stock 2.08 classes..

// Config
$min_class = 6;  // <-- Set this to the class you want to be able to edit the announcements.
$allow_class = array(1,2,3,4,5,6,7); // <-- Set this to your classes....
$announcement_autoclear = true; // <-- Set this to true if have the announcements to auto clear once viewed them.
// Config End
You can also change the auto clearing of announcements for people by changing true to false in the same above.Basically now if auto clears aka marks them as read once people view the announcements page the 1st time after a new announcement.

1st screenshot is staff that can edit the announcements.



2nd on is everyone else.



That should be it, I hope people like it.

Ps: I have included an new classifieds_block.php for those people that use that.

[url="http://devscorner.xyz/applications/core/interface/file/attachment.php?id=6898"]classifieds_block.php[/url]
ann_staff.png
ann_staff.png
ann.png
ann.png
classifieds_block.php
Download
announcements.php
Download
2013-08-16 18:16:22
Looking good, test it later  :P  Thanks a lot for sharing.
Unknown User
2013-08-16 19:11:54
an change in announcements.php

replace

    $res = SQL_Query_exec("SELECT * FROM announcements ORDER by added DESC");
   if (mysql_num_rows($res) >= 1) {
       echo '<table border="0" cellpadding="2" cellspacing="2" width="100%" class="table_table" align="center"><tbody>';
       while ($arr_annouce = mysql_fetch_array($res)) {
           echo '<th class="table_head">' . $arr_annouce["subject"] . ' <b>On:</b>' . $arr_annouce["added"] . '</th>';
           echo '<tr><td class="table_col1">' . format_comment($arr_annouce["message"]) . '</td></tr>';
       }
       if ($announcement_autoclear) {
           if ($CURUSER['announce_read'] == "no")
               SQL_Query_exec("UPDATE users SET announce_read = 'yes' WHERE id = $CURUSER[id]");
       } else {
           print("<tr><td align=left>Click <a href=?action=clear><b><font color=orangered>HERE</font></b></a> to clear the new annoucement for <b>You ONLY</b>.</td> </tr>");
       }
       echo '</tbody></table>';
   }
Unknown User
2013-08-23 17:24:00
Not work, in annoucement, after i insert message the page is blank

Message dont show.
Unknown User
2013-09-17 23:27:23
I get: Fatal error: Call to undefined function pingto() in announcements.php on line 131

after i post new annoumment... ??
Unknown User
2013-09-18 04:31:54
if (!function_exists("pingto")) {
   function pingto($url)
   {
       if (headers_sent()) {
?>
<script language="javascript"> window.location.href='<?php echo $url;?>';</script>
<meta http-equiv="refresh" content="2;<?php echo $url;?>">
<?php echo sprintf("Redirecting", $url);
       } else
           header('Location: ' . $url);
       die();
   }
}
Unknown User
2013-09-18 06:24:53
Artic wolf, thansk that fixed the error!

Works great, thansk for this mod man, appreciated!  :D
Unknown User
2013-09-18 17:51:48
"ArcticWolf, post: 91775":


an change in announcements.php

replace

$res = SQL_Query_exec("SELECT * FROM announcements ORDER by added DESC");
   if (mysql_num_rows($res) >= 1) {
       echo '<table border="0" cellpadding="2" cellspacing="2" width="100%" class="table_table" align="center"><tbody>';
       while ($arr_annouce = mysql_fetch_array($res)) {
           echo '<th class="table_head">' . $arr_annouce["subject"] . ' <b>On:</b>' . $arr_annouce["added"] . '</th>';
           echo '<tr><td class="table_col1">' . format_comment($arr_annouce["message"]) . '</td></tr>';
       }
       if ($announcement_autoclear) {
           if ($CURUSER['announce_read'] == "no")
               SQL_Query_exec("UPDATE users SET announce_read = 'yes' WHERE id = $CURUSER[id]");
       } else {
           print("<tr><td align=left>Click <a href=?action=clear><b><font color=orangered>HERE</font></b></a> to clear the new annoucement for <b>You ONLY</b>.</td> </tr>");
       }
       echo '</tbody></table>';
   }


Where ?
Unknown User
2013-09-18 18:45:11
on index i think
Unknown User
2013-09-18 18:53:21
"easy, post: 92245":

on index i think

Why [url="https://www.torrenttrader.org/index.php?app=core&module=attach&section=attach&attach_id=6898"]classifieds_block.php ?[/url]
Unknown User
2013-09-18 19:41:28
learn to read

Quote:
Ps: I have included an new classifieds_block.php for those people that use that.

Ps: I have included an new classifieds_block.php for those people that use that.

Ps: I have included an new classifieds_block.php for those people that use that.

Ps: I have included an new classifieds_block.php for those people that use that.
Unknown User
2013-09-18 19:43:05
Excuses, but Thanks so much you are the king of...
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 8
  • Members: 0
  • Guests online: 8
  • Comments: 3
  • Messages: 1,728