Latest topics
» [HELP] About Profile Cover Code
by omarpop23 Yesterday at 06:39

» bloquer un membre
by berlingo Fri 17 Nov 2017, 18:19

» IconSkouliki Graphics
by skouliki Fri 17 Nov 2017, 03:54

» [IN PROGRESS] Can this code work on pun version
by skouliki Thu 16 Nov 2017, 03:50

» Auto-suggest @mentions as You Type
by skouliki Wed 15 Nov 2017, 14:56

» [TUTORIAL] [ALL VERSIONS] Warning before posting
by demon99 Wed 15 Nov 2017, 08:12

» About Add Reply & New Topic button (popup form)
by omarpop23 Mon 13 Nov 2017, 20:31

» Hello everyone this is Adam from France
by Adam Mon 13 Nov 2017, 13:32

» Add a login popup for the toolbar
by Ape Sun 12 Nov 2017, 18:41

» Post a message automatically when locking a topic
by ThunderTB Sun 12 Nov 2017, 13:51

» Control pannel issue
by Ange Tuteur Sun 12 Nov 2017, 09:49

» BUG... forum members birthday's
by Ape Sat 11 Nov 2017, 11:44

» Display a Preview of Groups on Hover
by ThunderTB Fri 10 Nov 2017, 21:56

» Search box only visible on hover
by Ange Tuteur Mon 06 Nov 2017, 09:57

» [GAME] Animal Game
by SLGray Sun 05 Nov 2017, 15:04

Recent Tutorials
Who is online?
In total there are 7 users online :: 0 Registered, 0 Hidden and 7 Guests :: 2 Bots

None

[ View the whole list ]


Most users ever online was 172 on Fri 19 Feb 2016, 05:17

Post a message automatically when locking a topic

View previous topic View next topic Go down

avatar
Wolfuryo

Gender : Male
Posts : 250
Points : 1239
Reputation : 80
Language : Romanian and English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
Awards :
View all awards
View user profile

PostWolfuryo on 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
avatar
Anita

Title :
Gender : Female
Posts : 26
Points : 257
Reputation : 10
Location : [404 - Not Found]
Language : English, Spanish, Rubbish
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile

PostAnita on 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
avatar
Wolfuryo

Gender : Male
Posts : 250
Points : 1239
Reputation : 80
Language : Romanian and English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
Awards :
View all awards
View user profile

PostWolfuryo on 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.
avatar
Milouze14

Title :
Gender : Male
Age : 51
Posts : 76
Points : 507
Reputation : 22
Location : French Vendée
Language : French
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile http://www.milouze14.com/

PostMilouze14 on 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++
avatar
Wolfuryo

Gender : Male
Posts : 250
Points : 1239
Reputation : 80
Language : Romanian and English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
Awards :
View all awards
View user profile

PostWolfuryo on Sat 13 May 2017, 02:31

Let me see if I got it right. The script works on phpbb2, but not on edge?
avatar
Milouze14

Title :
Gender : Male
Age : 51
Posts : 76
Points : 507
Reputation : 22
Location : French Vendée
Language : French
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile http://www.milouze14.com/

PostMilouze14 on Sat 13 May 2017, 02:33

Sorry, I'm french,
The script is not functional whatsoever for the version phpbb2, punbb and EDGE
avatar
Milouze14

Title :
Gender : Male
Age : 51
Posts : 76
Points : 507
Reputation : 22
Location : French Vendée
Language : French
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile http://www.milouze14.com/

PostMilouze14 on 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

avatar
Wolfuryo

Gender : Male
Posts : 250
Points : 1239
Reputation : 80
Language : Romanian and English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
Awards :
View all awards
View user profile

PostWolfuryo on 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.
avatar
Milouze14

Title :
Gender : Male
Age : 51
Posts : 76
Points : 507
Reputation : 22
Location : French Vendée
Language : French
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile http://www.milouze14.com/

PostMilouze14 on 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
avatar
Wolfuryo

Gender : Male
Posts : 250
Points : 1239
Reputation : 80
Language : Romanian and English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
Awards :
View all awards
View user profile

PostWolfuryo on 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.
avatar
Milouze14

Title :
Gender : Male
Age : 51
Posts : 76
Points : 507
Reputation : 22
Location : French Vendée
Language : French
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile http://www.milouze14.com/

PostMilouze14 on 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
avatar
Wolfuryo

Gender : Male
Posts : 250
Points : 1239
Reputation : 80
Language : Romanian and English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
Awards :
View all awards
View user profile

PostWolfuryo on 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.
avatar
Milouze14

Title :
Gender : Male
Age : 51
Posts : 76
Points : 507
Reputation : 22
Location : French Vendée
Language : French
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile http://www.milouze14.com/

PostMilouze14 on 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++
avatar
Wolfuryo

Gender : Male
Posts : 250
Points : 1239
Reputation : 80
Language : Romanian and English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
Awards :
View all awards
View user profile

PostWolfuryo on 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
avatar
ThunderTB
New Member
Title :
Gender : Unspecified
Posts : 2
Points : 10
Reputation : 0
Language : French
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : phpBB2
Awards :
View all awards
View user profile

PostThunderTB on Sun 12 Nov 2017, 13:51

Thank you , very handy .

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