FM Design
Would you like to react to this message? Create an account in a few clicks or log in to continue.

IMPORTANT

FM Design is in read-only mode, please click here for more information.

Latest topics
» Forumactif Edge - Releases
by Ange Tuteur Tue 03 Sep 2019, 11:49

» GIFActif - Giphy Button for the Editor
by Ange Tuteur Wed 08 May 2019, 17:21

» Forum Closure
by Ange Tuteur Mon 01 Jan 2018, 01:28

» Chit Chat Thread
by Valoish Sun 31 Dec 2017, 19:15

» Font/Text background color.
by Valoish Sun 31 Dec 2017, 19:11

» Forumactif Messenger - Instant Message Application for Forumotion
by Wolfuryo Sun 31 Dec 2017, 18:24

» [GAME] Count to One Million!
by brandon_g Fri 29 Dec 2017, 18:58

» Post Cards
by manikbiradar Wed 20 Dec 2017, 07:50

» [GAME] Countdown from 200,000
by Valoish Wed 13 Dec 2017, 23:22

» GeekPolice Tech Support Forums - GeekPolice.net
by Dr Jay Mon 11 Dec 2017, 19:12

» Asking about some plugin for Forumotion
by Dr Jay Mon 11 Dec 2017, 19:10

» [GAME] What are you thinking right now?
by Van-Helsing Sat 09 Dec 2017, 14:51

» Widget : Similar topics
by ranbac Wed 06 Dec 2017, 18:11

» Change the Background of the Forum and put an image and how to make prefixs?
by Clement Wed 06 Dec 2017, 15:19

» Hello from Western Australia
by SarkZKalie Wed 06 Dec 2017, 05:34

Recent Tutorials
Top posting users this month

Who is online?
In total there are 14 users online :: 0 Registered, 0 Hidden and 14 Guests

None

[ View the whole list ]


Most users ever online was 515 on Tue 14 Sep 2021, 15:24

Post a message automatically when locking a topic

View previous topic View next topic Go down

Wolfuryo
Wolfuryo

Gender : Male
Posts : 256
Points : 3558
Reputation : 81
Language : Romanian and English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other

PostWolfuryo Fri 12 May 2017, 09:58

This code should work on any forum version with no problems. It posts a predefined messages when you lock a topic. Add this code in the JavaScript Management Section with placement on the topics:
Code:
$(function(){/*Main jquery funtion*/
//By Wolfuryo//
//Free to use or modify, but you have to keep this notice here//
//Use at your own risk :D//
var message="Topic locked";/*The message to be posted*/
var active=true;/*Set to false to deactivate the script*/
//Do not modify anything below unless you know what you are doing//
var path=window.location.pathname;/*The current page*/
var reg=/t\d+\-/;/*Test to see if the current page is a topic*/
var elem=$("a[href*='/modcp?mode=lock']");/*Lock topic link*/
var link;/*Used later*/
if(!reg.test(path) || !elem.length || !active) return;/*Wrong page or no element, do not continue*/
$("a[href*='/modcp?mode=lock'], a[href*='/modcp?mode=lock']>img").click(function(e){/*Lock topic button is clicked*/
e.preventDefault();/*Prevent the page to automatically go to the lock topic page*/
link=$("a[href*='/modcp?mode=lock']").attr("href");/*Get the lock topic page's link*/
$.post("/post",{/*Post message*/
mode:"reply",/*Post mode as reply*/
t:parseInt(link.match(/\d+/)[0]),
message:message,/*Message*/
post:"Ok"/**/
}).always(function(){/*When the message is posted or error happens*/
window.location=link.split("%3F").join("?");/*Go to the lock topic page*/
})/*Close the function*/
})/*Close the click event*/
})/*Close the main function*/

Modifications

Code:
var message="Topic locked";
-replace "Topic locked" with whatever you want;
Code:
var active=true
-replace true with false if you want to deactivate the script without deleting it.

If you have any problem with the code, feel free to ask me.


Last edited by Andrei34 on Sat 13 May 2017, 04:31; edited 1 time in total

TonnyKamper likes this post

Anita
Anita

Gender : Female
Posts : 26
Points : 2569
Reputation : 10
Location : [404 - Not Found]
Language : English, Spanish, Rubbish
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Forumactif Edge

PostAnita Fri 12 May 2017, 16:35

Wow! This sounds great! Huzzah I love the line, "Use at your own risk". LOL! Laughing Laughing Laughing

I inserted the script. As soon as I locked the topic, it led me to a 404 page, and the returned to the topic, which was still unlocked. I wonder why...


Cheers, mate! Bow 2
Wolfuryo
Wolfuryo

Gender : Male
Posts : 256
Points : 3558
Reputation : 81
Language : Romanian and English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other

