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

How to delete "User's links" everywhere? (in question pages and lists), but KEEP users name+photo without links  like this =>

1 Answer

+4 votes
by
edited by
 
Best answer

Those HTML anchors come from the core. I think this is inappropriate as the core should tell the theme WHAT to display and, in this case, it is telling the theme HOW to display them... which is exactly the theme's responsibility (see my complain in this post).

So in order to fix this without hacking the core you'll have to massage the (sadly already formatted) data and try to remove the links. Answer is very long so I'm adding it in this gist https://gist.github.com/pupi1985/9e971c24320a026e5900

Just add those 3 functions to your qa-theme. If they already exist then you will have to merge them.

I think that should do it.


EDIT: I've updated the gist to include the user rankings. You can see what has changed here: https://gist.github.com/pupi1985/9e971c24320a026e5900/revisions

by
ok thanks, I got your point, but is there a quicker way by updating qa-theme-base.php ?!, because I have a lots of errors (I will see it); actually I am working on a question2answer to create only articles, I don't plan to update anything later in this one.
by
The only error you can get is if the functions already exist and you will need to merge them with your current one in order to avoid duplicated functions.

If you still want to modify your base theme then replace the post_meta function in there with the one I'm giving you (hoping you haven't modified that function before), add the stripAnchors function to the base theme and regarding the post_avatar use the same as in the base theme but add this line:

$post['avatar'] = $this->stripAnchors($post['avatar']);

just before this line:

if (isset($prefix))

and that should be it.
by
edited by
thanks a lots Pupi, you are the best! it works fine, even if its break a bit my css, but i found a way to fixe this.
by
Added link removal to the users ranking page
by
thanks & thanks again for the uptade!
...