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

In different scenarios - especially when developping plugins - I find myself going to phpmyadmin, qa_users, searching the userid to get the username (the "handle").

It would be great to have a URL to get the userprofile immediately.

So additionally to: http://www.question2answer.org/qa/user/Scott

it would be great to have: http://www.question2answer.org/qa/userid/101

Who cares as well about that?

2 Answers

+2 votes
by

Personally I would prefer user URLs of the form www.question2answer.org/qa/user/101/scott

The main advantage IMO is when a user changes their username you don't end up with a 404, the new URL would be /user/101/scott-new-name
Just like questions the userid would be looked up so /101/scott-new-name and /101/scott can both return the user page (with a canonical).
 
Anyway, not really an answer to your question, but just my thoughts on the issue.
by
it is actually a good one! For my forum, though, I do not allow users to change names... :)

PS offtopic: Have you checked my "issues" / ideas for your plugin, thinking of "list all comments" and "prevent overwrites of edit history":
https://github.com/svivian/q2a-user-activity-plus
https://github.com/svivian/q2a-edit-history/issues/11
by
Maybe you want to implement the profile page as URL "./users/userid/handle" in q2a v1.7 or v1.8.
by
Yes that may happen, but we need to be careful of backward compatibility.

By the way, not sure if this answers your original question, but there is a function to get the username from an ID, check the docs.
by
Hi Scott, hope you can implement the change of the user URL in 1.7 or 1.8. It would help a lot, esp. coding becomes easier, as we thrown in only the userid (like with the questions) and get the page, does not matter what handle is assigend in the url. I love this with the questions, e.g. http://www.question2answer.org/qa/19419/ (without the seo additions), same should work for user URLs. Looking forward to it!
+3 votes
by

You immediately find in the docs the way handle to userid:

qa_handle_to_userid($handle) returns the userid for the user identified by $handle or null if no user matches. This requires Q2A 1.6+, but see also qa_handles_to_userids(...) and qa_userids_to_handles(...) which were added in Q2A 1.5.

http://www.question2answer.org/functions.php

With v1.6 there was a new function implemented for userid to handle:

function qa_userid_to_handle($userid)

which is not yet in the docs.

 

...