Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
860 views
in Q2A Core by
Where in script profile URL structure build?

I was removing some charecters from URL and I add some code to qa-util-string.php

and it worked like a charm (category, questions, tags) but I realized that it is not working for profile URL

I am wondering where the script builds profile URL????

Thanks
Q2A version: 1.6.3

2 Answers

0 votes
by

Unfortunately it's not currently possible to remove characters from the user URLs because the URL depends on those characters being present. See qa-page-user.php, line 35:
$handle = qa_request_part(1);

For example if the user name is "my.name" and you decided to remove all periods you would create a URL like "user/myname". But now you cannot look up the username in the database because it's different. Someone else could also have the username "myname" anyway.

Possible solution: implement a filter module that prevents those characters from being added to usernames in the first place. See filter_handle in qa-filter-basic.php for an example (the characters @+/ are already disallowed by default).

This may be something I fix in Q2A 1.8 or later.

0 votes
by

I think I found a solution for this:

qa-app-user-edit.php

line 167:

After these:

    function qa_create_new_user($email, $password, $handle, $level=QA_USER_LEVEL_BASIC, $confirmed=false)
/*
    Create a new user (application level) with $email, $password, $handle and $level.
    Set $confirmed to true if the email address has been confirmed elsewhere.
    Handles user points, notification and optional email confirmation.
*/
    {
        if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
        
        require_once QA_INCLUDE_DIR.'qa-db-users.php';
        require_once QA_INCLUDE_DIR.'qa-db-points.php';
        require_once QA_INCLUDE_DIR.'qa-app-options.php';
        require_once QA_INCLUDE_DIR.'qa-app-emails.php';
        require_once QA_INCLUDE_DIR.'qa-app-cookies.php';

 

 

I have added this CODE:

        $handle = str_replace(array(), array(), $handle);

It worked...

But still I need to hear from you that this code does not do anything else other than saving username first time and forever....

Thanks
 

...