Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
598 views
in Q2A Core by
edited by

Hi,

We are using our own custom login system on q2a, and as such the profile links such as:

/bookings/user/xxxx

...just return 404 (as it obviously can't find the profile). We simply want to remove the links on these (still show the username, but not a link anywhere)

How would we go about this? I've had a look int the code - but I cant work it out :/



TIA

Andy

by
*bump*

Anyone got any ideas?
by
Few things are theme specific, so you should add some more details about what theme you are using etc.. Also possible add screenshot.
by
Sorry, didn't think of that! The template set is SnowFlat (not edited)

I've updated my question above, to include screenshots of the sections I want to remove the link on :) Thanks!

1 Answer

+1 vote
by
selected by
 
Best answer

I couldn't found rock solid way yet. For that I need some time. But you can use below meantime if it is urgent. Or see if anyone have better solution.

In theme file find function around line #104 public function logged_in()

add below line at the very first

$this->content['loggedin']['data'] = (qa_is_logged_in() ? preg_replace('/<a href=\"(.*?)\">(.*?)<\/a>/', "\\2", @$this->content['loggedin']['data']) : @$this->content['loggedin']['data']);

So it will look something like below

public function logged_in() {
    $this->content['loggedin']['data'] = (qa_is_logged_in() ? preg_replace('/<a href=\"(.*?)\">(.*?)<\/a>/', "\\2", @$this->content['loggedin']['data']) : @$this->content['loggedin']['data']);

...
}

 

Also add this entire method into theme file. You can place anywhere within the class

public function post_meta_who($post, $class)
{
    if (isset($post['who']['data'])){
        $post['who']['data'] = preg_replace('/<a href=\"(.*?)\">(.*?)<\/a>/', "\\2", $post['who']['data']);
    }
    parent::post_meta_who($post, $class);
}

 

This will remove link from username. Somehow I still need to find to remove link on edits event. I am not saying this is the best way and hope anyone will comeup with some better method or may be I will see once get some time.

by
Thanks - that looks like what I'm after :) Was version is that for? I'm currently on v1.4. I can't seem to find what you are referencing in  qa-theme/SnowFlat/qa-theme.php though? TIA
by
This is for QA 1.7.*.. BTW, QA 1.4 is too old and I have no idea what is in it :P
by
Ah wow, didn't realise it was that old. Was only a few months ago we put it on? (or maybe I'm just deceiving myself, as I can't bring myself to wonder where the year has gone! haha). Either way, the end part of your answer fixed the issue for the usernames linked in the different main areas we were having issues with. Can't work it out for the "login" dropdown at the top right - but I recon we can live with that for now. Thanks for taking the time!
...