PDA

View Full Version : Mini Mods - Create new thread button


delicjous
08-25-2019, 09:00 PM
I made a mod for this in the past, but I decide to make it compatible with cloud.

Installinstructions:

Just create a template and hook it to footer_before_body_end.

-Create a template: /admincp/template.php?do=modify& -> choose action dropdown -> Add new template.

Hook it to footer_before_body_end: /admincp/hook.php? Create new hook at the bottom, choose the mentioned hook and put the name of the template into "Template Name".

Fill the template with the following code:
<style>
.deli-crneto li {
font-size:15px;
margin-bottom:5px;
line-height:16px;
}
.deli-crneto #btnConfirmDialogYes {
display:none;
}
.deli-crneto .delicnt_cat {
background-color:lightgray;
}
</style>
<script>
function delinewthreadpopup(){var a=openConfirmDialog({title:vBulletin.phrase.get("create_new_topic"),message:vBulletin.phrase.get("loading")+"...",width:500,dialogClass:"deli-crneto loading",buttonLabel:{noLabel:vBulletin.phrase.get("cancel")}});vBulletin.AJAX({call:"/ajax/api/node/fetchChannelNodeTree",data:{parentid:2,depth:5,pagenum:1,perpage:150},s uccess:function(e){$(".deli-crneto").removeClass("loading"),$(".dialog-content .message",a).html('<ul class="crneto_list"></ul>'),$.each(e.channels,function(e,a){var t=pageData.baseurl+"/new-content/"+e;1==a.category?$(".crneto_list").append('<li class="depth_'+a.depth+' delicnt_cat">'+a.title+"</li>"):$(".crneto_list").append('<li class="depth_'+a.depth+'"><a href="'+t+'"> '+a.title+"</a></li>"),void 0!==a.subchannels&&$.each(a.subchannels,function(e,a){var t=pageData.baseurl+"/new-content/"+e;$(".crneto_list").append('<li class="depth_'+a.depth+'"><a href="'+t+'"> &nbsp&nbsp '+a.title+"</a></li>"),void 0!==a.subchannels&&$.each(a.subchannels,function(e,a){var t=pageData.baseurl+"/new-content/"+e;$(".crneto_list").append('<li class="depth_'+a.depth+'"><a href="'+t+'"> &nbsp&nbsp&nbsp&nbsp '+a.title+"</a></li>")})})})},error:vBulletin.ajaxtools.logAjaxError,ap i_error:vBulletin.ajaxtools.logApiError})}$("#delicreatenewthread").click(function(e){e.preventDefault(),delinewthre adpopup()});
</script>


Now you could place a button everywhere you want like that:
<button id="delicreatenewthread" class="b-button b-button--special" type="submit">Create a new Thread</button>

You could also use every other html-tags. Just put the id on it: id="delicreatenewthread"

It is just an example but ready to use.

Kinkshaven
08-26-2019, 06:51 PM
Hmm this breaks our registration forum

delicjous
08-27-2019, 01:39 AM
Hmm this breaks our registration forum

Please try the updated code. There was a wrong script-tag at the end of it. Iam sorry!

migratoria
08-27-2019, 10:14 AM
You have a screenshot?

Kinkshaven
08-27-2019, 11:21 AM
You have a screenshot?
Here you go I attached some (please ignore the black out it's just we run a NSFW forum)

alphega
05-07-2020, 01:05 PM
Hello, thanks for this mod.

But for me it works not on VB 5.6.0, a blank Windows appears, load few instants and display nothing. Any idea please ?

https://www.cnetfrance.fr/i/edit/fo/2020/05/button.jpg

delicjous
05-07-2020, 01:48 PM
Did you update from a previous version or is it a fresh installed vB?

alphega
05-08-2020, 11:49 AM
Thanks for your reply :)

It's a fresh update from VB4. I tried to set it in module, notices and templates but got the same result.

delicjous
05-08-2020, 03:51 PM
I will take a look as soon I have time for it

ywwz
09-11-2020, 03:27 AM
5.6.3 compatible?