PostWolfuryo Sat 13 May 2017, 00:46

The code doesn't get the good link for the lock topic page I think Think What is your forum link? Also please send me a pm with an account that has moderation rights.
Milouze14
Milouze14

Gender : Male
Age : 58
Posts : 79
Points : 2823
Reputation : 23
Location : French Vendée
Language : French
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Forumactif Edge
https://www.milouze14.com/

PostMilouze14 Sat 13 May 2017, 02:24

Hello @Andrei34 ,

thank for the work .
At the end of your script, you forgot one because it was not functional on my phpbb2 fofo

Code:
 })/*Close the main function*/


Functional script at home
Code:
 });/*Close the main function*/

Thanks for the script, but I encounter the same worries about my EDGE version,
Putting at the end of the script; It becomes functional but that by the drop-down menu though when I look in the source code, whether it is with your script or without the link is the same but the redirection page says with your script:

Code:
http://punbb.forumactif.org/modcp%3Fmode=lock&
instead of :

Code:
http://punbb.forumactif.org/modcp?mode=lock&t=


Hoping to have helped my friend Wink

a++
Wolfuryo
Wolfuryo

Gender : Male
Posts : 256
Points : 3558
Reputation : 81
Language : Romanian and English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other

PostWolfuryo Sat 13 May 2017, 02:31

Let me see if I got it right. The script works on phpbb2, but not on edge?
Milouze14
Milouze14

Gender : Male
Age : 58
Posts : 79
Points : 2823
Reputation : 23
Location : French Vendée
Language : French
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Forumactif Edge
https://www.milouze14.com/

PostMilouze14 Sat 13 May 2017, 02:33

Sorry, I'm french,
The script is not functional whatsoever for the version phpbb2, punbb and EDGE
Milouze14
Milouze14

Gender : Male
Age : 58
Posts : 79
Points : 2823
Reputation : 23
Location : French Vendée
Language : French
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Forumactif Edge
https://www.milouze14.com/

PostMilouze14 Sat 13 May 2017, 02:39

Milouze14 wrote:Sorry, I'm french,
The script is not functional whatsoever for the version phpbb2, punbb and EDGE

The problem is here in the redirection page:


with your script:
Code:
%3F

instead of :
Code:
?


Ahhh I quoted instead of editing Razz Razz

Wolfuryo
Wolfuryo

Gender : Male
Posts : 256
Points : 3558
Reputation : 81
Language : Romanian and English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other

PostWolfuryo Sat 13 May 2017, 03:04

Replace the code with:
Code:
$(function(){/*Main jquery funtion*/
//By Wolfuryo//
//Free to use or modify, but you have to keep this notice here//
//Use at your own risk :D//
var message="Topic locked";/*The message to be posted*/
var active=true;/*Set to false to deactivate the script*/
//Do not modify anything below unless you know what you are doing//
var path=window.location.pathname;/*The current page*/
var reg=/t\d+\-/;/*Test to see if the current page is a topic*/
var elem=$("a[href*='/modcp?mode=lock']");/*Lock topic link*/
var link;/*Used later*/
if(!reg.test(path) || !elem.length || !active) return;/*Wrong page or no element, do not continue*/
elem.click(function(e){/*Lock topic button is clicked*/
e.preventDefault();/*Prevent the page to automatically go to the lock topic page*/
link=$(this).attr("href");/*Get the lock topic page's link*/
$.post("/post",{/*Post message*/
mode:"reply",/*Post mode as reply*/
t:parseInt(link.match(/\d+/)[0]),
message:message,/*Message*/
post:"Ok"/**/
}).always(function(){/*When the message is posted or error happens*/
window.location.pathname=decodeURI(link);/*Go to the lock topic page*/
})/*Close the function*/
})/*Close the click event*/
})/*Close the main function*/
I'll update the first post after someone confirms this code is working.
Milouze14
Milouze14

Gender : Male
Age : 58
Posts : 79
Points : 2823
Reputation : 23
Location : French Vendée
Language : French
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Forumactif Edge
https://www.milouze14.com/

PostMilouze14 Sat 13 May 2017, 03:18

Thank,
but on my punbb test forum, it's always the same redirect page 404 with always this
Code:
%3F
in place of
Code:
?



It is only this damn redirection page that is nonfunctional because when we return to the subject, the message is present for information


Last edited by Milouze14 on Sat 13 May 2017, 03:22; edited 1 time in total
Wolfuryo
Wolfuryo

Gender : Male
Posts : 256
Points : 3558
Reputation : 81
Language : Romanian and English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other

PostWolfuryo Sat 13 May 2017, 03:21

