The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Hide topics from specific member

5 posters

Go down

Solved Hide topics from specific member

Post by TamDonCo July 13th 2016, 1:01 am

This is the code I get from Ace 1 to hide posts from specific member

$(function() {
$('a[href="/u1"]').parents("div.post").css("display", "none");
});



Now, I want to hide the topic from specific member .. Is it possible ?


Last edited by TamDonCo on July 15th 2016, 3:16 am; edited 1 time in total
TamDonCo
TamDonCo
Forumember

Posts : 427
Reputation : 2
Language : English

http://nhomcho.forummotion.com/

Back to top Go down

Solved Re: Hide topics from specific member

Post by SLGray July 13th 2016, 9:08 pm

Please use the BBCode code tags when posting coding.
Code:
[code]$(function() {
$('a[href="/u1"]').parents("div.post").css("display", "none");
});[/code]
Code:
$(function() {
$('a[href="/u1"]').parents("div.post").css("display", "none");
});
The topic was posted in the wrong section, so I have moved it to the correct section.
Please read our forum rules:  ESF General Rules


Hide topics from specific member Slgray10

When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
SLGray
SLGray
Administrator
Administrator

Male Posts : 51569
Reputation : 3525
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Solved Re: Hide topics from specific member

Post by TamDonCo July 14th 2016, 2:32 am

I want to hide topics from user 1 so no one can see his/her topics
TamDonCo
TamDonCo
Forumember

Posts : 427
Reputation : 2
Language : English

http://nhomcho.forummotion.com/

Back to top Go down

Solved Re: Hide topics from specific member

Post by Ape July 14th 2016, 2:11 pm

user one is the founders account Think


Hide topics from specific member Left1212Hide topics from specific member Center11Hide topics from specific member Right112
Hide topics from specific member Ape_b110
Hide topics from specific member Ape1010
Ape
Ape
Administrator
Administrator

Male Posts : 19450
Reputation : 2011
Language : fluent in dork / mumbojumbo & English haha

http://chatworld.forumotion.co.uk/

Back to top Go down

Solved Re: Hide topics from specific member

Post by TamDonCo July 14th 2016, 3:01 pm

APE wrote:user one is the founders account Think

sorry misunderstand

I can replace user 100 , 1 is just my example in the code
TamDonCo
TamDonCo
Forumember

Posts : 427
Reputation : 2
Language : English

http://nhomcho.forummotion.com/

Back to top Go down

Solved Re: Hide topics from specific member

Post by Ape July 14th 2016, 5:08 pm

ok the code is the same all you need to do is change u1 with u100

so under the code you already have ad the same code again but just change the u1 to u100 then to do this for more then 2 just add the same code again and then add the new number

like this:
Code:
 $(function() {
        $('a[href="/u1"]').parents("div.post").css("display", "none");
        });

        $(function() {
        $('a[href="/u100"]').parents("div.post").css("display", "none");
        });


Hide topics from specific member Left1212Hide topics from specific member Center11Hide topics from specific member Right112
Hide topics from specific member Ape_b110
Hide topics from specific member Ape1010
Ape
Ape
Administrator
Administrator

Male Posts : 19450
Reputation : 2011
Language : fluent in dork / mumbojumbo & English haha

http://chatworld.forumotion.co.uk/

Back to top Go down

Solved Re: Hide topics from specific member

Post by TamDonCo July 14th 2016, 5:21 pm

Thanks APE

I know that but that code we hide posts but I want to hide topics
TamDonCo
TamDonCo
Forumember

Posts : 427
Reputation : 2
Language : English

http://nhomcho.forummotion.com/

Back to top Go down

Solved Re: Hide topics from specific member

Post by Ape July 14th 2016, 6:23 pm

Not sure you can hide topic's for members


Hide topics from specific member Left1212Hide topics from specific member Center11Hide topics from specific member Right112
Hide topics from specific member Ape_b110
Hide topics from specific member Ape1010
Ape
Ape
Administrator
Administrator

Male Posts : 19450
Reputation : 2011
Language : fluent in dork / mumbojumbo & English haha

http://chatworld.forumotion.co.uk/

Back to top Go down

Solved Re: Hide topics from specific member

Post by Araik July 14th 2016, 9:33 pm

Hello, try using this javascript code in all pages:

