# 为新邀请的用户更改第一个视图？

**URL:** https://meta.discourse.org/t/change-the-first-view-for-newly-invited-users/42046
**Category:** Support
**Created:** [2016年四月5日 06:59 UTC](https://meta.discourse.org/t/change-the-first-view-for-newly-invited-users/42046 "2016-04-05T06:59:40Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![commonpawn](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/commonpawn/32/50792_2.png) [@commonpawn](https://meta.discourse.org/u/commonpawn)
#### Post date: [2016年四月5日 06:59 UTC](https://meta.discourse.org/t/change-the-first-view-for-newly-invited-users/42046/1 "2016-04-05T06:59:40Z")

</div>

Is it possible to change what newly invited users see for the first time they visit the site?  
Currently they see top posts of all time - but in our case, we just launched our site as a closed beta and all the top posts are really bad posts (because they are just old and received a lot of hits while we built the site)

Is it possible to change the default landing page for newly invited users to ‘recent’ or similar?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2016年四月5日 07:20 UTC](https://meta.discourse.org/t/change-the-first-view-for-newly-invited-users/42046/2 "2016-04-05T07:20:08Z")

</div>

No way to do that at the current time – I suggest cleaning up the old topics in advance. If it’s bad content you are not comfortable putting in front of people, why keep it on your site?

---

<div class="post-metadata">

### Author: ![commonpawn](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/commonpawn/32/50792_2.png) [@commonpawn](https://meta.discourse.org/u/commonpawn)
#### Post date: [2016年四月5日 07:27 UTC](https://meta.discourse.org/t/change-the-first-view-for-newly-invited-users/42046/3 "2016-04-05T07:27:58Z")

</div>

It is alright content, but it is showing really old topics we created a long time ago.  
We just want new users to see recent topics, really.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2016年四月5日 07:29 UTC](https://meta.discourse.org/t/change-the-first-view-for-newly-invited-users/42046/4 "2016-04-05T07:29:16Z")

</div>

Hmm, I can see an argument for default top for new users to be “this year” instead of “all time” @zogstrip. That’d at least rule out ancient topics.

But we do have `top page default timeframe` in site settings… have you tried changing that?

---

<div class="post-metadata">

### Author: ![commonpawn](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/commonpawn/32/50792_2.png) [@commonpawn](https://meta.discourse.org/u/commonpawn)
#### Post date: [2016年四月5日 07:30 UTC](https://meta.discourse.org/t/change-the-first-view-for-newly-invited-users/42046/5 "2016-04-05T07:30:53Z")

</div>

yeah changed it to weekly - which would also work for us – but nothing changed. Still showing top posts of all time.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2016年四月5日 07:31 UTC](https://meta.discourse.org/t/change-the-first-view-for-newly-invited-users/42046/6 "2016-04-05T07:31:11Z")

</div>

That may be a bug then for @zogstrip to look at.

---

<div class="post-metadata">

### Author: ![commonpawn](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/commonpawn/32/50792_2.png) [@commonpawn](https://meta.discourse.org/u/commonpawn)
#### Post date: [2016年四月5日 08:02 UTC](https://meta.discourse.org/t/change-the-first-view-for-newly-invited-users/42046/7 "2016-04-05T08:02:46Z")

</div>

yes, top page default timeframe does not change anything on our site. not even the actual default timeframe when clicking top. Would be great to have a fix for that!

---

<div class="post-metadata">

### Author: ![commonpawn](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/commonpawn/32/50792_2.png) [@commonpawn](https://meta.discourse.org/u/commonpawn)
#### Post date: [2016年四月5日 08:39 UTC](https://meta.discourse.org/t/change-the-first-view-for-newly-invited-users/42046/8 "2016-04-05T08:39:08Z")

</div>

Found a setting for it!  
 ![](https://global.discourse-cdn.com/meta/original/3X/b/2/b21f5a062fd28a9828c3daaede8a55b3e4e0b24c.png)  
It did the trick for us!

However, our top default timeframe is still broken 🙂

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2016年四月5日 09:22 UTC](https://meta.discourse.org/t/change-the-first-view-for-newly-invited-users/42046/9 "2016-04-05T09:22:23Z")

</div>

Yeah this should work, and the default should be “This Year” out of the box @zogstrip. That would prevent long-dead topics from being highlighted..

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [2016年四月5日 11:51 UTC](https://meta.discourse.org/t/change-the-first-view-for-newly-invited-users/42046/10 "2016-04-05T11:51:31Z")

</div>

That setting works for me…

`top page default timeframe`, changed it to weekly, visited the /top page, it shows weekly. Switched it to yearly, it shows yearly.

Now, whether the redirecting a user to the top page utilizes that setting, is a completely different question.

The intent I believe for that setting was when Top was set to the homepage, you could make it showcase a certain timeframe versus all, to make the homepage look more fresh and interesting.

More details on that setting at

> [@Visiting User visiting Top, shorten time frame shown by default](https://meta.discourse.org/t/visiting-user-visiting-top-shorten-time-frame-shown-by-default/34148):
>
> Okay, so Sitepoint just had a big internal discussion over what page the user should see when they first visit your community, and we primarily are interested in Top except for one glaring problem. Top seems to default to Year for the time frame when not logged in. The results of which are less than thrilling. If it defaulted to the past week or past month, this would be very meaningful, as it would show relevant semi current data, instead of showing topics that were closed and things that were…

---

<div class="post-metadata">

### Author: ![commonpawn](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/commonpawn/32/50792_2.png) [@commonpawn](https://meta.discourse.org/u/commonpawn)
#### Post date: [2016年四月5日 16:06 UTC](https://meta.discourse.org/t/change-the-first-view-for-newly-invited-users/42046/11 "2016-04-05T16:06:11Z")

</div>

Weird, changing the default top timeframe does nothing on our site.

Screenshots below:

 ![](https://global.discourse-cdn.com/meta/original/3X/8/8/882dda22102d18b29078ae68cb1efc19ed055b89.png)  
Changed the setting

 ![](https://global.discourse-cdn.com/meta/original/3X/d/1/d1d95330ae492d72e8708c837145c4f062fca5b2.png)

No effect at /top  
(Danish site, år means year)

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [2016年四月5日 16:24 UTC](https://meta.discourse.org/t/change-the-first-view-for-newly-invited-users/42046/12 "2016-04-05T16:24:37Z")

</div>

How are you visiting that page? Are you logged in or an anonymous user? Are you returning to the site after being away for a while? What is the value of `topics_per_period_in_top_page` in your Admin \> Settings?

As that site setting only affects the default view, there is logic in Discourse that may switch it to something else if you weren’t there for several days

> <https://github.com/cpradio/discourse/blob/8cabc140998455ac95afa50f19720ea39798a3aa/app/controllers/list_controller.rb#L291-L309>

That logic didn’t change. Wonder if it should have… as maybe the score is finding a value acceptable via :yearly on your setup.

---

<div class="post-metadata">

### Author: ![commonpawn](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/commonpawn/32/50792_2.png) [@commonpawn](https://meta.discourse.org/u/commonpawn)
#### Post date: [2016年四月5日 16:36 UTC](https://meta.discourse.org/t/change-the-first-view-for-newly-invited-users/42046/13 "2016-04-05T16:36:08Z")

</div>

**Topics per period**

 ![](https://global.discourse-cdn.com/meta/original/3X/a/1/a1bd85167b1b843c7d2df5c848e39c734b3ee480.png)

I am visiting the site from two different logged in users: an admin user and a regular member user. Same behavior. I just created the regular user as a test and i am still presented with a yearly overview under top as default.

Not sure what you mean? Is that the intended behavior? In that case, what does the setting then do?

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [2016年四月5日 16:42 UTC](https://meta.discourse.org/t/change-the-first-view-for-newly-invited-users/42046/14 "2016-04-05T16:42:14Z")

</div>

Well right now it is purely only in affect if the yearly period doesn’t have enough entries to warrant its display (based on the code). It seems yours does.

That code may need to be tweaked to behave differently, if the setting is to imply something else. Not sure what that should look like though.

One possible option would be to force the default timeframe to be the first entry in periods, so yes, it might get checked twice, but if the default view returns an applicable score and an applicable number of topics, it will get used.

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [2016年四月5日 17:51 UTC](https://meta.discourse.org/t/change-the-first-view-for-newly-invited-users/42046/15 "2016-04-05T17:51:32Z")

</div>

Here is what I was thinking and the tests all seem to pass  
[https://github.com/discourse/discourse/compare/master...cpradio:default\_top\_timeframe](https://github.com/discourse/discourse/compare/master...cpradio:default_top_timeframe)

@zogstrip, do you see this being accepted via PR?

In short, it ensures the default top page setting is returned by best\_periods\_for, it doesn’t mean it will get used, as it might not have a score \> 0 or enough entries (and thus a different period may get returned), but it will at least give it a chance to be used.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [2016年四月6日 16:15 UTC](https://meta.discourse.org/t/change-the-first-view-for-newly-invited-users/42046/16 "2016-04-06T16:15:12Z")

</div>

> [@cpradio](#):
>
> @zogstrip, do you see this being accepted via PR?

💯 💯 😍

---

<div class="post-metadata">

### Author: ![commonpawn](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/commonpawn/32/50792_2.png) [@commonpawn](https://meta.discourse.org/u/commonpawn)
#### Post date: [2016年四月6日 16:21 UTC](https://meta.discourse.org/t/change-the-first-view-for-newly-invited-users/42046/17 "2016-04-06T16:21:12Z")

</div>

What about a simple setting like this

 ![](https://global.discourse-cdn.com/meta/original/3X/b/0/b00edc14df619826a6bf726d0b42968a56169d00.png)

**Top page default timeframe:**  
When a user clicks top - what is he/she always presented with?

**Newly invited users landing page:**  
What view on the front page is newly invited users presented with?

---

<div class="post-metadata">

### Author: ![commonpawn](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/commonpawn/32/50792_2.png) [@commonpawn](https://meta.discourse.org/u/commonpawn)
#### Post date: [2016年四月6日 16:30 UTC](https://meta.discourse.org/t/change-the-first-view-for-newly-invited-users/42046/18 "2016-04-06T16:30:24Z")

</div>

Update: I really don’t understand what the top page default timeframe setting does? Just set Topics per period to 5 and set the top page default timeframe to yearly. Now it shows me top posts today when i click top. Makes no sense to me

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [2016年四月6日 16:33 UTC](https://meta.discourse.org/t/change-the-first-view-for-newly-invited-users/42046/19 "2016-04-06T16:33:02Z")

</div>

PR Submitted  
[https://github.com/discourse/discourse/pull/4147?refresh](https://github.com/discourse/discourse/pull/4147?refresh)

> [@commonpawn](#):
>
> What about a simple setting like this

That is covered by the checkbox you unchecked earlier (as it will put the user on the landing page). Which is 100% in your control.

> [@commonpawn](#):
>
> Update: I really don’t understand what the top page default timeframe setting does? Just set Topics per period to 5 and set the top page default timeframe to yearly. Now it shows me top posts today when i click top. Makes no sense to me

Yeah, that setting needed to be applied further, which is what my PR does. Now it should behave in a more intended way. The earlier existence was only helpful to very low activity forums, anything that had remotely any activity wouldn’t ever make use of that setting.

The PR changes that now.

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [2016年四月6日 16:35 UTC](https://meta.discourse.org/t/change-the-first-view-for-newly-invited-users/42046/20 "2016-04-06T16:35:27Z")

</div>

@commonpawn, it is merged now. If you are running latest or wish to pull it down, visit /admin/upgrade and you should be able to pull this in and it should give you better results.

[下一頁](https://meta.discourse.org/t/change-the-first-view-for-newly-invited-users/42046.md?page=2)
