Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
2.4k views
in Themes by
If unregistered user post question or answer he is linked to an ip address pages which not looks good, my question how to disable this link..
by
Anyone can give correct solution for this

1 Answer

+3 votes
by
edited by
 
Best answer

Although Q2A allows the user of layers and themes to output HTML, for some reason, the core itself spits HTML. That means regardless of how great a plugin or theme system is, you will, sooner or later, end up parsing HTML. I'm not going to preach about MVC but I just wanted to note that.

This is how to remove the HTML that comes from the core. Make sure the doctype() function in qa-theme.php looks like this:

function doctype() {
    qa_html_theme_base::doctype();
    $anonymous = qa_lang_html('main/anonymous');
    if (isset($this->content['q_view']['who']['data']) && strpos($this->content['q_view']['who']['data'], 'class="qa-ip-link">' . $anonymous . '</a>') !== FALSE) {
        $this->content['q_view']['who']['data'] = $anonymous;
    }
}
 
Now, if you have installed any other plugin tha adds HTML to the 'data' value then this will remove that too. That means you'll have to parse that custom HTML yourself. The above solution parses only the HTML that comes from the Q2A core (at least on the current 1.6.3 version).
by
Hi thanks for your reply . My motive only to disable lp page link instead of delete the link.

error : Fatal error: Cannot redeclare qa_html_theme::doctype()
by
You need to understand some PHP before actually modifying any PHP code. You can't have 2 or more functions with the same name in the same class. Add the content of this doctype() function (except from the qa_html_theme_base::doctype(); line) to your current doctype() in your qa-theme.php file.

Regarding disabling the page link that is a non-existent concept. You either show the link or not. This code displays the text of the link but not the link itself.
by
Hi unable to understand pl combine codes

function doctype()
{
  qa_html_theme_base::doctype();
  $categories = isset($this->content['navigation']['cat']) ? $this->content['navigation']['cat'] : null;
  if (isset($categories)) {
    foreach ($categories as $name => $category) {
      unset($this->content['navigation']['cat'][$name]['note']);
}
 
    
}
 
}
by
Blindly copy/pasting text from your comment and my answer it should look like this:

function doctype() {
    qa_html_theme_base::doctype();
    $anonymous = qa_lang_html('main/anonymous');
    if (isset($this->content['q_view']['who']['data']) && strpos('class="qa-ip-link">' . $anonymous . '</a>') !== FALSE) {
        $this->content['q_view']['who']['data'] = $anonymous;
    }
    $categories = isset($this->content['navigation']['cat']) ? $this->content['navigation']['cat'] : null;
    if (isset($categories)) {
        foreach ($categories as $name => $category) {
            unset($this->content['navigation']['cat'][$name]['note']);
        }
    }
}
by
Thanks for awesome help now i understand where i was wrong.

Pl do me one favor for my community http://www.thegeneralstuff.com

pl check the site and help me to customize following things.

1.main banner below navigation: how to add sub categories when someone click on categories pages.
2. how to move navigation to top bar right side from login links
3. how to hide questions from home page from specified categories.
by
warning : Warning: strpos() expects at least 2 parameters, 1 given in qa-theme.php on line 199

    if (isset($this->content['q_view']['who']['data']) && strpos('class="qa-ip-link">' . $anonymous . '</a>') !== FALSE) {
by
Regarding your questions:

1. That seems to be a kind of breadcrumb. There are a few plugins around about it. Probably it is worth taking a look at them if they satisfy that need.
2. That is not straight forward and seems to be related to theme customization. Most likely not something anyone would do for free. You can find some service providers here: http://www.question2answer.org/services.php
3. Hmm, not an easy thing to do as it seems it will require modifying the core's behaviour. However, this is not the first time that has been asked here so you can find something about it (I think I've seen that as "private categories" or something like that)

strpos warning? Whoops. I fixed my answer, I was checking for the isset($x) and then not using $x. Add the second parameter to to the isset function as it is in the question. Let me know if you have any issue with that
by
Hi thanks for reply but ip link pages not hiding for login users
by
Your question was: If unregistered user post question or answer he is linked to an ip address pages which not looks good, my question how to disable this link.

I've given you the code to remove the link from the anonymous (unregistered) users. So I don't get what you mean by "for login users" in your previous comment.

You also wanted to "disable the link" but you now are asking to hide the ip link pages. That's also different from your original request.

It will be better if you take a screenshot of the current behaviour, edit the screenshot marking the things you want to change and then create a second image (edited with any graphical image tool) with the behaviour you are expecting.
by
Hi
my question is very simple if user is not registered and post question or answer he also assign a page for his questions/answers just like register users but it didn't look good.
at present only register users can see these links. My question is i want to disable ip link pages from everyone except admin.
...