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

I would like to add automatically a tag which is containing a vaule from the user profile.

Especially I'll try to add a tag based on the user profile field, which I've added manually:
e.g. let's asume the additional field "hair-color" in every profile:

How can I add automatically a tag with the content of the profile-field "hair-color" to a new question? - or concrete : how can I retrieve the user-profile-value "hair-color"?

Update 19.12.2010: I figured out, that the function
"function qa_get_logged_in_user_field($field)"
gets all information stored in the sql database table "qa_users"...

unfortunately the user-defined-fields (together with e.g. name) are stored in the sql database table "qa_userfields".  --> how can I request informations from this table related to the logged in user?

1 Answer

0 votes
Best answer

ok...  if figured it out smiley ---  just in case somebody needs this: Here's my dirty trick to automatically add the content of a user defined profile field to the tag-list:

  1. open qa-page-ask.php
  2. add after the section "require_once..."
    //      Get useful information on the logged in user

    if (isset($qa_login_userid) && !QA_EXTERNAL_USERS)
    list($useraccount, $userprofile)=qa_db_select_with_pending(
    qa_db_user_account_selectspec($qa_login_userid, true),
    qa_db_user_profile_selectspec($qa_login_userid, true)
  3. search for "tagstring="  and add the following line behind it (replace the name of the profile-field as you like):
  4. ready...   :)

[for Q&A Version 1.3]

thanks for the info. Is it possible to select keywords from the person's profile  and add it to the tag words list so that they appear in tag suggestions when some one asks a question?