Exclude User ID From Javascript
4 posters
Page 1 of 1
Exclude User ID From Javascript
I have installed this Javascript module to hide profile signatures in certain topics/forums/categories.
I have a member who would like to view the profile signatures in one of these categories, so I want to ask if there is some code that can be added to my code above for excluding a member based on their user ID. It would make her so happy if this can be done. Thanks in advance for whatever you can do!
Our forum is phpbb3.
- Code:
$(function(){
/* --- CONFIGURATION --- */
// Topic IDs where the signatures are hidden
var topic_ids = [1, 2, 3];
// Forum IDs where the signatures are hidden
var forum_ids = [4, 5];
// Category IDs where the signatures are hidden
var cat_ids = [7];
/* --- CONFIGURATION --- */
var topic_match = window.location.pathname.match(/\/t(\d+)/); if (!topic_match) return;
var current_topic = topic_match[1];
var navbar = document.querySelector('.pathname-box');
if (!current_topic || !navbar) return;
var forum_selector = navbar.querySelectorAll('.nav');
var current_forum = forum_selector[forum_selector.length - 1]; if (!current_forum) return;
var forum_match = current_forum.href.match(/\/f(\d+)/); if (!forum_match) return;
current_forum = forum_match[1]; if (!current_forum) return;
if (topic_ids.includes(parseInt(current_topic)) || forum_ids.includes(parseInt(current_forum))) {
$('.signature_div').filter(function(){ this.style.display = "none" });
}
var cat_selector = navbar.querySelectorAll('.nav');
var current_cat = cat_selector[cat_selector.length - 2]; if (!current_cat) return;
var cat_match = current_cat.href.match(/\/c(\d+)/); if (!cat_match) return;
current_cat = cat_match[1]; if (!current_cat) return;
if (topic_ids.includes(parseInt(current_topic)) || cat_ids.includes(parseInt(current_cat))) {
$('.signature_div').filter(function(){ this.style.display = "none" });
}
});
I have a member who would like to view the profile signatures in one of these categories, so I want to ask if there is some code that can be added to my code above for excluding a member based on their user ID. It would make her so happy if this can be done. Thanks in advance for whatever you can do!
Our forum is phpbb3.
Re: Exclude User ID From Javascript
I believe it would be easier if you used a code that hide all signatures,but there would be a button to click to view the signatures.
Lost Founder's Password |Forum's Utilities |Report a Forum |General Rules |FAQ |Tricks & Tips
You need one post to send a PM.
You need one post to send a PM.
When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
Re: Exclude User ID From Javascript
Thank you for the reply, @SLGray.
If your suggestion is possible, then I would be happy to receive that code and give that suggestion a try.
If your suggestion is possible, then I would be happy to receive that code and give that suggestion a try.
Re: Exclude User ID From Javascript
http://fmdesign.forumotion.com/t196-clip-and-toggle-signatures
You can change the height part of the code to zero that will hide all signatures. Then you just have to click the button to see them.
You can change the height part of the code to zero that will hide all signatures. Then you just have to click the button to see them.
Lost Founder's Password |Forum's Utilities |Report a Forum |General Rules |FAQ |Tricks & Tips
You need one post to send a PM.
You need one post to send a PM.
When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
Re: Exclude User ID From Javascript
This code looks like you would have to click a button on a reply-by-reply basis to reveal the signature.
Is that correct?
I would need a button that would reveal all the signatures on a page, not just one at a time.
Is that correct?
I would need a button that would reveal all the signatures on a page, not just one at a time.
Re: Exclude User ID From Javascript
Based on your first question regarding that script, are you saying you want to enable a member (the one with the ID) to be excluded from the script?
Re: Exclude User ID From Javascript
Here's it.
It's the second line, change 4 for the user ID (on its profile, the number on the link).
You can use as many as you want, for example [4, 8, 15, 16, 23, 42] to block the script on different users.
PS: I checked the other problem with this script but I have no idea what's wrong with it, sorry.
- Code:
$(function(){
if ([4].includes(_userdata.user_id)) return;
/* --- CONFIGURATION --- */
// Topic IDs where the signatures are hidden
var topic_ids = [1, 2, 3];
// Forum IDs where the signatures are hidden
var forum_ids = [4, 5];
// Category IDs where the signatures are hidden
var cat_ids = [7];
/* --- CONFIGURATION --- */
var topic_match = window.location.pathname.match(/\/t(\d+)/); if (!topic_match) return;
var current_topic = topic_match[1];
var navbar = document.querySelector('.pathname-box');
if (!current_topic || !navbar) return;
var forum_selector = navbar.querySelectorAll('.nav');
var current_forum = forum_selector[forum_selector.length - 1]; if (!current_forum) return;
var forum_match = current_forum.href.match(/\/f(\d+)/); if (!forum_match) return;
current_forum = forum_match[1]; if (!current_forum) return;
if (topic_ids.includes(parseInt(current_topic)) || forum_ids.includes(parseInt(current_forum))) {
$('.signature_div').filter(function(){ this.style.display = "none" });
}
var cat_selector = navbar.querySelectorAll('.nav');
var current_cat = cat_selector[cat_selector.length - 2]; if (!current_cat) return;
var cat_match = current_cat.href.match(/\/c(\d+)/); if (!cat_match) return;
current_cat = cat_match[1]; if (!current_cat) return;
if (topic_ids.includes(parseInt(current_topic)) || cat_ids.includes(parseInt(current_cat))) {
$('.signature_div').filter(function(){ this.style.display = "none" });
}
});
It's the second line, change 4 for the user ID (on its profile, the number on the link).
You can use as many as you want, for example [4, 8, 15, 16, 23, 42] to block the script on different users.
PS: I checked the other problem with this script but I have no idea what's wrong with it, sorry.
Wecoc- Forumember
- Posts : 144
Reputation : 111
Language : Catalan, Spanish, English
Re: Exclude User ID From Javascript
Yes, @Draxion, and it looks like @Wecoc has provided me with what I was looking for.
Thanks so much, Wecoc, you're always helping me with my Javascript needs, and I really appreciate it! I'm sure the member who would like to see these signatures will be thrilled, and the rest of us that don't want to see them will also be happy.
I'm sorry to hear that you can't see why the toolbar isn't showing for the Quick Reply editor in IE, but thanks so much for giving it a look.
Cheers.
I'll mark this topic as solved.
Thanks so much, Wecoc, you're always helping me with my Javascript needs, and I really appreciate it! I'm sure the member who would like to see these signatures will be thrilled, and the rest of us that don't want to see them will also be happy.
I'm sorry to hear that you can't see why the toolbar isn't showing for the Quick Reply editor in IE, but thanks so much for giving it a look.
Cheers.
I'll mark this topic as solved.
Re: Exclude User ID From Javascript
Problem solved & topic archived.
|
Lost Founder's Password |Forum's Utilities |Report a Forum |General Rules |FAQ |Tricks & Tips
You need one post to send a PM.
You need one post to send a PM.
When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
Similar topics
» Moving User Avatars with JavaScript
» Need help with Javascript
» How to exclude category from recent topics widget
» User Name Prefixes for entire User Group
» javascript
» Need help with Javascript
» How to exclude category from recent topics widget
» User Name Prefixes for entire User Group
» javascript
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum