Forums not recording points

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   Forums not recording points
runn
CZ Super Newbie
runn has been a member for over 20 year's 20 Year Member
Status: Offline
Joined: Feb 05, 2004
0.00 posts per day
Posts: 33
Points: 3,547
   
I just found out my forums aren't recording the users points, they are all set in user_groups, I was thinking maybe its because I did an upgrade awhile ago. But where should I look to see if anything is wrong with the code?



Back to top Reply with quote
#2   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,475
   
You might have overwrote the function in the includes/functions_post.php. There should be 2 in there for update_points.




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#3   
runn
CZ Super Newbie
runn has been a member for over 20 year's 20 Year Member
Status: Offline
Joined: Feb 05, 2004
0.00 posts per day
Posts: 33
Points: 3,547
   
found these:

if ( $mode == 'newtopic' ) { update_points(10); }
if ( $mode == 'reply' ) { update_points(11); }



Back to top Reply with quote
#4   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,475
   
Ok and it isnt updating the points. Post the 100 lines before and after that code please.




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#5   re: Forums not recording points
runn
CZ Super Newbie
runn has been a member for over 20 year's 20 Year Member
Status: Offline
Joined: Feb 05, 2004
0.00 posts per day
Posts: 33
Points: 3,547
   
                else
                {
                        $username = '';
                }
        }

        // Check subject
        if (!empty($subject))
        {
                $subject = htmlspecialchars(trim($subject));
        }
        else if ($mode == 'newtopic' || ($mode == 'editpost' && $post_data['first_post']))
        {
                $error_msg .= (!empty($error_msg)) ? '<br />' . $lang['Empty_subject'] : $lang['Empty_subject'];
        }

        // Check message
        if (!empty($message))
        {
                $bbcode_uid = ($bbcode_on) ? make_bbcode_uid() : '';
                $message = prepare_message(trim($message), $html_on, $bbcode_on, $smilies_on, $bbcode_uid);
        }
        else if ($mode != 'delete' && $mode != 'poll_delete')
        {
                $error_msg .= (!empty($error_msg)) ? '<br />' . $lang['Empty_message'] : $lang['Empty_message'];
        }

        //
        // Handle poll stuff
        //
        if ($mode == 'newtopic' || ($mode == 'editpost' && $post_data['first_post']))
        {
                $poll_length = (isset($poll_length)) ? max(0, intval($poll_length)) : 0;

                if (!empty($poll_title))
                {
                        $poll_title = htmlspecialchars(trim($poll_title));
                }

                if(!empty($poll_options))
                {
                        $temp_option_text = array();
                        while(list($option_id, $option_text) = @each($poll_options))
                        {
                                $option_text = trim($option_text);
                                if (!empty($option_text))
                                {
                                        $temp_option_text[$option_id] = htmlspecialchars($option_text);
                                }
                        }
                        $option_text = $temp_option_text;

                        if (count($poll_options) < 2)
                        {
                                $error_msg .= (!empty($error_msg)) ? '<br />' . $lang['To_few_poll_options'] : $lang['To_few_poll_options'];
                        }
                        else if (count($poll_options) > $board_config['max_poll_options'])
                        {
                                $error_msg .= (!empty($error_msg)) ? '<br />' . $lang['To_many_poll_options'] : $lang['To_many_poll_options'];
                        }
                        else if ($poll_title == '')
                        {
                                $error_msg .= (!empty($error_msg)) ? '<br />' . $lang['Empty_poll_title'] : $lang['Empty_poll_title'];
                        }
                }
        }

        return;
}

//
// Post a new topic/reply/poll or edit existing post/poll
//
function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_id, &$post_id, &$poll_id, &$topic_type, &$bbcode_on, &$html_on, &$smilies_on, &$attach_sig, &$bbcode_uid, &$post_username, &$post_subject, &$post_message, &$poll_title, &$poll_options, &$poll_length)
{
        global $board_config, $lang, $db, $phpbb_root_path, $phpEx;
        global $userdata, $user_ip;

        include("includes/functions_search.php");

        $current_time = time();

        if ($mode == 'newtopic' || $mode == 'reply' || $mode == 'editpost')
        {
                //
                // Flood control
                //
                $where_sql = ($userdata['user_id'] == ANONYMOUS) ? "poster_ip = '$user_ip'" : 'poster_id = ' . $userdata['user_id'];
                $sql = "SELECT MAX(post_time) AS last_post_time
                        FROM " . POSTS_TABLE . "
                        WHERE $where_sql";
                if ($result = $db->sql_query($sql))
                {
                        if ($row = $db->sql_fetchrow($result))
                        {
                                if (intval($row['last_post_time']) > 0 && ($current_time - intval($row['last_post_time'])) < intval($board_config['flood_interval']))
                                {
                                        message_die(GENERAL_MESSAGE, $lang['Flood_Error']);
                                }
                        }
                }
                if ( $mode == 'newtopic' ) { update_points(10); }
                if ( $mode == 'reply' ) { update_points(11); }
        }

        if ($mode == 'editpost')
        {
                remove_search_post($post_id);
        }

        if ($mode == 'newtopic' || ($mode == 'editpost' && $post_data['first_post']))
        {
                $topic_vote = (!empty($poll_title) && count($poll_options) >= 2) ? 1 : 0;

                $sql  = ($mode != "editpost") ? "INSERT INTO " . TOPICS_TABLE . " (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type, topic_vote) VALUES ('$post_subject', " . $userdata['user_id'] . ", $current_time, $forum_id, " . TOPIC_UNLOCKED . ", $topic_type, $topic_vote)" : "UPDATE " . TOPICS_TABLE . " SET topic_title = '$post_subject', topic_type = $topic_type " . (($post_data['edit_vote'] || !empty($poll_title)) ? ", topic_vote = " . $topic_vote : "") . " WHERE topic_id = $topic_id";
                if (!$db->sql_query($sql))
                {
                        message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
                }

                if ($mode == 'newtopic')
                {
                        $topic_id = $db->sql_nextid();
                }
        }

        $edited_sql = ($mode == 'editpost' && !$post_data['last_post'] && $post_data['poster_post']) ? ", post_edit_time = $current_time, post_edit_count = post_edit_count + 1 " : "";
        $sql = ($mode != "editpost") ? "INSERT INTO " . POSTS_TABLE . " (topic_id, forum_id, poster_id, post_username, post_time, poster_ip, enable_bbcode, enable_html, enable_smilies, enable_sig) VALUES ($topic_id, $forum_id, " . $userdata['user_id'] . ", '$post_username', $current_time, '$user_ip', $bbcode_on, $html_on, $smilies_on, $attach_sig)" : "UPDATE " . POSTS_TABLE . " SET post_username = '$post_username', enable_bbcode = $bbcode_on, enable_html = $html_on, enable_smilies = $smilies_on, enable_sig = $attach_sig" . $edited_sql . " WHERE post_id = $post_id";
        if (!$db->sql_query($sql, BEGIN_TRANSACTION))
        {
                message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
        }

        if ($mode != 'editpost')
        {
                $post_id = $db->sql_nextid();
        }

        $sql = ($mode != 'editpost') ? "INSERT INTO " . POSTS_TEXT_TABLE . " (post_id, post_subject, bbcode_uid, post_text) VALUES ($post_id, '$post_subject', '$bbcode_uid', '$post_message')" : "UPDATE " . POSTS_TEXT_TABLE . " SET post_text = '$post_message',  bbcode_uid = '$bbcode_uid', post_subject = '$post_subject' WHERE post_id = $post_id";
        if (!$db->sql_query($sql))
        {
                message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
        }

        add_search_words('single', $post_id, stripslashes($post_message), stripslashes($post_subject));

        //
        // Add poll
        //
        if (($mode == 'newtopic' || ($mode == 'editpost' && $post_data['edit_poll'])) && !empty($poll_title) && count($poll_options) >= 2)
        {
                $sql = (!$post_data['has_poll']) ? "INSERT INTO " . VOTE_DESC_TABLE . " (topic_id, vote_text, vote_start, vote_length) VALUES ($topic_id, '$poll_title', $current_time, " . ($poll_length * 86400) . ")" : "UPDATE " . VOTE_DESC_TABLE . " SET vote_text = '$poll_title', vote_length = " . ($poll_length * 86400) . " WHERE topic_id = $topic_id";
                if (!$db->sql_query($sql))
                {
                        message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
                }

                $delete_option_sql = '';
                $old_poll_result = array();
                if ($mode == 'editpost' && $post_data['has_poll'])
                {
                        $sql = "SELECT vote_option_id, vote_result
                                FROM " . VOTE_RESULTS_TABLE . "
                                WHERE vote_id = $poll_id
                                ORDER BY vote_option_id ASC";
                        if (!($result = $db->sql_query($sql)))
                        {
                                message_die(GENERAL_ERROR, 'Could not obtain vote data results for this topic', '', __LINE__, __FILE__, $sql);
                        }

                        while ($row = $db->sql_fetchrow($result))
                        {
                                $old_poll_result[$row['vote_option_id']] = $row['vote_result'];

                                if (!isset($poll_options[$row['vote_option_id']]))
                                {
                                        $delete_option_sql .= ($delete_option_sql != '') ? ', ' . $row['vote_option_id'] : $row['vote_option_id'];
                                }
                        }
                }
                else
                {
                        $poll_id = $db->sql_nextid();
                }

                @reset($poll_options);

                $poll_option_id = 1;
                while (list($option_id, $option_text) = each($poll_options))
                {
                        if (!empty($option_text))
                        {
                                $option_text = str_replace("\'", "''", htmlspecialchars($option_text));
                                $poll_result = ($mode == "editpost" && isset($old_poll_result[$option_id])) ? $old_poll_result[$option_id] : 0;

                                $sql = ($mode != "editpost" || !isset($old_poll_result[$option_id])) ? "INSERT INTO " . VOTE_RESULTS_TABLE . " (vote_id, vote_option_id, vote_option_text, vote_result) VALUES ($poll_id, $poll_option_id, '$option_text', $poll_result)" : "UPDATE " . VOTE_RESULTS_TABLE . " SET vote_option_text = '$option_text', vote_result = $poll_result WHERE vote_option_id = $option_id AND vote_id = $poll_id";
                                if (!$db->sql_query($sql))
                                {
                                        message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
                                }
   



Back to top Reply with quote
#6   
runn
CZ Super Newbie
runn has been a member for over 20 year's 20 Year Member
Status: Offline
Joined: Feb 05, 2004
0.00 posts per day
Posts: 33
Points: 3,547
   
ok I found out none of the points are recording for anything



Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum