corsasport.co.uk
 

Corsa Sport » Message Board » Off Day » Geek Day » Unsure if anyone can help me with this


New Topic

New Poll
  Subscribe | Add to Favourites

You are not logged in and may not post or reply to messages. Please log in or create a new account or mail us about fixing an existing one - register@corsasport.co.uk

There are also many more features available when you are logged in such as private messages, buddy list, location services, post search and more.


Author Unsure if anyone can help me with this
Steve
Premium Member

Avatar

Registered: 30th Mar 02
Location: Worcestershire Drives: Defender
User status: Offline
3rd Oct 06 at 14:11   View Garage View User's Profile U2U Member Reply With Quote

Iv made it so when a user deletes a post it just moves it to another forum (the thread dump).

http://www.vagweb.co.uk/forums/viewforum.php?f=20 (need to be registered)


When it moves it i get it to rename the Post title to 'Deleted from topic-ID 444' for example.

Now i want to rename it to 'Deleted from topic title' instead

The functions for this reside in fucntions_post.php and here is the snippet of code for the function wthin that does the moving

code:
function delete_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_id, &$post_id, &$poll_id)
{
global $board_config, $lang, $db, $phpbb_root_path, $phpEx, $topic_title;
global $userdata, $user_ip;
if (intval($board_config['delete_post_forum']) != 0)
{
$sql = "SELECT * FROM " . FORUMS_TABLE . "
WHERE forum_id = " . $board_config['delete_post_forum'];
if (!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
}
$forum_count = $db->sql_numrows($result);
$db->sql_freeresult($result);

$forum_check = ($forum_count != 0) ? TRUE : 0;
}
else
{
$forum_check = 0;
}

if ($mode != 'poll_delete')
{
include($phpbb_root_path . 'includes/functions_search.'.$phpEx);
if ($userdata['user_level'] == ADMIN || ($userdata['user_level'] == MOD && $board_config['mod_allow_delete_post'] == 1))
{

$sql = "DELETE FROM " . POSTS_TABLE . "
WHERE post_id = $post_id";
if (!$db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
}

$sql = "DELETE FROM " . POSTS_TEXT_TABLE . "
WHERE post_id = $post_id";
if (!$db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
}
}
else if ($post_data['first_post'] == '' && $forum_check == TRUE)
{

$sql = "INSERT INTO " . TOPICS_TABLE . "
(forum_id, topic_title, topic_poster, topic_time, topic_views, topic_replies, topic_status, topic_vote, topic_type, topic_first_post_id, topic_last_post_id, topic_moved_id)
******VALUES (".$board_config['delete_post_forum'].", '".sprintf($lang['Deleted_post_from_topic'], $topic_id*******)."', ".$post_data['poster_id'].", ".time().", 0, 0, ".TOPIC_UNLOCKED.", 0, ".POST_NORMAL.", $post_id, $post_id, 0)";
if (!$db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
}
$new_topic_id = $db->sql_nextid();

$sql = "UPDATE " . POSTS_TABLE . "
SET topic_id = $new_topic_id, forum_id = ".$board_config['delete_post_forum']."
WHERE post_id = $post_id";
if (!$db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
}
}


i have made in ******'s the line that sets the post title as it stands.

Iv tried the obvious and replaced $topic_id with $topic_title that is declared elsewhere in the php but that dont work
James
Member

Registered: 1st Jun 02
Location: Surrey
User status: Offline
3rd Oct 06 at 15:23   View User's Profile U2U Member Reply With Quote

What happened when you replaced topic_id with topic_title?
Steve
Premium Member

Avatar

Registered: 30th Mar 02
Location: Worcestershire Drives: Defender
User status: Offline
3rd Oct 06 at 15:28   View Garage View User's Profile U2U Member Reply With Quote

gets nothing, topic_title on what you can see is just the name of the SQL table
James
Member

Registered: 1st Jun 02
Location: Surrey
User status: Offline
3rd Oct 06 at 15:43   View User's Profile U2U Member Reply With Quote

Can you post the code where $topic_id is passed into that function?

I reckon you can just pass in topic title instead....
Steve
Premium Member

Avatar

Registered: 30th Mar 02
Location: Worcestershire Drives: Defender
User status: Offline
3rd Oct 06 at 15:47   View Garage View User's Profile U2U Member Reply With Quote

thats almost the whole function there, $topic_title is part of a different function, even if i make the variable global it still doesnt pick it up.

topic_title is made by

$topic_title = (count($orig_word)) ? preg_replace($orig_word, $replacement_word, unprepare_message($topic_title)) : unprepare_message($topic_title);

utilising bits and bobs from other functions
James
Member

Registered: 1st Jun 02
Location: Surrey
User status: Offline
3rd Oct 06 at 15:49   View User's Profile U2U Member Reply With Quote

Yeah but when the Delete_Post function is called, the topic_id is passed in as a paramater which is then used in that insert query, if you could just pass in the topic title as a parameter instead, you could use that?
Steve
Premium Member

Avatar

Registered: 30th Mar 02
Location: Worcestershire Drives: Defender
User status: Offline
3rd Oct 06 at 15:59   View Garage View User's Profile U2U Member Reply With Quote

the problem is topic_id is set for many different functions, changing it would mean screwing up a lot of things
Steve
Premium Member

Avatar

Registered: 30th Mar 02
Location: Worcestershire Drives: Defender
User status: Offline
3rd Oct 06 at 16:02   View Garage View User's Profile U2U Member Reply With Quote

i cant even find where $topic_id is set in that php document, it may be a superglobal declared elsewhere
James
Member

Registered: 1st Jun 02
Location: Surrey
User status: Offline
3rd Oct 06 at 16:03   View User's Profile U2U Member Reply With Quote

Well you dont need to change it, just pass in topic_title instead.

Where you've got this:

code:

function delete_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_id, &$post_id, &$poll_id)


Change it to this:

code:

function delete_post($mode, $post_data, $message, $meta, $forum_id, $topic_id, $post_id, $poll_id, $topic_title)


And then when the delete_post function is called (looks like this):

code:

delete_post("parameter1", "parameter2", "parameter3", "parameter4", "parameter5", "parameter6",
"parameter7", "parameter8", "topic title")



And then where it does this insert:

code:

$sql = "INSERT INTO " . TOPICS_TABLE . "
(forum_id, topic_title, topic_poster, topic_time, topic_views, topic_replies, topic_status, topic_vote, topic_type, topic_first_post_id, topic_last_post_id, topic_moved_id)
******VALUES (".$board_config['delete_post_forum'].", '".sprintf($lang['Deleted_post_from_topic'], $topic_id*******)."', ".$post_data['poster_id'].", ".time().", 0, 0, ".TOPIC_UNLOCKED.", 0, ".POST_NORMAL.", $post_id, $post_id, 0)";



Change it to this

code:

$sql = "INSERT INTO " . TOPICS_TABLE . "
(forum_id, topic_title, topic_poster, topic_time, topic_views, topic_replies, topic_status, topic_vote, topic_type, topic_first_post_id, topic_last_post_id, topic_moved_id)
******VALUES (".$board_config['delete_post_forum'].", '".sprintf($lang['Deleted_post_from_topic'], $topic_title*******)."', ".$post_data['poster_id'].", ".time().", 0, 0, ".TOPIC_UNLOCKED.", 0, ".POST_NORMAL.", $post_id, $post_id, 0)";



Do you get me?



[Edited on 03-10-2006 by James]
Cosmo
Member

Registered: 29th Mar 01
Location: Im the real one!
User status: Offline
3rd Oct 06 at 16:12   View User's Profile U2U Member Reply With Quote

wrong forum, this should be in uber geek day
Steve
Premium Member

Avatar

Registered: 30th Mar 02
Location: Worcestershire Drives: Defender
User status: Offline
3rd Oct 06 at 16:24   View Garage View User's Profile U2U Member Reply With Quote

i did try that one of the first things i did and got

Warning: Missing argument 9 for delete_post() in /home/sites/vagweb.co.uk/public_html/forums/includes/functions_post.php on line 469
John
Member

Registered: 30th Jun 03
User status: Offline
3rd Oct 06 at 16:50   View User's Profile U2U Member Reply With Quote

Sorry to crash your post steve but I don't have a clue.

I would however like to.

What do I need to get something like this going.

I know there will be millions on google but i'll look into things further when I have a basic idea of what i'm looking for.
Steve
Premium Member

Avatar

Registered: 30th Mar 02
Location: Worcestershire Drives: Defender
User status: Offline
3rd Oct 06 at 16:52   View Garage View User's Profile U2U Member Reply With Quote

something like what going? a forum?
John
Member

Registered: 30th Jun 03
User status: Offline
3rd Oct 06 at 16:53   View User's Profile U2U Member Reply With Quote

Yip, your forum or here for instance.
Steve
Premium Member

Avatar

Registered: 30th Mar 02
Location: Worcestershire Drives: Defender
User status: Offline
3rd Oct 06 at 16:56   View Garage View User's Profile U2U Member Reply With Quote

http://www.phpbb.com/downloads.php

will get you the basic stuff of what mines running on. This forum is XMB unsure if xmb is free, phpbb is free.

Bear in mind mine and this is very modified so wont look like it out the box or have half the functions but its a good start
John
Member

Registered: 30th Jun 03
User status: Offline
3rd Oct 06 at 17:02   View User's Profile U2U Member Reply With Quote

Cheers.
Thats plenty to get me going
Steve
Premium Member

Avatar

Registered: 30th Mar 02
Location: Worcestershire Drives: Defender
User status: Offline
3rd Oct 06 at 17:08   View Garage View User's Profile U2U Member Reply With Quote

if you cant be arsed to design your own layout etc then you can quickly apply themes from
http://www.phpbb-design.com/
Ian
Site Administrator

Avatar

Registered: 28th Aug 99
Location: Liverpool
User status: Offline
3rd Oct 06 at 19:04   View Garage View User's Profile U2U Member Reply With Quote

The ways its done here is that the forum id becomes that of the trash - in this case 29 - and thats the only change in the posts and threads tables.

At this time it also writes the thread id and a reason to another table.

Its forumdisplay and viewthread where the difference happens, they don't allow regular members to view threads with that forum id.

Forumdisplay also does the join now with the posts in fid=29 and the reasons table to get that.

What you're needing to do means you need the thread title available to you when you process the move, which you probably have, if all else fails throw a select in there and get it.
Steve
Premium Member

Avatar

Registered: 30th Mar 02
Location: Worcestershire Drives: Defender
User status: Offline
3rd Oct 06 at 19:08   View Garage View User's Profile U2U Member Reply With Quote

i was thinking about doing an sql query to get
Ian
Site Administrator

Avatar

Registered: 28th Aug 99
Location: Liverpool
User status: Offline
3rd Oct 06 at 19:13   View Garage View User's Profile U2U Member Reply With Quote

That would work, its an extra query and I would make double sure you don't already have it in memory somewhere before you query for it, but if you don't then yeah, that would sort it.
Steve
Premium Member

Avatar

Registered: 30th Mar 02
Location: Worcestershire Drives: Defender
User status: Offline
4th Oct 06 at 12:35   View Garage View User's Profile U2U Member Reply With Quote

got it working with the SQL query cheers ian
Steve
Premium Member

Avatar

Registered: 30th Mar 02
Location: Worcestershire Drives: Defender
User status: Offline
4th Oct 06 at 19:49   View Garage View User's Profile U2U Member Reply With Quote

thread dump is completed, now tells you when it was trashed and who by

also stopped it from showing in the results from show posts since last visit

 
New Topic

New Poll

  Related Threads Author Forum Replies Views Last Post
Change of plan... (New Car decision) Pablo General Chat 36 986
9th Jun 03 at 11:38
by B4RVO
 
garage clearout RobHayes Parts Offered 20 855
13th Nov 04 at 10:40
by RobHayes
 
polishing and restoring Jas General Chat 23 673
24th Mar 05 at 12:49
by jakethesnake
 
Decisions Decisions Tas General Chat 14 544
11th Dec 05 at 23:46
by Tony05
 
arden blue parts and others PICS corsa120 Parts Offered 9 620
9th Jan 06 at 22:18
by corsa120
 

Corsa Sport » Message Board » Off Day » Geek Day » Unsure if anyone can help me with this 29 database queries in 0.0146461 seconds