Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.5 > vBulletin 3.5 Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Fork Threads Details »»
Fork Threads
Version: 1.0.1, by GilbertZ GilbertZ is offline
Developer Last Online: Jul 2007 Show Printable Version Email this Page

Version: 3.5.0 RC2 Rating:
Released: 08-15-2005 Last Update: 10-08-2005 Installs: 49
Uses Plugins Template Edits
Additional Files Is in Beta Stage  
No support by the author.

Boring Preamble
Sometimes a thread gets really long or some posts generate interesting but off topic conversation. I wanted to test the new cool product manager system and thought of this very simple mod to add Fork Thread functionality to the end user.

What it does
Allows the end user to divert off-topic tangents into a new thread, while automatically quoting the original thread.

Specs
Plugin: Included

Phrases added automatically: 2
fork_prefix and fork_this_post

Templates added automatically: 1
newpost_fork

Templates to edit: 1
postbit or postbit_legacy

Images to upload: 1 (optional)
fork.gif

How to Install

This is a full blown plugin. Follow the usual instructions for a plugin. Then you have to edit the postbit or postbit_legacy template.

For the graphical version you have to insert these lines where you want the link to appear:
PHP Code:
<a href="newthread.php?fork=1&do=newthread&p=$post[postid]"><img src="$stylevar[imgdir_button]/fork.gif" alt="$vbphrase[fork_this_post]border="0" /></a
For the text version use this code:
PHP Code:
<a href="newthread.php?fork=1&do=newthread&p=$post[postid]">$vbphrase[fork_this_post]</a
You may want to place it in an "if" conditional so that only users who can post New Threads will see the image. Just use the same code as what's embedded in the "quote" image.

Updated to version 1.0.1 on 08/18/2005

*Modified to use the phrase manager.
*Fixed minor bug when "Automatically Quote Post / Thread Title" was set to "no".
*Fixed minor bug where after processing the title I pointed to the wrong variable

Preview and Live Demo

Preview attached. Or you can Register and try to fork the posts in the fork me thread.

Graphics help solicited

The quickie image I put together of a fork sucks
If someone comes up with an edited image of the .psd file vb comes with I will edit this post.

Wishlist for this mod

1. I doubt I will have the time to put this together, but it would be nice if there was a dropdown with forums the user has permission to post in so that the user can fork the thread to a different forum.
2. Adding a post to the original thread stating it had been forked and a link to the new thread

Final note

Oblivion Knight donated an image you can use of a fork (Thanks). It is attached to this post.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #32  
Old 08-16-2005, 09:25 PM
Oblivion Knight's Avatar
Oblivion Knight Oblivion Knight is offline
 
Join Date: May 2002
Location: Sheffield, UK
Posts: 1,757
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by GilbertZ
I wasn't sure the best way to handle that as the setting is set to "yes" for me.

Are you saying you want the post part of it to quote the title and leave the subject blank?
No, I have no problem with the way that the plugin functions..

However, if the option is set to "No" - it should be grabbing the thread's title and inserting that instead of having nothing. Otherwise you could end up with several threads with "Forked Thread: " as the title - which makes no sense really.
Reply With Quote
  #33  
Old 08-16-2005, 09:43 PM
GilbertZ GilbertZ is offline
 
Join Date: Nov 2004
Posts: 51
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Oblivion Knight
No, I have no problem with the way that the plugin functions..

However, if the option is set to "No" - it should be grabbing the thread's title and inserting that instead of having nothing. Otherwise you could end up with several threads with "Forked Thread: " as the title - which makes no sense really.
I was misunderstanding you. Now I think I see what you mean. You're saying that the "No" setting should not apply here since it is a forked thread, rather than a quoted post. Correct?

To fix it change