Code:
        $(function(){/*Main jquery funtion*/
        //By Wolfuryo//
        //Free to use or modify, but you have to keep this notice here//
        //Use at your own risk :D//
        var message="Topic locked";/*The message to be posted*/
        var active=true;/*Set to false to deactivate the script*/
        //Do not modify anything below unless you know what you are doing//
        var path=window.location.pathname;/*The current page*/
        var reg=/t\d+\-/;/*Test to see if the current page is a topic*/
        var elem=$("a[href*='/modcp?mode=lock']");/*Lock topic link*/
        var link;/*Used later*/
        if(!reg.test(path) || !elem.length || !active) return;/*Wrong page or no element, do not continue*/
        elem.click(function(e){/*Lock topic button is clicked*/
        e.preventDefault();/*Prevent the page to automatically go to the lock topic page*/
        link=$(this).attr("href");/*Get the lock topic page's link*/
        $.post("/post",{/*Post message*/
        mode:"reply",/*Post mode as reply*/
        t:parseInt(link.match(/\d+/)[0]),
        message:message,/*Message*/
        post:"Ok"/**/
        }).always(function(){/*When the message is posted or error happens*/
        window.location.pathname=decodeURI(link.replace("%3F", "?"));/*Go to the lock topic page*/
        })/*Close the function*/
        })/*Close the click event*/
        })/*Close the main function*/
See if this works.
Milouze14
Milouze14

Gender : Male
Age : 58
Posts : 79
Points : 2823
Reputation : 23
Location : French Vendée
Language : French
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Forumactif Edge
https://www.milouze14.com/

PostMilouze14 Sat 13 May 2017, 03:26

Sorry Andrei34 ,
but not functional on the phpbb2, phpbb3 et punbb

It is only this redirection page that is non functional because when we return to the subject, the message is present for information
Wolfuryo
Wolfuryo

Gender : Male
Posts : 256
Points : 3558
Reputation : 81
Language : Romanian and English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other

PostWolfuryo Sat 13 May 2017, 04:03

Code:
$(function(){/*Main jquery funtion*/
//By Wolfuryo//
//Free to use or modify, but you have to keep this notice here//
//Use at your own risk :D//
var message="Topic locked";/*The message to be posted*/
var active=true;/*Set to false to deactivate the script*/
//Do not modify anything below unless you know what you are doing//
var path=window.location.pathname;/*The current page*/
var reg=/t\d+\-/;/*Test to see if the current page is a topic*/
var elem="a[href*='/modcp?mode=lock']";/*Lock topic link*/
var link;/*Used later*/
if(!reg.test(path) || !elem.length || !active) return;/*Wrong page or no element, do not continue*/
$("a[href*='/modcp?mode=lock'], a[href*='/modcp?mode=lock']>img").click(function(e){/*Lock topic button is clicked*/
e.preventDefault();/*Prevent the page to automatically go to the lock topic page*/
link=$("a[href*='/modcp?mode=lock']").attr("href");/*Get the lock topic page's link*/
$.post("/post",{/*Post message*/
mode:"reply",/*Post mode as reply*/
t:parseInt(link.match(/\d+/)[0]),
message:message,/*Message*/
post:"Ok"/**/
}).always(function(){/*When the message is posted or error happens*/
window.location=link.split("%3F").join("?");/*Go to the lock topic page*/
})/*Close the function*/
})/*Close the click event*/
})/*Close the main function*/
I tested it on punbb and edge and it works perfectly.
Milouze14
Milouze14

Gender : Male
Age : 58
Posts : 79
Points : 2823
Reputation : 23
Location : French Vendée
Language : French
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Forumactif Edge
https://www.milouze14.com/

PostMilouze14 Sat 13 May 2017, 04:27

Hummmmm, you want a good news my friend?
Your script is functional on the versions, phpbb2, phpbb3, Punbb, Invision and Edge cheers cheers cheers

A big thank you for your dedication Wink .

a++
Wolfuryo
Wolfuryo

Gender : Male
Posts : 256
Points : 3558
Reputation : 81
Language : Romanian and English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other

PostWolfuryo Sat 13 May 2017, 04:29

Yay Party I edited the first post with the good code. This script caused me a little headache lol
Thanks for testing it Smile
ThunderTB
ThunderTB
New Member
Gender : Unspecified
Posts : 2
Points : 2322
Reputation : 0
Language : French
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : phpBB2

PostThunderTB Sun 12 Nov 2017, 13:51

Thank you , very handy .
Sponsored content

PostSponsored content

View previous topic View next topic Back to top

Create an account or log in to leave a reply

You need to be a member in order to leave a reply.

Create an account

Join our community by creating a new account. It's easy!


Create a new account

Log in

Already have an account? No problem, log in here.


Log in

 
Permissions in this forum:
You cannot reply to topics in this forum