Code:
$(function(){
  //////////////////////
  var specificMember = 'username'; //Edit
  //////////////////////
 
  var path = location.pathname;
  var userTopic = '';

  if(/^\/t\d+/.test(path)){
    topic(cleanHref(path));
  }
 
  $('a[href^="/t"]').each(function(){
    var t = $(this);
    topic( cleanHref(t.attr('href')), t);
  });
 
  function cleanHref(href){
    return href.replace(/#\d+$/,'').replace(/^\/t\d+p\d+/, href.match(/^\/t\d+/));
  }
 
  function topic(url, a){
    $.get(url, function(data){
      userTopic = $(data).find('.postprofile dt:eq(0)').text();
    }).done(function(){
      if(userTopic == specificMember){
        a ? a.remove() : location.href = '/';
      };
    });
  }
});

This code removes all links that redirect to the topic built by the specific member. If you are in that topic the script will redirect you to other page.

I hope it is useful. Wink
Araik
Araik
New Member

Male Posts : 7
Reputation : 1
Language : Spanish
Location : Argentina

http://mispruebas.foroargentina.net/

Back to top Go down

Solved Re: Hide topics from specific member

Post by TamDonCo July 14th 2016, 10:15 pm

Thanks Araik

I am on the right track, the topic is still there but can not get in because it 's hidden, if we can hide the whole thing, very good

look at the pictures

before

Hide topics from specific member SQW



after

Hide topics from specific member SQz

TamDonCo
TamDonCo
Forumember

Posts : 427
Reputation : 2
Language : English

http://nhomcho.forummotion.com/

Back to top Go down

Solved Re: Hide topics from specific member

Post by Araik July 14th 2016, 10:33 pm

I can't see the pictures. Can you prove other hosting (ex. imgur)?
Araik
Araik
New Member

Male Posts : 7
Reputation : 1
Language : Spanish
Location : Argentina

http://mispruebas.foroargentina.net/

Back to top Go down

Solved Re: Hide topics from specific member

Post by TamDonCo July 14th 2016, 10:37 pm

Before

Hide topics from specific member PDp8gTH


After

Hide topics from specific member 31NHJMV
TamDonCo
TamDonCo
Forumember

Posts : 427
Reputation : 2
Language : English

http://nhomcho.forummotion.com/

Back to top Go down

Solved Re: Hide topics from specific member

Post by Araik July 14th 2016, 11:26 pm

Ok, here's the corrected code. Let me know any problem:

Code:
$(function(){
  //////////////////////
  var specificMember = 'username'; //Edit
  //////////////////////
 
  var path = location.pathname;
  var userTopic = '';
 
  if(/^\/t\d+/.test(path)){
    topic(cleanHref(path));
  }
 
  $('a[href^="/t"]').each(function(){
    var t = $(this);
    topic( cleanHref(t.attr('href')), t);
  });
 
  function cleanHref(href){
    return href.replace(/#\d+$/,'').replace(/^\/t\d+p\d+/, href.match(/^\/t\d+/));
  }
 
  function topic(url, a){
    $.get(url, function(data){
      userTopic = $(data).find('.postprofile dt:eq(0)').text();
    }).done(function(){
      if(userTopic == specificMember){
        a ? delete_a(a) : location.href = '/';
      };
    });
  }
 
  function delete_a(a){
    a.closest('.forumbg li.row, .forabg .lastpost, .forabg .search li.row').remove();
    a.remove();
  }
});



Araik
Araik
New Member

Male Posts : 7
Reputation : 1
Language : Spanish
Location : Argentina

http://mispruebas.foroargentina.net/

Back to top Go down

Solved Re: Hide topics from specific member

Post by TamDonCo July 15th 2016, 12:02 am

Thank You So much, Araik

It works fine

Hide topics from specific member 1f44d


Maybe I ask you here , I asked in other problem room , no solution

back to the Ace 1 code

$(function() {
$('a[href="/u1"]').parents("div.post").css("display", "none");
});

this code will hide the user posts from members, but when members logout as guests, they can see posts

Anyway to hide posts from guests too ??


TamDonCo
TamDonCo
Forumember

Posts : 427
Reputation : 2
Language : English

http://nhomcho.forummotion.com/

Back to top Go down

Solved Re: Hide topics from specific member

Post by Nemo July 15th 2016, 11:38 am

One question per thread, please. If you want to invite someone in your thread, you can mention his/her username.

Problem solved & topic archived.
Please read our forum rules: ESF General Rules
Nemo
Nemo
Active Poster

Male Posts : 1203
Reputation : 119
Language : Greek, English, French

http://www.helpgr.forumgreek.com

Back to top Go down

Back to top

- Similar topics

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