-
Notifications
You must be signed in to change notification settings - Fork 11
Issue #44: Replace StdClass with Node. #45
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
base: 1.x-1.x
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -806,7 +806,7 @@ function forum_forum_load($tid = NULL) { | |||||
| ->fetchObject(); | ||||||
|
|
||||||
| // Merge in the "Last Post" information. | ||||||
| $last_post = new stdClass(); | ||||||
| $last_post = new Node(); | ||||||
| if (!empty($topic->last_comment_timestamp)) { | ||||||
| $last_post->created = $topic->last_comment_timestamp; | ||||||
| $last_post->name = $topic->last_comment_name; | ||||||
|
|
@@ -878,7 +878,7 @@ function forum_get_topics($tid, $sortby, $forum_per_page) { | |||||
| ); | ||||||
|
|
||||||
| $order = _forum_get_topic_order($sortby); | ||||||
| for ($i = 0; $i < count($forum_topic_list_header); $i++) { | ||||||
| for ($i = 1; $i < count($forum_topic_list_header); $i++) { | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is part of another PR which was merged so this no conflicts. |
||||||
| if ($forum_topic_list_header[$i]['field'] == $order['field']) { | ||||||
| $forum_topic_list_header[$i]['sort'] = $order['sort']; | ||||||
| } | ||||||
|
|
@@ -927,15 +927,17 @@ function forum_get_topics($tid, $sortby, $forum_per_page) { | |||||
| ->orderByHeader($forum_topic_list_header) | ||||||
| ->condition('n.nid', $nids); | ||||||
|
|
||||||
| $result = $query->execute(); | ||||||
| $result = $query->execute()->fetchAllAssoc('nid', PDO::FETCH_ASSOC); | ||||||
| } | ||||||
| else { | ||||||
| $result = array(); | ||||||
| } | ||||||
|
|
||||||
| $topics = array(); | ||||||
| $first_new_found = FALSE; | ||||||
| foreach ($result as $topic) { | ||||||
| foreach ($result as $topic_result) { | ||||||
| $topic = new Node($topic_result); | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| if ($user->uid) { | ||||||
| // A forum is new if the topic is new, or if there are new comments since | ||||||
| // the user's last visit. | ||||||
|
|
@@ -962,12 +964,13 @@ function forum_get_topics($tid, $sortby, $forum_per_page) { | |||||
| } | ||||||
|
|
||||||
| if ($topic->comment_count > 0) { | ||||||
| $last_reply = new stdClass(); | ||||||
| $last_reply = new Node(); | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| $last_reply->created = $topic->last_comment_timestamp; | ||||||
| $last_reply->name = $topic->last_comment_name; | ||||||
| $last_reply->uid = $topic->last_comment_uid; | ||||||
| $topic->last_reply = $last_reply; | ||||||
| } | ||||||
|
|
||||||
| $topics[] = $topic; | ||||||
| } | ||||||
|
|
||||||
|
|
@@ -1160,7 +1163,10 @@ function template_preprocess_forum_topic_list(&$variables) { | |||||
| $variables['topics'][$id]->new_url = ''; | ||||||
| if ($topic->new_replies) { | ||||||
| $variables['topics'][$id]->new_text = format_plural($topic->new_replies, '1 new', '@count new'); | ||||||
| $variables['topics'][$id]->new_url = url("node/$topic->nid", array('query' => comment_new_page_count($topic->comment_count, $topic->new_replies, $topic), 'fragment' => 'new')); | ||||||
|
|
||||||
| $count = comment_new_page_count($topic->comment_count, $topic->new_replies, $topic); | ||||||
| $options = array('query' => $count, 'fragment' => 'new'); | ||||||
| $variables['topics'][$id]->new_url = url("node/$topic->nid", $options); | ||||||
| } | ||||||
|
|
||||||
| } | ||||||
|
|
||||||
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.
I think we standardizing in core to use
entity_create()instead of creating entities withnew X.