Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 11-13-2010, 07:38 PM
Arrogant-One's Avatar
Arrogant-One Arrogant-One is offline
 
Join Date: Jul 2007
Location: Brisbane
Posts: 196
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Additional Re-Direct Option

Firstly, let me say I made an honest and lengthy attempt to do this myself before bothering my fellow vB owners.

The Goal

I have a vB forum catering to chess players. Obviously tournaments are played and announced regularly, although the Calendar feature gets ignored big time.

What I would like to have is, when a member posts a new thread about their upcoming chess tournament, an option like the Post a Poll Option.

As everyone is aware the poll option firstly posts the members post as post #1 of the new thread, and then it re-directs them to the create your poll page.

I'm after pretty much the same thing, except once they have posted their first post in the new thread, I want them redirected to the Ranged Calendar entry page -

http://www.ozchess.com.au/calendar.php?do=add&c=1

As the Additional Options are often ignored, I was hoping this could be a button alongside the Submit New Thread and Preview Post buttons when someone is posting a new thread. Maybe the button could be called New Thread + Calendar Entry.

Is there anyone who could please tell me how I can achieve this?
Reply With Quote
  #2  
Old 11-13-2010, 08:23 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

In template newthread you can add your button like this: find the existing buttons by searching for submit_new_thread and add
Code:
<input type="submit" class="button" name="calendar" value="New Thread + Calendar Entry" accesskey="c" tabindex="1" />
(you can make a phrase for it if you want)


Then add a plugin to get the value if that button is pushed: hook location newthread_post_start, code:
PHP Code:
$newthread['calendar'] = $vbulletin->input->clean_gpc('p''calendar'TYPE_STR); 

