We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Locked Topic
[ C ] Redirect After New topic/Post
Topic Started: Aug 29 2017, 11:26 AM (1,572 Views)
JamieMN
Member
[ *  *  * ]
Hi,

Is there a script that could help me achieve the below?

Basic Request: I want to do it so when a person creates a topic in a specific subforum, once they post it, it'll automatically re-direct them to a certain web page?

Advanced: (if possible): The same as above BUT if a new person posts on that topic, they'll get redirected to the web page when they post the first time. So unique member posts on a topic under that subforum.
Offline Profile Goto Top
 
DaPizzaMan
Member Avatar
#TeamSupport

Just to clarify, this should only apply to creating topics in a specific forum, not subsequent posts in response to the original topic, correct?

For example, when you make a topic (such as the one above this post), you will be redirected. However, if I make a post (such as this one), nothing will happen.
Offline Profile Goto Top
 
JamieMN
Member
[ *  *  * ]
Yes ^^
Offline Profile Goto Top
 
DaPizzaMan
Member Avatar
#TeamSupport

Admin CP > Board Template > Below the Board
Code:
 
<script type="text/javascript">
var topicRedirect = {};
$(function() {
topicRedirect.redirectURL = 'http://support.zathyus.com/topic/7011760/1/#new';
var hasCookie = $.zb.get('redirectAfterTopic') !== '';

$('form.exclusivebutton:has(input[name="mode"][value="1"]):has(input[name="type"][value="1"]):has(input[name="f"]):not(:has(input[name="t"]))').submit(function() {
$.zb.set('redirectAfterTopic', 'true');
});

if (location.href.indexOf('/post/') === -1 && hasCookie) {
topicRedirect.redirectURL = $.trim(topicRedirect.redirectURL);
$.zb.del('redirectAfterTopic');
window.location.replace(topicRedirect.redirectURL);
}
});
</script>
Simply add the redirect URL between the apostrophes on the line that starts with topicRedirect.redirectURL (this topic URL is currently the placeholder).
Offline Profile Goto Top
 
JamieMN
Member
[ *  *  * ]
Is there a way I can do it so it'll only redirect to the redirectURL if the topic is posted in forum 6004700 ?
Offline Profile Goto Top
 
DaPizzaMan
Member Avatar
#TeamSupport

Sure thing!

Code:
 
<script type="text/javascript">
var topicRedirect = {};
$(function() {
topicRedirect.redirectURL = 'http://support.zathyus.com/topic/7011760/1/#new';
topicRedirect.forumIDs = [123, 456];
var hasCookie = $.zb.get('redirectAfterTopic') !== '';

if ($.inArray(parseInt($('form.exclusivebutton input[name="f"]').val(), 10), topicRedirect.forumIDs) !== -1) {
$('form.exclusivebutton:has(input[name="mode"][value="1"]):has(input[name="type"][value="1"]):has(input[name="f"]):not(:has(input[name="t"]))').submit(function() {
$.zb.set('redirectAfterTopic', 'true');
});
}

if (location.href.indexOf('/post/') === -1 && hasCookie) {
topicRedirect.redirectURL = $.trim(topicRedirect.redirectURL);
$.zb.del('redirectAfterTopic');
window.location.replace(topicRedirect.redirectURL);
}
});
</script>
Offline Profile Goto Top
 
JamieMN
Member
[ *  *  * ]
Perfect, works great^^ Thank you! :D
Offline Profile Goto Top
 
DaPizzaMan
Member Avatar
#TeamSupport

Completed!

Your request has been completed. If you have any questions or concerns regarding the state of your request, please feel free to contact me via PM.
Offline Profile Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Closed Requests · Next Topic »
Locked Topic