I don't know much about the plugin but based on the snippets you pasted probably you'd be better using the qa_q_path function instead of urlencode(qa_opt('site_url').$request);
You will need the question id but you can get it almost from any place (e.g.: the qa_content array). If you don't have the title, you could input an empty string. Just make sure the third parameter is set to true:
qa_q_path($questionid, '', true);
I don't know how SOCIAL_SHARE_PLUGIN_DIR_NAME is being assigned but if that's in a layer you should use QA_HTML_THEME_LAYER_URLTOROOT more or less this way:
Again, I have not tested any of this stuff.