-
Notifications
You must be signed in to change notification settings - Fork 613
Added comments page in the profile #1002
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
csemasthan
wants to merge
4
commits into
q2a:bugfix
Choose a base branch
from
csemasthan:bugfix
base: bugfix
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| <?php | ||
| /* | ||
| Question2Answer by Gideon Greenspan and contributors | ||
| http://www.question2answer.org/ | ||
|
|
||
| Description: Controller for user page showing all user's answers | ||
|
|
||
|
|
||
| This program is free software; you can redistribute it and/or | ||
| modify it under the terms of the GNU General Public License | ||
| as published by the Free Software Foundation; either version 2 | ||
| of the License, or (at your option) any later version. | ||
|
|
||
| This program is distributed in the hope that it will be useful, | ||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| GNU General Public License for more details. | ||
|
|
||
| More about this license: http://www.question2answer.org/license.php | ||
| */ | ||
|
|
||
| if (!defined('QA_VERSION')) { // don't allow this page to be requested directly from browser | ||
| header('Location: ../../'); | ||
| exit; | ||
| } | ||
|
|
||
| require_once QA_INCLUDE_DIR . 'db/selects.php'; | ||
| require_once QA_INCLUDE_DIR . 'app/format.php'; | ||
|
|
||
|
|
||
| // $handle, $userhtml are already set by /qa-include/page/user.php - also $userid if using external user integration | ||
|
|
||
| $start = qa_get_start(); | ||
|
|
||
|
|
||
| // Find the questions for this user | ||
|
|
||
| $loginuserid = qa_get_logged_in_userid(); | ||
| $identifier = QA_FINAL_EXTERNAL_USERS ? $userid : $handle; | ||
|
|
||
| list($useraccount, $userpoints, $questions) = qa_db_select_with_pending( | ||
| QA_FINAL_EXTERNAL_USERS ? null : qa_db_user_account_selectspec($handle, false), | ||
| qa_db_user_points_selectspec($identifier), | ||
| qa_db_user_recent_c_qs_selectspec($loginuserid, $identifier, qa_opt_if_loaded('page_size_activity'), $start) | ||
| ); | ||
|
|
||
| if (!QA_FINAL_EXTERNAL_USERS && !is_array($useraccount)) // check the user exists | ||
| return include QA_INCLUDE_DIR . 'qa-page-not-found.php'; | ||
|
|
||
|
|
||
| // Get information on user questions | ||
|
|
||
| $pagesize = qa_opt('page_size_activity'); | ||
| $count = (int)@$userpoints['cposts']; | ||
| $questions = array_slice($questions, 0, $pagesize); | ||
| $usershtml = qa_userids_handles_html($questions, false); | ||
|
|
||
|
|
||
| // Prepare content for theme | ||
|
|
||
| $qa_content = qa_content_prepare(true); | ||
|
|
||
| if (count($questions)) | ||
| $qa_content['title'] = qa_lang_html_sub('profile/comments_by_x', $userhtml); | ||
| else | ||
| $qa_content['title'] = qa_lang_html_sub('profile/no_comments_by_x', $userhtml); | ||
|
|
||
|
|
||
| // Recent questions by this user | ||
|
|
||
| $qa_content['q_list']['form'] = array( | ||
| 'tags' => 'method="post" action="' . qa_self_html() . '"', | ||
|
|
||
| 'hidden' => array( | ||
| 'code' => qa_get_form_security_code('vote'), | ||
| ), | ||
| ); | ||
|
|
||
| $qa_content['q_list']['qs'] = array(); | ||
|
|
||
| $htmldefaults = qa_post_html_defaults('Q'); | ||
| $htmldefaults['whoview'] = false; | ||
| $htmldefaults['avatarsize'] = 0; | ||
| $htmldefaults['ovoteview'] = true; | ||
| $htmldefaults['answersview'] = false; | ||
|
|
||
| foreach ($questions as $question) { | ||
| $options = qa_post_html_options($question, $htmldefaults); | ||
| $options['voteview'] = qa_get_vote_view('C', false, false); | ||
|
|
||
| $qa_content['q_list']['qs'][] = qa_other_to_q_html_fields($question, $loginuserid, qa_cookie_get(), | ||
| $usershtml, null, $options); | ||
| } | ||
|
|
||
| $qa_content['page_links'] = qa_html_page_links(qa_request(), $start, $pagesize, $count, qa_opt('pages_prev_next')); | ||
|
|
||
|
|
||
| // Sub menu for navigation in user pages | ||
|
|
||
| $ismyuser = isset($loginuserid) && $loginuserid == (QA_FINAL_EXTERNAL_USERS ? $userid : $useraccount['userid']); | ||
| $qa_content['navigation']['sub'] = qa_user_sub_navigation($handle, 'comments', $ismyuser); | ||
|
|
||
|
|
||
| return $qa_content; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$count is not correct here. replace with "count($questions)"