SafeInSanity
Junior Member
Falling in love with Proboards again!
Posts: 424
inherit
23917
0
Feb 27, 2020 11:29:13 GMT -8
SafeInSanity
Falling in love with Proboards again!
424
May 2004
wiki
|
Post by SafeInSanity on Sept 9, 2019 7:41:44 GMT -8
Hi, Is there any way to change the default text message that my forum displays when a user (guest) does not have permission to access the page or the post?
"Oops, there was an error! You do not have permission to access this thread."
|
|
SafeInSanity
Junior Member
Falling in love with Proboards again!
Posts: 424
inherit
23917
0
Feb 27, 2020 11:29:13 GMT -8
SafeInSanity
Falling in love with Proboards again!
424
May 2004
wiki
|
Post by SafeInSanity on Sept 14, 2019 16:47:38 GMT -8
Bump .. anyone?
|
|
inherit
140147
0
Nov 19, 2024 5:07:22 GMT -8
Nscalerr
Throw me to the wolves and I'll return leading the pack!
3,043
May 2009
nscalerr
|
Post by Nscalerr on Sept 15, 2019 5:14:40 GMT -8
Hi SafeInSanityGive this script a go, add to the Global Header. Found it here. <script type="text/javascript"> $(document).ready(function(){ if(/\/board\//i.test(location.href) && $('.container.error').length && !pb.data('user').is_logged_in) $('.container.error > .content').html('Guests do not have permission to access this board. Please login or register to continue.'); }); </script>
|
|
SafeInSanity
Junior Member
Falling in love with Proboards again!
Posts: 424
inherit
23917
0
Feb 27, 2020 11:29:13 GMT -8
SafeInSanity
Falling in love with Proboards again!
424
May 2004
wiki
|
Post by SafeInSanity on Sept 15, 2019 5:51:38 GMT -8
Hi SafeInSanity Give this script a go, add to the Global Header. Found it here. <script type="text/javascript"> $(document).ready(function(){ if(/\/board\//i.test(location.href) && $('.container.error').length && !pb.data('user').is_logged_in) $('.container.error > .content').html('Guests do not have permission to access this board. Please login or register to continue.'); }); </script> The code you found is working for boards but not threads. Any idea how to change the error message for threads when linking to them and logged out? Oops, there was an error! You do not have permission to access this thread
|
|
inherit
140147
0
Nov 19, 2024 5:07:22 GMT -8
Nscalerr
Throw me to the wolves and I'll return leading the pack!
3,043
May 2009
nscalerr
|
Post by Nscalerr on Sept 15, 2019 6:06:52 GMT -8
Not tested, but found it hereChange the parts in blue to what you want. <script type="text/javascript"> $(document).ready(function() { if ( !proboards.data('route') ){ $('.container.error .title-bar h2').html(" error title"); $('.container.error .content').html(" error message"); } }); </script>
|
|
SafeInSanity
Junior Member
Falling in love with Proboards again!
Posts: 424
inherit
23917
0
Feb 27, 2020 11:29:13 GMT -8
SafeInSanity
Falling in love with Proboards again!
424
May 2004
wiki
|
Post by SafeInSanity on Sept 15, 2019 9:19:30 GMT -8
Not tested, but found it hereChange the parts in blue to what you want. <script type="text/javascript"> $(document).ready(function() { if ( !proboards.data('route') ){ $('.container.error .title-bar h2').html(" error title"); $('.container.error .content').html(" error message"); } }); </script> Ok, this code is not working and it looks like I will need a code for threads, and pages. The one you gave me for posts is currently working
|
|
Kami
Forum Cat
Posts: 40,198
Mini-Profile Theme: Kami's Mini-Profile
#f35f71
156500
0
Offline
Jul 24, 2021 11:48:29 GMT -8
Kami
40,198
July 2010
kamiyakaoru
Kami's Mini-Profile
|
Post by Kami on Sept 15, 2019 10:11:39 GMT -8
|
|
inherit
140147
0
Nov 19, 2024 5:07:22 GMT -8
Nscalerr
Throw me to the wolves and I'll return leading the pack!
3,043
May 2009
nscalerr
|
Post by Nscalerr on Sept 15, 2019 22:18:51 GMT -8
Just loaded it in to my forum and it appears you can only change the title of some of the buttons on the forum, not error msgs Kami
|
|
Kami
Forum Cat
Posts: 40,198
Mini-Profile Theme: Kami's Mini-Profile
#f35f71
156500
0
Offline
Jul 24, 2021 11:48:29 GMT -8
Kami
40,198
July 2010
kamiyakaoru
Kami's Mini-Profile
|
Post by Kami on Sept 15, 2019 22:33:18 GMT -8
Just loaded it in to my forum and it appears you can only change the title of some of the buttons on the forum, not error msgs Kami gotcha, thanks for the info!
|
|
inherit
257284
0
Nov 13, 2024 10:37:51 GMT -8
Eton Bones
70
December 2018
etonbones
|
Post by Eton Bones on Sept 16, 2019 2:47:34 GMT -8
That second code relies on bug that was later fixed. It used to be that on Oops pages the dataHash.route and dataHash.page were undefined causing problems for plugins that assumed they should be available on every page.
The following code should probably be a plugin to allow for easy editing but here it is in its naked form:
<script> /* Change "Oops" Message (Global Header) */ (function(opts){ const page = pb.data('page'), route=pb.data('route'), user = pb.data('user'), oops = page && Object.keys(page).length==0; if(oops){ let $style = $('<style />').appendTo('head'); $style[0].sheet.insertRule('.container.error{display:none}', 0); $(function(){ let $err = $('.container.error'); let user_msg = user.username && opts[user.username] ? opts[user.username]: (opts[user.id]?opts[user.id]:opts['everyone']) if($err.length && user_msg && route.name in user_msg){ user_msg[route.name].title && $err.find('.title-bar').html('<h2>' + user_msg[route.name].title +'</h2>'); user_msg[route.name].content && $err.find('.content').html( user_msg[route.name].content ); $err.show(); } }) } })({ everyone:{ thread: {title: "Thread Viewing Error", content: "It appears you broke the forum again"}, board: {title: "Board Viewing Error", content: "You have really done it this time!"} }, neo: { thread: {title: "Thread Matrix Error", content: "Why do you persist Mr. Anderson?!"}, board: {title: "Board Matrix Error", content: "Wake up Neo, you cannot see beyond this board choice you just made"} }, 0: { thread: {title: "Thread Viewing Error", content: 'Please <a href="/blah">login</a> or <a href="/blah">register</a> to view this thread'}, board: {title: "Board Viewing Error", content: 'Please <a href="/blah">login</a> or <a href="/blah">register</a> to view this board'} } }); </script>
You can define an error message for individuals via username or userID and for "everyone" else not covered by a username or userID entry. In the code above there are three entries: "everyone", "neo", 0
The user with the login name "neo" will get his own personalized message and Guests (userID is 0) will get their own while everyone else will get the "everyone" branch. If you want it left untouched for everyone else then just leave out the everyone entry. Obviously add more users if you want to personalize for others or just leave the 0 entry to affect only guests.
Each entry is subdivided to match the route (thread, board, etc., so you can have unique messages for each situation) and those in turn are subdivided to supply replacement (optional) title and/or (optional) content
|
|
inherit
140147
0
Nov 19, 2024 5:07:22 GMT -8
Nscalerr
Throw me to the wolves and I'll return leading the pack!
3,043
May 2009
nscalerr
|
Post by Nscalerr on Sept 16, 2019 21:32:34 GMT -8
All I have done is insert the javascript as is in to a plugin. I have tried adding some fields to make editing the messages easier, but then the plugin stops working. Not quite sure where I am going wrong! Change Oops Message1.pbp (874 B)
|
|
SafeInSanity
Junior Member
Falling in love with Proboards again!
Posts: 424
inherit
23917
0
Feb 27, 2020 11:29:13 GMT -8
SafeInSanity
Falling in love with Proboards again!
424
May 2004
wiki
|
Post by SafeInSanity on Sept 18, 2019 17:26:40 GMT -8
All I have done is insert the javascript as is in to a plugin. I have tried adding some fields to make editing the messages easier, but then the plugin stops working. Not quite sure where I am going wrong! Does it work?
|
|
inherit
140147
0
Nov 19, 2024 5:07:22 GMT -8
Nscalerr
Throw me to the wolves and I'll return leading the pack!
3,043
May 2009
nscalerr
|
Post by Nscalerr on Sept 18, 2019 21:48:50 GMT -8
In the current form it does work.
|
|
inherit
257284
0
Nov 13, 2024 10:37:51 GMT -8
Eton Bones
70
December 2018
etonbones
|
Post by Eton Bones on Sept 20, 2019 9:24:38 GMT -8
All I have done is insert the javascript as is in to a plugin. I have tried adding some fields to make editing the messages easier, but then the plugin stops working. Not quite sure where I am going wrong! Change Oops Message.pbp
|
|
inherit
140147
0
Nov 19, 2024 5:07:22 GMT -8
Nscalerr
Throw me to the wolves and I'll return leading the pack!
3,043
May 2009
nscalerr
|
Post by Nscalerr on Sept 22, 2019 3:27:18 GMT -8
Works well, never thought of using an auto form though. Another bit of pluings to learn about.
|
|