Announcement

Collapse
No announcement yet.

Managing Forum Announcements

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Jake Bunce
    replied
    Ok. Here are my original instructions with the new code and instructions marked in green and the old code and instructions marked in red. The new code and instructions are for adding the last post info to the forum containing only announcements:

    You can use the announcement count instead of the post count by adding a query to your phpinclude_start template:

    Admin CP -> Styles & Templates -> Style Manager -> « » -> PHP Include Code Templates -> phpinclude_start

    Add this code:


    Code:
    [color=green]if (THIS_SCRIPT == 'index' OR THIS_SCRIPT == 'forumdisplay')
    {[/color]
    	[color=red]$announce_forumid = 3; 
    
    	$announce_count = $DB_site->query_first("SELECT COUNT(*) AS count
    		FROM " . TABLE_PREFIX . "announcement 
    		WHERE forumid = $announce_forumid [color=green]OR forumid = -1[/color]");[/color]
    
    	[color=green]$announce_last = $DB_site->query_first("SELECT announcementid, title, forumid, username, " . TABLE_PREFIX . "announcement.userid, startdate 
    		FROM " . TABLE_PREFIX . "announcement 
    		LEFT JOIN " . TABLE_PREFIX . "user ON (" . TABLE_PREFIX . "user.userid = " . TABLE_PREFIX . "announcement.userid) 
    		WHERE forumid = $announce_forumid OR forumid = -1
    		ORDER BY startdate
    		DESC
    		LIMIT 1");
    
    	$show[lastpostinfo] = 1;
    	if ($vboptions[lastthreadchars] AND strlen($announce_last[title]) > $vboptions[lastthreadchars])
    	{
    		$announce_last[title] = substr($announce_last[title], 0, $vboptions[lastthreadchars]) . "...";
    	}
    	$lastpostinfo[lastpostdate] = date($vboptions[dateformat], $announce_last[startdate]);
    
    	eval('$announce_last = "' . fetch_template('forumhome_lastpostby') . '";');
    }[/color]
    Change $announce_forumid appropriately.

    Then go to your:

    Admin CP -> Styles & Templates -> Style Manager -> « » -> Forum Home Templates -> forumhome_forumbit_level2_post

    Add the red/green code:


    Code:
    	<td class="alt2" nowrap="nowrap">[color=green]<if condition="$forum[forumid] == $GLOBALS[announce_forumid]">{$GLOBALS[announce_last]}<else />[/color]$forum[lastpostinfo][color=green]</if>[/color]</td>
    	<td class="alt1">[color=red]<if condition="$forum[forumid] == $GLOBALS[announce_forumid]">{$GLOBALS[announce_count][count]}<else />[/color]$forum[threadcount][color=red]</if>[/color]</td>
    	<td class="alt2">[color=red]<if condition="$forum[forumid] == $GLOBALS[announce_forumid]">{$GLOBALS[announce_count][count]}<else />[/color]$forum[replycount][color=red]</if>[/color]</td>
    	<td class="alt2" nowrap="nowrap">$forum[lastpostinfo]</td>
    	<if condition="$vboptions['showmoderatorcolumn']">
    	<td class="alt1"><div class="smallfont">$forum[moderators]&nbsp;</div></td>
    	</if>
    Then go to your:

    Admin CP -> Styles & Templates -> Style Manager -> « » -> Forum Home Templates -> forumhome_lastpostby

    Add the green code:


    Code:
    <if condition="$show['lastpostinfo']">
    <div class="smallfont" align="$stylevar[left]">
    	<div style="clear:both">
    		<if condition="$show['icon']"><img class="inlineimg" src="$icon[iconpath]" alt="$icon[title]" border="0" /></if>
    
    		[color=green]<if condition="$announce_forumid">
    		<a href="announcement.php?$session[sessionurl]f=$GLOBALS[announce_forumid]&amp;announcementid=$announce_last[announcementid]"><strong>$announce_last[title]</strong></a>
    		<else />[/color]
    
    		<a href="showthread.php?$session[sessionurl]goto=newpost&amp;t=$lastpostinfo[lastthreadid]" title="<phrase 1="$lastpostinfo[lastthread]">$vbphrase[go_first_unread_in_thread_x]</phrase>"><strong>$lastpostinfo[trimthread]</strong></a>
    
    		[color=green]</if>[/color]
    
    	</div>
    	<div<if condition="is_browser('ie', 6)"> style="float:$stylevar[left]"</if>>
    
    		[color=green]<if condition="$announce_forumid">
    		<phrase 1="member.php?$session[sessionurl]u=$announce_last[userid]" 2="$announce_last[username]">$vbphrase[by_x]</phrase>
    		<else />[/color]
    
    		<phrase 1="member.php?$session[sessionurl]find=lastposter&amp;f=$lastpostinfo[forumid]" 2="$lastpostinfo[lastposter]">$vbphrase[by_x]</phrase>
    
    		[color=green]</if>[/color]
    
    	</div>
    	<div align="$stylevar[right]">
    		$lastpostinfo[lastpostdate] <if condition="!$show['detailedtime']"><span class="time">$lastpostinfo[lastposttime]</span></if>
    
    		[color=green]<if condition="$announce_forumid">
    		<a href="announcement.php?$session[sessionurl]f=$GLOBALS[announce_forumid]&amp;announcementid=$announce_last[announcementid]"><img class="inlineimg" src="$stylevar[imgdir_button]/lastpost.gif" alt="$vbphrase[go_to_last_post]" border="0" /></a>
    		<else />[/color]
    
    		<a href="showthread.php?$session[sessionurl]goto=lastpost&amp;t=$lastpostinfo[lastthreadid]"><img class="inlineimg" src="$stylevar[imgdir_button]/lastpost.gif" alt="$vbphrase[go_to_last_post]" border="0" /></a>
    
    		[color=green]</if>[/color]
    
    	</div>
    </div>
    <else />
    <div class="smallfont" align="$stylevar[right]">
    	$lastpostinfo[lastpostdate] <if condition="!$show['detailedtime']"><span class="time">$lastpostinfo[lastposttime]</span></if>
    	<a href="showthread.php?$session[sessionurl]goto=lastpost&amp;t=$lastpostinfo[lastthreadid]"><img class="inlineimg" src="$stylevar[imgdir_button]/lastpost.gif" alt="$vbphrase[go_to_last_post]" border="0" /></a>
    </div>
    </if>
    I tested this and it works.

    Leave a comment:


  • Jake Bunce
    replied
    Yeah sorry, been busy.

    I will get to it as soon as I can.

    Leave a comment:


  • ZeroCool09
    replied
    Originally posted by Jake Bunce
    The instructions I posted in this thread only take care of the post and thread counts, not the last post field.

    I might be able to make some extra phpinclude_start code to fill in the last post field. I will get back to you on that.
    thks and waiting for your reply.

    Leave a comment:


  • Jake Bunce
    replied
    Originally posted by ZeroCool09
    I follow your guide but the announcement's subject doesnot display in post field in index.
    how can I fix ?
    The instructions I posted in this thread only take care of the post and thread counts, not the last post field.

    I might be able to make some extra phpinclude_start code to fill in the last post field. I will get back to you on that.

    Leave a comment:


  • ZeroCool09
    replied
    I follow your guide but the announcement's subject doesnot display in post field in index.
    how can I fix ?

    Leave a comment:


  • ZeroCool09
    replied
    thks Jake, I will try with .org,
    thks you so much !

    Leave a comment:


  • Jake Bunce
    replied
    Originally posted by ZeroCool09
    so it means if I make a globle announcement, the users will see nothing if they only view the index ? is there any hacks that could makes the announcement to be displayed as normal posts ? (still be announcements but show in index as new posts ?)
    apply for global announcements .
    That would require something much more complex than the code I posted in this thread. I recommend you post on www.vbulletin.org for help with this.

    Leave a comment:


  • ZeroCool09
    replied
    so it means if I make a globle announcement, the users will see nothing if they only view the index ? is there any hacks that could makes the announcement to be displayed as normal posts ? (still be announcements but show in index as new posts ?)
    apply for global announcements .

    Leave a comment:


  • Jake Bunce
    replied
    You can make a global announcement in your:

    Admin CP -> Announcements -> Add New Announcement

    Under the Forum option select All Forums.

    This has nothing to do with the code I posted in this thread. The code I posted is to show an announcement count for a certain forum instead of the reply / thread counts.

    Leave a comment:


  • ZeroCool09
    replied
    if my forums tree like that

    * forums = forumsid = 1 (parent)
    *** announcements = forumsid = 2 (child)
    *** members' opinions = forumsid = 3 (child)
    * learning = forumsid = 4 (parent)
    *** English = forumsid = 5 (child)
    *** Math = forumsid = 6 (child)
    * relax = forumsid = 7 (parent)
    *** Music = forumsid = 8 (child)
    *** Chatting = forumsid = 9 (child)

    and I want to make a global announcement which will appear in all forums (both parent and child forums)
    so what will I fill in
    $announce_forumid = ????

    Leave a comment:


  • Jake Bunce
    replied
    Originally posted by ZeroCool09
    if I have forumsid 1 = forums contained forumid = 2
    like :
    *
    I don't understand.

    Leave a comment:


  • Jake Bunce
    replied
    Originally posted by ZeroCool09
    and the $announce_forumid = ? for global announcements ?
    Keep that set to the forumid of your announcement forum (the forum for which you want the announcement count to show instead of the reply / thread count).

    Leave a comment:


  • ZeroCool09
    replied
    if I have forumsid 1 = forums contained forumid = 2
    like :
    *

    Leave a comment:


  • ZeroCool09
    replied
    and the $announce_forumid = ? for global announcements ?

    Leave a comment:


  • Jake Bunce
    replied
    Originally posted by ZeroCool09
    what happen if I make a Global Announcement ? all forums have the same announcement ?
    You can include global announcements in the count by changing the phpinclude_start code to this. Changes are marked in red:

    Code:
    $announce_forumid = 26; 
    
    $announce_count = $DB_site->query_first("SELECT COUNT(*) AS count FROM " . TABLE_PREFIX . "announcement WHERE forumid = $announce_forumid [color=red]OR forumid = -1[/color]");

    Leave a comment:

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