PHP Code:
if ($vbulletin->options['quotetitle'])
{
    if (
$parentposttitle != '')
    {
        
$posttitle $parentposttitle;
    }
    else
    {
        
$posttitle $threadinfo['title'];
    }
    
$posttitle unhtmlspecialchars($posttitle);
    
$posttitle preg_replace('#^(' preg_quote($vbphrase['reply_prefix'], '#') . '\s*)+#i'''$posttitle);
    
$newpost['title']="Fork of: $postinfo[title]";
}
else
{
    
$newpost['title']="Forked Thread: ";

to

PHP Code:
if ($parentposttitle != '')
{
    
$posttitle $parentposttitle;
}
else
{
    
$posttitle $threadinfo['title'];
}
$posttitle unhtmlspecialchars($posttitle);
$posttitle preg_replace('#^(' preg_quote($vbphrase['reply_prefix'], '#') . '\s*)+#i'''$posttitle);
$newpost['title']="Fork of: $postinfo[title]"
If that's what you meant I'll fix the original file.

Thanks for the feedback.
Reply With Quote
  #34  
Old 08-17-2005, 08:13 AM
Oblivion Knight's Avatar
Oblivion Knight Oblivion Knight is offline
 
Join Date: May 2002
Location: Sheffield, UK
Posts: 1,757
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I changed this part of code:
Code:
$newpost['title']="Fork of: $postinfo[title]";
To this:
Code:
$newpost['title'] = "Fork of: $posttitle";
Now it's working how I wanted.. Thanks
Reply With Quote
  #35  
Old 08-17-2005, 11:29 PM
Erwin's Avatar
Erwin Erwin is offline
 
Join Date: Jan 2002
Posts: 7,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Best forum idea for a long time! Won't be surprised if it gets incorporated as standard in future.
Reply With Quote
  #36  
Old 08-18-2005, 12:48 AM
TTG's Avatar
TTG TTG is offline
 
Join Date: May 2004
Location: Sth London
Posts: 1,042
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Erwin
Best forum idea for a long time! Won't be surprised if it gets incorporated as standard in future.
Agree with that .. excellent idea.
Clicked install.

Might be a good idea to zip the download.
Reply With Quote
  #37  
Old 08-18-2005, 05:17 AM
GilbertZ GilbertZ is offline
 
Join Date: Nov 2004
Posts: 51
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by TTG
Agree with that .. excellent idea.
Clicked install.
Thanks.

Quote:
Might be a good idea to zip the download.
Really?
I don't know the protocol here, but the xml file is only 2.5k. And all images are precompressed and anyway mostly for preview. Would people really find it helpful to have a zip?

Quote:
Originally Posted by Erwin
Best forum idea for a long time! Won't be surprised if it gets incorporated as standard in future.
Thanks Doc. I've installed some of your awesome hacks, so I appreciate the compliment coming from you

Quote:
Originally Posted by Oblivion Knight
I changed this part of code:
Code:
$newpost['title']="Fork of: $postinfo[title]";
To this:
Code:
$newpost['title'] = "Fork of: $posttitle";
Now it's working how I wanted.. Thanks
Good catch
Now updated


NOTE TO ALL:
If you've installed this already and want to update, just uninstall and reinstall. Even the template you edited will probably not need to be touched.

If the current version is working for you I don't think you need to bother upgrading. It's not a major upgrade. The changes pretty much relate to phrases and if you had the "Quote Title on Reply" set to no.
Reply With Quote
  #38  
Old 08-23-2005, 01:50 PM
amykhar's Avatar
amykhar amykhar is offline
 
Join Date: Oct 2001
Location: PA
Posts: 4,438
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I LOVE this mod. A couple of feature suggestions/requests though.

1. Allow forked threads to be posted in a different forum than the one the original thread is in - based on forum permissions of course.
2. Add an admin/mod feature that would allow mods to fork and split a thread at the same time. In other words, I would fork a thread based on post x. Post x would be quoted and carried to the new thread. BUT, I could also select post y,z and q to be split from the original thread and added to the new one.

This is different from a regular split in that post x would stay in the original thread, just as in a regular thread forking.

Amy
Reply With Quote
  #39  
Old 08-23-2005, 01:58 PM
KW802's Avatar
KW802 KW802 is offline
 
Join Date: Jul 2003
Location: A galaxy far, far away...
Posts: 1,450
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Erwin
Best forum idea for a long time!
Agreed -- I wonder if it's too late to bug the Jelsoft guys about this for vB 3.5......

This has joined "auto-merge doubleposts" on my lists of features that should be stock.
Reply With Quote
  #40  
Old 08-23-2005, 06:50 PM
GilbertZ GilbertZ is offline
 
Join Date: Nov 2004
Posts: 51
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by amykhar
I LOVE this mod. A couple of feature suggestions/requests though.

1. Allow forked threads to be posted in a different forum than the one the original thread is in - based on forum permissions of course.
2. Add an admin/mod feature that would allow mods to fork and split a thread at the same time. In other words, I would fork a thread based on post x. Post x would be quoted and carried to the new thread. BUT, I could also select post y,z and q to be split from the original thread and added to the new one.

This is different from a regular split in that post x would stay in the original thread, just as in a regular thread forking.

Amy
Thanks Amy. Part 1 is in the wishlist. I know I won't have time for awhile to add it.

I've coded a feature like that for another (private) mod I've done in the 3.0 series, but I haven't seen enough code from 3.50 to be sure how to get the permissions right on that one.

It's probably only a couple of lines, but I need the sql code to popup up a list of forums the current user is allowed to post in. It took awhile to figure out how to do that correctly in 3.0. It also needs the displayorder of the forums. And no parent forums can be in the list unless they are open to new posts. So this is not the same code used in forumjump.

If someone feels like coming up with that sql code, I can probably do the rest pretty quickly.

Suggestion 2 is a great one. I've never modded the split code at all, so not sure what that would entail. Definitely don't have time to work on that one. But I'll add it to the wishlist when I get a chance.
Reply With Quote
  #41  
Old 08-23-2005, 07:28 PM
amykhar's Avatar
amykhar amykhar is offline
 
Join Date: Oct 2001
Location: PA
Posts: 4,438
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You may not need to query the forums at all. It might be available in the cache. I used a simple bit of code:

Code:
$forumchoice = array();

foreach (array_keys($vbulletin->forumcache) AS $forumid)
{
		$forumid = intval($forumid);
		$forumperms =& $vbulletin->userinfo['forumpermissions']["$forumid"];

		if (isset($vbulletin->forumcache["$forumid"]) AND ($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) AND ($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers']) AND verify_forum_password($forumid, $vbulletin->forumcache["$forumid"]['password'], false))
		{
			$forumchoice[] = $forumid;
		}
}
to get me all of the forums that a user was allowed to view. You could probably use very similar code to get the ones that they can post in.
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 10:02 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04977 seconds
  • Memory Usage 2,349KB
  • Queries Executed 25 (?)
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
  • (5)bbcode_code
  • (4)bbcode_php
  • (9)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)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_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