The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Hide topics from specific member

View previous topic View next topic Go down

Solved Hide topics from specific member

Post by TamDonCo on 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
Forumember

Posts : 171
Reputation : 2
Language : English

http://nhomcho.forummotion.com/

Back to top Go down

Solved Re: Hide topics from specific member

Post by SLGray on 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


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


SLGray
Administrator
Administrator

Male Posts : 35634
Reputation : 2372
Language : English
Location : United States

http://fmthemes.forumotion.com/

Back to top Go down

Solved Re: Hide topics from specific member

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

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

TamDonCo
Forumember

Posts : 171
Reputation : 2
Language : English

http://nhomcho.forummotion.com/

Back to top Go down

Solved Re: Hide topics from specific member

Post by APE on July 14th 2016, 2:11 pm

user one is the founders account Think





APE
Manager
Manager

Male Posts : 8319
Reputation : 716
Language : fluent in dork / mumbojumbo & English haha
Location : STUCK IN FORUMOTIONS SERVERS HELP ME !!!!!!

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

Back to top Go down

Solved Re: Hide topics from specific member

Post by TamDonCo on 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
Forumember

Posts : 171
Reputation : 2
Language : English

http://nhomcho.forummotion.com/

Back to top Go down

Solved Re: Hide topics from specific member

Post by APE on 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");
        });





APE
Manager
Manager

Male Posts : 8319
Reputation : 716
Language : fluent in dork / mumbojumbo & English haha
Location : STUCK IN FORUMOTIONS SERVERS HELP ME !!!!!!

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

Back to top Go down

Solved Re: Hide topics from specific member

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

Thanks APE

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

TamDonCo
Forumember

Posts : 171
Reputation : 2
Language : English

http://nhomcho.forummotion.com/

Back to top Go down

Solved Re: Hide topics from specific member

Post by APE on July 14th 2016, 6:23 pm

Not sure you can hide topic's for members





APE
Manager
Manager

Male Posts : 8319
Reputation : 716
Language : fluent in dork / mumbojumbo & English haha
Location : STUCK IN FORUMOTIONS SERVERS HELP ME !!!!!!

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

Back to top Go down

Solved Re: Hide topics from specific member

Post by Araik on 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
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 on 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





after




TamDonCo
Forumember

Posts : 171
Reputation : 2
Language : English

http://nhomcho.forummotion.com/

Back to top Go down

Solved Re: Hide topics from specific member

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

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

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 on July 14th 2016, 10:37 pm

Before




After


TamDonCo
Forumember

Posts : 171
Reputation : 2
Language : English

http://nhomcho.forummotion.com/

Back to top Go down

Solved Re: Hide topics from specific member

Post by Araik on 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
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 on July 15th 2016, 12:02 am

Thank You So much, Araik

It works fine




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
Forumember

Posts : 171
Reputation : 2
Language : English

http://nhomcho.forummotion.com/

Back to top Go down

Solved Re: Hide topics from specific member

Post by Nemo on 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
Support Moderator
Support Moderator

Male Posts : 992
Reputation : 99
Language : Greek, English, French

http://www.helpgr.forumgreek.com

Back to top Go down

View previous topic View next topic Back to top


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