One more plugin to redirect to the calendar, hook location newthread_post_complete, code:
PHP Code:
if ($newthread['calendar'])
{
    
$vbulletin->url 'calendar.php?' $vbulletin->session->vars['sessionurl'] . "do=add&c=1";
    if (
$forumperms $vbulletin->bf_ugp_forumpermissions['canviewthreads'])
    {
        eval(
print_standard_redirect('redirect_postthanks'truetrue));
    }
    else
    {
        eval(
print_standard_redirect('redirect_postthanks_nopermission'truetrue));
    }

If you want you might want to make another phrase that says "Thanks for posting, now you're going to the calendar" or something like that (although I find you don't often really see that page anyway). BTW, I don't know if you really need the check for permissions here, but I just copied the code for submitting a poll).

The only thing about this is that after filling in the calendar entry it won't take you back to your thread, but maybe that's OK (or maybe you can work that part out).
Reply With Quote
  #3  
Old 11-14-2010, 05:54 AM
Arrogant-One's Avatar
Arrogant-One Arrogant-One is offline
 
Join Date: Jul 2007
Location: Brisbane
Posts: 196
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you dude!

You are a legend. Thanks again.
Reply With Quote
  #4  
Old 11-26-2010, 07:10 AM
Arrogant-One's Avatar
Arrogant-One Arrogant-One is offline
 
Join Date: Jul 2007
Location: Brisbane
Posts: 196
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The above didn't work unfortunately
Reply With Quote
  #5  
Old 11-26-2010, 08:49 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, I did test it before posting, but it's possible that your setup is different somehow, or maybe I misunderstood what you wanted. Does it not work at all, or what does it do?
Reply With Quote
  #6  
Old 11-28-2010, 10:44 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I made the above changes into the attached product file you can import, and I also added phrases.
Attached Files
File Type: xml product-calendar_redirect.xml (2.3 KB, 2 views)
Reply With Quote
  #7  
Old 11-29-2010, 01:56 PM
Shanj Shanj is offline
 
Join Date: Oct 2006
Location: Wales UK
Posts: 155
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

kh9 this looks like good work I think it's the kind of thing quite a few will want.

What I need is to make all new posts in a selected forum redirect to a certain URL once they have posted.
Not as a user option, as 100% always.
I need to put it on several forums but it is always the same URL destination.

Is that possible?
Reply With Quote
  #8  
Old 11-29-2010, 02:40 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes, you could just copy the code that's under the hook location into a plugin so you can change it. In other words, make a new plugin using hook location newthread_post_complete with this code:

PHP Code:
if ($newpost['postpoll']) // user selected poll
{
    
$vbulletin->url 'poll.php?' $vbulletin->session->vars['sessionurl'] . "t=$newpost[threadid]&polloptions=$newpost[polloptions]";
    if (
$forumperms $vbulletin->bf_ugp_forumpermissions['canviewthreads'])
    {
        eval(
print_standard_redirect('redirect_postthanks'truetrue));
    }
    else
    {
        eval(
print_standard_redirect('redirect_postthanks_nopermission'truetrue));
    }
}
else if (
$newpost['visible']) // normal submit
{
    if (
$forumperms $vbulletin->bf_ugp_forumpermissions['canviewthreads'])
    {
                                
// user has permission to see thread (this is probably the "normal" case)
        
$vbulletin->url 'showthread.php?' $vbulletin->session->vars['sessionurl'] . "p=$newpost[postid]#post$newpost[postid]";
        eval(
print_standard_redirect('redirect_postthanks'));
    }
    else
    {
                                
// user can't see thread
        
$vbulletin->url 'forumdisplay.php?' $vbulletin->session->vars['sessionurl'] . "f=$foruminfo[forumid]";
        eval(
print_standard_redirect('redirect_postthanks_nopermission'truetrue));
    }
}
else
{
                
// Thread waiting for moderation
    
$vbulletin->url 'forumdisplay.php?' $vbulletin->session->vars['sessionurl'] . "f=$foruminfo[forumid]";
    eval(
print_standard_redirect('redirect_postthanks_moderate'truetrue));

Then change the "$vbulletin->url =" lines as needed. You probably don't want to change the redirect to poll.php, so if the user is adding a poll you'd have to do something more complicated to get it to redirect after adding the poll. But you could change the other 3 $vbulletin->url lines to get it to redirect somewhere else, for instance:

Code:
$vbulletin->url = "http://www.foo.com";
I hope that makes sense. I guess it would be nice to have acp options to set the url, but this will work.
Reply With Quote
  #9  
Old 11-29-2010, 04:33 PM
Shanj Shanj is offline
 
Join Date: Oct 2006
Location: Wales UK
Posts: 155
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

kr9 I get the outline but I'll need to ask you more questions. Hope that's OK.
Right now I don't see how to make this apply to a selected forum only.
Reply With Quote
  #10  
Old 11-29-2010, 04:56 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Oh..sorry, I missed that part. you could do something like this:

PHP Code:
if (in_array($foruminfo['forumid'], array(123))) // list your forum ids in place of 1, 2, 3...
    
$redirect_url "http://www.foo.com"// url to redirect to

if ($newpost['postpoll']) // user selected poll 

    
$vbulletin->url 'poll.php?' $vbulletin->session->vars['sessionurl'] . "t=$newpost[threadid]&polloptions=$newpost[polloptions]"
    if (
$forumperms $vbulletin->bf_ugp_forumpermissions['canviewthreads']) 
    { 
        eval(
print_standard_redirect('redirect_postthanks'truetrue)); 
    } 
    else 
    { 
        eval(
print_standard_redirect('redirect_postthanks_nopermission'truetrue)); 
    } 

else if (
$newpost['visible']) // normal submit 

    if (
$forumperms $vbulletin->bf_ugp_forumpermissions['canviewthreads']) 
    { 
         
// user has permission to see thread (this is probably the "normal" case) 
         
if (!empty($redirect_url))
            
$vbulletin->url $redirect_url;
         else
            
$vbulletin->url 'showthread.php?' $vbulletin->session->vars['sessionurl'] . "p=$newpost[postid]#post$newpost[postid]"
        eval(
print_standard_redirect('redirect_postthanks')); 
    } 
    else 
    { 
          
// user can't see thread 
         
if (!empty($redirect_url))
            
$vbulletin->url $redirect_url;
         else
            
$vbulletin->url 'forumdisplay.php?' $vbulletin->session->vars['sessionurl'] . "f=$foruminfo[forumid]"
        eval(
print_standard_redirect('redirect_postthanks_nopermission'truetrue)); 
    } 

else 

          
// Thread waiting for moderation 
         
if (!empty($redirect_url))
            
$vbulletin->url $redirect_url;
         else
            
$vbulletin->url 'forumdisplay.php?' $vbulletin->session->vars['sessionurl'] . "f=$foruminfo[forumid]"
    eval(
print_standard_redirect('redirect_postthanks_moderate'truetrue)); 


If you wanted you could have different forums redirect to different URLs by adding "else if" to that first if statement.

--------------- Added [DATE]1291058521[/DATE] at [TIME]1291058521[/TIME] ---------------

Sorry, the above had a mistake that I (hopefully) fixed.
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 12:57 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.07886 seconds
  • Memory Usage 2,329KB
  • Queries Executed 14 (?)
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
  • (2)bbcode_code
  • (4)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
  • (1)postbit_attachment
  • (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
  • postbit_attachment
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete