Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 09-07-2004, 03:26 AM
Blue Moose Aaron's Avatar
Blue Moose Aaron Blue Moose Aaron is offline
 
Join Date: Sep 2002
Location: Austin, Texas
Posts: 149
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Flag a thread as news

Currently I am running a portal system on my site that pulls news from certain forums, the usual... Well this doesn't exactly work out for me as the people who post the best news are the regular members rather than my 'reporters'. What I have conceptualized is to come up with a hack that would allow users with permission to moderate to a.) be able to flag a new thread as 'news' or b.) be able to use the edit feature to edit a thread by a regular member as news and be pulled to the main site page.

Is this feasible or even worth the trouble?
Reply With Quote
  #2  
Old 09-07-2004, 01:02 PM
CarCdr CarCdr is offline
 
Join Date: Apr 2004
Posts: 242
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Just to be clear, is this an accurate summary of what you are after?

1) The portal system is currently able to pull information from "news" forum(s) but NOT threads.

2) You want the ability to flag any thread as "news worthy" so that it will be extracted/displayed by the portal system as if it were in the "news" forum.

First of all, to make it a little easier, I would not bother with changing the code for adding threads. If the person adding knows it is news, he can post it to the news forum or use the "Thread Admin Tools" menu (read on).

Just add an option to "Thread Admin Tools", a menu that is already access-controlled, to mark a thread as "news worthy". You would have to add a script (or add to an existing script) to be run by your new option (link) in the "Thread Admin Tools" menu.

You would also have to add a new column to the 'thread' table that would be set by your new script code. Let's assume you add a column called "newsworthy".

Finally, you'd have to change your portal script to also search for threads in the thread table with the "newsworthy" flag set.

What does all this add up to?

1. A template change to add option/link to "Thread Admin Tools".

2. A script or script change to add code called by said option.

3. A change to your portal script.

4. A new column in the thread table.

Now, alternatively, you could do this as a less-intrusive kludge.

1. Create a "newsworthy" thread icon that is accessible only to your moderators. Note the iconid of the new icon.

2. Using the default "Thread Admin Tools/Edit Thread" option, they can set any thread to have this newsworthy icon.

3. Change the portal script to include any threads it finds with the newsworthy iconid.

The advantage of this approach is that it uses existing code and all you need to do is modify the portal script to look for threads with the newsworthy iconid, which should be a pretty easy mod.
Reply With Quote
  #3  
Old 09-09-2004, 01:49 AM
Blue Moose Aaron's Avatar
Blue Moose Aaron Blue Moose Aaron is offline
 
Join Date: Sep 2002
Location: Austin, Texas
Posts: 149
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That's a really great idea. Now I just need to figure out how to go about doing that!
Reply With Quote
  #4  
Old 09-09-2004, 02:27 AM
Blue Moose Aaron's Avatar
Blue Moose Aaron Blue Moose Aaron is offline
 
Join Date: Sep 2002
Location: Austin, Texas
Posts: 149
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Here is the code used in my portal for the news

PHP Code:
// ######################### PROCESS NEWS ############################
// standard news block
if (($vbindex['options'] & VBI_SHOWNEWS) && !($vbindex['options'] & VBI_VBWAR) && !EXTRA_PAGE && $_REQUEST['action'] != 'shoutbox') {

    
$getnews $DB_site->query("
        ## GET NEWS ##
        SELECT thread.*,thread.iconid AS threadiconid, threadpost.pagetext AS pagetext,
        threadpost.attach AS attachcount,
        "
.iif($vbindex['options'] & VBI_SHOWNEWSAVATAR'avatarpath, NOT ISNULL(avatardata) AS customavatar, user.avatarrevision, customavatar.dateline AS customdateline,')."
        "
.iif(($vbindex['options'] & VBI_SUBNEWS) AND $bbuserinfo['userid'], 'NOT ISNULL(subscribethread.subscribethreadid) AS issubscribed,')."
        IF(user.displaygroupid = 0, user.usergroupid, user.displaygroupid) AS displaygroupid
        FROM "
.TABLE_PREFIX."thread AS thread
        LEFT JOIN "
.TABLE_PREFIX."user AS user ON (thread.postuserid = user.userid)
        LEFT JOIN "
.TABLE_PREFIX."post AS threadpost ON (thread.firstpostid = threadpost.postid)
        LEFT JOIN "
.TABLE_PREFIX."deletionlog AS deletionlog ON(thread.threadid = deletionlog.primaryid AND type = 'thread')
        "
.iif($vbindex['options'] & VBI_SHOWNEWSAVATAR'
        LEFT JOIN '
.TABLE_PREFIX.'customavatar AS customavatar ON (customavatar.userid = user.userid)
        LEFT JOIN '
.TABLE_PREFIX.'avatar AS avatar ON (avatar.avatarid = user.avatarid)'
        
)."
        "
.iif(($vbindex['options'] & VBI_SUBNEWS) AND $bbuserinfo['userid'], "
        LEFT JOIN "
.TABLE_PREFIX."subscribethread AS subscribethread ON(subscribethread.threadid = thread.threadid AND subscribethread.userid = $bbuserinfo[userid])"
        
)."
        WHERE forumid IN (
$vbindex[newsfid])
        AND deletionlog.primaryid IS NULL
        AND forumid NOT IN ("
.implode(','$limitfids).")
        AND thread.open <> 10
        AND thread.visible = '1'
        
$globalignore
        
$ignorelist
        ORDER BY "
.iif($vbindex['options'] & VBI_STICKYNEWS'thread.sticky DESC,''')." thread.dateline DESC
        LIMIT 
$vbindex[newsposts]");

    while(
$news $DB_site->fetch_array($getnews)) {

          
$news['title'] = fetch_censored_text($news['title']);
          
$news['time'] = vbdate($vboptions['timeformat'], $news['dateline']);
          
$news['date'] = vbdate($vboptions['dateformat'], $news['dateline'], 1);
          
$news['musername'] = fetch_musername($news'displaygroupid''postusername');
          
$news['attachcount'] = vb_number_format($news['attachcount']);
          
$news['replycount'] = vb_number_format($news['replycount']);

          if (
$news['iconid']) {
            
$news['showicon'] = true;
            
$news['threadiconpath'] = &$iconcache["$news[threadiconid]"]['iconpath'];
            
$news['threadicontitle'] = &$iconcache["$news[threadiconid]"]['title'];
        } elseif (!empty(
$vboptions['showdeficon'])) {
            
$news['showicon'] = true;
            
$news['threadiconpath'] = $vboptions['showdeficon'];
            
$news['threadicontitle'] = $vbphrase['default'];
        }

          
// ## CENSOR NEWS AND PARSE vB CODE ##
          
$news['pagetext'] = fetch_censored_text(parse_bbcode(strip_bbcode(fetch_trimmed_title($news['pagetext'], 394), truetrue), $news['forumid'], 1));

        
// ## GET POSTERS AVATAR ##
        
$news['avatar'] = false;
        if (
$vbindex['options'] & VBI_SHOWNEWSAVATAR) {

            if (!isset(
$avatarcache["$news[postuserid]"])) {

                if (
$news['customavatar']) {

                    if (
$vboptions['usefileavatar']) {
                        
$news['avatarurl'] = "$vboptions[avatarurl]/avatar$news[postuserid]_$news[avatarrevision].gif";
                    } else {
                        
$news['avatarurl'] = "$vboptions[bburl]/image".SCRIPT_EXTENSION."?userid=$news[postuserid]&amp;dateline=$news[customdateline]";
                    }

                    
$news['avatar'] = true;
                    
$avatarcache["$news[postuserid]"] = $news['avatarurl'];
                    
DEVDEBUG("cached avatar for userid $news[postuserid]");
                } elseif (!empty(
$news['avatarpath'])) {
                    
$news['avatarurl'] = $vboptions['bburl'].'/'.$news['avatarpath'];
                    
$news['avatar'] = true;
                    
$avatarcache["$news[postuserid]"] = $news['avatarurl'];
                    
DEVDEBUG("cached avatar for userid $news[postuserid]");
                } elseif (!empty(
$vbindex['useravatar'])) { // we have a default av specified
                    
$avatarurl $vbindex['useravatar'];
                    
$avatarcache["$bbuserinfo[userid]"] = $avatarurl;
                    
$news['avatar'] = true;
                }

              } else {
                
$news['avatar'] = true;
                
$news['avatarurl'] = $avatarcache["$news[postuserid]"];
            }
        }

          eval(
"\$home[news] .= \"".fetch_template('vbindex_newsbit')."\";");
    }
      
// memory saving
    
unset($news);
    
$DB_site->free_result($getnews);
}

// if vBwar is enabled then show that instead
if ((($vbindex['options'] & VBI_VBWAR) && !($vbindex['options'] & VBI_SHOWNEWS)) && !EXTRA_PAGE && $_REQUEST['action'] != 'shoutbox') {

    require_once(
'./vnews.php');


Can anyone help me make this work?
Reply With Quote
  #5  
Old 09-09-2004, 09:55 AM
CarCdr CarCdr is offline
 
Join Date: Apr 2004
Posts: 242
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Start by checking out the AdminCP interface for post icons. You should be able to create a simple graphic to mean "new worthy". How about a tiny graphic of a newspaper. You should be able to find that with google or through an online graphics/icon library.

Find or make an icon about the same size as the other post icons. A little bigger is OK too, but not so big that it messes up the postbit display.

Create a usergroup called "News Moderator" that has the privileges you need to allow them to edit threads in forums. Then install the new post icon graphic via AdminCP, giving access to use it to moderators. You will see the iconid displayed when you install the new post icon.

The query should be an easy change. Where it says "WHERE forumid IN ($vbindex[newsfid])" you will add code to select threads with the proper icon -- thread.iconid, not post icons.

If noboy else pipes up about your query, I'll post the query you will need later. Gotta go to work... sigh.
Reply With Quote
  #6  
Old 09-09-2004, 04:16 PM
CarCdr CarCdr is offline
 
Join Date: Apr 2004
Posts: 242
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Here's how you would change your query to catch threads with the "newsworthy" iconid. It is vital that your moderators use "Edit Thread" to set the thread icon, not the first post or any other post to set the post icon.

Change this line:

WHERE forumid IN ($vbindex[newsfid])

to:

WHERE (forumid IN ($vbindex[newsfid]) OR thread.iconid=###)

where "###" is replaced with the actual iconid that you noted when you added it.

Since the thread table has an iconid KEY, this should be quite performant.
Reply With Quote
  #7  
Old 09-10-2004, 12:43 AM
Blue Moose Aaron's Avatar
Blue Moose Aaron Blue Moose Aaron is offline
 
Join Date: Sep 2002
Location: Austin, Texas
Posts: 149
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks so very much for your help. I never thought it would be that simple, and it worked like a charm. You can see it in action at http://www.thekryptonian.com

Thanks again!
Reply With Quote
  #8  
Old 09-10-2004, 01:11 AM
CarCdr CarCdr is offline
 
Join Date: Apr 2004
Posts: 242
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Looks good. You're welcome.
Reply With Quote
  #9  
Old 09-11-2004, 01:56 AM
Blue Moose Aaron's Avatar
Blue Moose Aaron Blue Moose Aaron is offline
 
Join Date: Sep 2002
Location: Austin, Texas
Posts: 149
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This may be a little more difficult, but I've seen it done on other forums (only wiht images) where the post bit displays the number of items a person has posted.

I would like to somehow display the number of news items a user has posted in hopes of sparking the users to post more news worthy subjects.
Reply With Quote
  #10  
Old 09-16-2004, 09:43 PM
CarCdr CarCdr is offline
 
Join Date: Apr 2004
Posts: 242
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, you have a couple of choices. You need to associate the counter with a user, so you can add a column to the 'user' table or make a new table keyed on userid. That's the easy part -- having a place to store the counter.

The other easy part is displaying the information. It would be easy enough to modify the PHP function that assembles the information for use by the 'postbit' template to also make available your new counter. Then, in postbit you would just check to see if it is greater than zero and, if so, display it somewhere in the user information.

The harder part is:

1) Figuring out what triggers should be used to increment/decrement the counter. (design)

2) Figuring out where in the vBulletin scripts one has to add code to implement the triggers.

Given your approach of using simple thread icons, you could modify newthread.php and postings.php (edit thread action) to note when a thread is being flagged as news so that the user table counter can be incremented.

I would recommend a kludge here -- only increment the counter -- only track when a thread is being flagged as news. This would be easier and still give you the feedback you are after.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:20 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02668 seconds
  • Memory Usage 2,321KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete