Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
830 views
in Q2A Core by
Using function qa_get_user_avatar_html from qa-app-users.php I see no way to add a custom title to the output <a href="" ...

function qa_get_user_avatar_html($flags, $email, $handle, $blobid, $width, $height, $size, $padding=false)

I need to add some extra information to the avatar link that is displayed on mouseover.
Q2A version: 1.6.3

1 Answer

+1 vote
by

hey Kai, you can use DOMDocument to edit this html text and add anything you like.

example on Theme Layer:

        function post_avatar($post, $class, $prefix=null)
        {
            $html = new DOMDocument();
            $html->loadHTML($post['avatar']);

            foreach($html->getElementsByTagName('a') as $a)
            {
                    $element = $html->createElement('span');
                    $element = $html->createTextNode('Your Avatar\'s description goes here');
                    $a->appendChild($element);
            }
            
            $post['avatar']= $html->saveHTML();
            qa_html_theme_base::post_tag_itempost_avatar($post, $class, $prefix);
        }

 

here I added some text inside avatar's link. you can use CSS to hide it and show it on hover. or instead change the code to create another element inside it and use css or js to show/hide it. you can also set element's Title attribute.

for more info read:

http://www.php.net/manual/en/class.domdocument.php

by
Thanks, I did not know this before. But I thought there could be a "one liner solution" =) anyway, great to learn new stuff.
...