Skip to content
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

Twitter Timeline: fix Undefined index notice #6

Merged
merged 4 commits into from
Dec 21, 2013

Conversation

jeherve
Copy link
Member

@jeherve jeherve commented Dec 17, 2013

tweet-limit was undefined in defaults

Read more about the issue here:
http://wordpress.org/support/topic/undefined-index-tweet-limit

tweet-limit was undefined in defaults

Read more about the issue here:
http://wordpress.org/support/topic/undefined-index-tweet-limit
@georgestephanis
Copy link
Member

Displaying it as 0 in the form could be confusing to users, thinking that no tweets would display.

Would it be better to default it to null, maybe? That would still get cast to 0 in the output.

@jeherve
Copy link
Member Author

jeherve commented Dec 17, 2013

On WordPress.com, we display a small message below the input field. Maybe we should do the same in Jetpack?

screen shot 2013-12-17 at 5 33 18 pm

@wpmnger
Copy link

wpmnger commented Dec 18, 2013

Why not just display 'no limit'?

@jeherve
Copy link
Member Author

jeherve commented Dec 18, 2013

Displaying "No Limit" by default might be nice, but let's imagine the following scenario:

  1. I create a Twitter Timeline widget
  2. I set the number of tweets to show to 3.
  3. A few days/weeks later, I come back and want to show an unlimited number of tweets
  • How will I know what to enter into the box to display an unlimited number of tweets?
  • If a message is there to explain that 0 = No limit, it's going to be easier to change than asking users to type in "No Limit", in my opinion.

@wpmnger
Copy link

wpmnger commented Dec 18, 2013

I see your point.
For WP developers I guess -1 would be fitting :-)

I don't know how to explain this but I'll try:
In general I find the name of the field a little confusing. Setting a value to '# of tweets shown' will change the widget from being scrollable to being fixed and will override the height chosen in the previous input.
At first I thought it would just limit the amount of tweets pulled into the scrollable steam. What it does is makes the stream not scrollable and expands its height to display the fixed number of tweets with no load more option.

What would you say to a toggle option?

  • no limit (when selected let's you choose a height)
  • limit # of tweets shown (when selected let's you choose a number between 1 and 20)

@georgestephanis
Copy link
Member

As per the Official Twitter Timeline documentation the tweet-limit (if provided) would need to be between 1 and 20, so we should also change the input type to number and add min and max attributes.

If not provided, I'd sooner see it display as blank, rather than a number that could be misleading. So maybe add a sanitize snippet like if ( 0 == (int) $tweet_limit ) $tweet_limit = null;

@Viper007Bond
Copy link
Contributor

Not all browsers support number, do they? A dropdown with 1 to 20 seems like a better choice.

Also I agree with blank being better than 0. 0 is just confusing.

@georgestephanis
Copy link
Member

If they don’t support number, it’ll just display as a normal text input.  Nothing lost, and PHP can normalize the input on save.

George Stephanis
Sent with Airmail

On December 18, 2013 at 2:41:43 PM, Alex Mills (notifications@github.com) wrote:

Not all browsers support number, do they? A dropdown with 1
to 20 seems like a better choice.

Also I agree with blank being better than 0. 0 is just confusing.


Reply to this email directly or view it on GitHub:
#6 (comment)

Null is the default value (unlimited amount of tweets)
Input now uses `number` type with `min` and `max` values as recommended in the twitter documentation:
https://dev.twitter.com/docs/embedded-timelines

See discussion in #6 for more details.
@georgestephanis
Copy link
Member

Looks good.

georgestephanis added a commit that referenced this pull request Dec 21, 2013
Twitter Timeline `undefined index` & html5 input.
Migrate the tweet-limit to use input type="number" and set a min and max of 1 and 20, respectively.
Fix the undefined index by setting a default.
@georgestephanis georgestephanis merged commit 045c47f into Automattic:master Dec 21, 2013
@jeherve jeherve deleted the tweet-limit-notice branch December 30, 2013 11:15
matticbot pushed a commit that referenced this pull request Dec 16, 2020
Summary:
This MC page https://[private link]?tags=hello&sort=popularity&_locale=en&refresh=0
was failing with this error:

```
Fatal error: Uncaught Error: Call to undefined function has_meta() in /home/wpcom/public_html/public.api/rest/sal/class.json-api-post-base.php:123 Stack trace: #0 /home/wpcom/public_html/public.api/rest/json-endpoints/class.wpcom-json-api-post-v1-1-endpoint.php(264): SAL_Post->get_metadata() #1 /home/wpcom/public_html/public.api/rest/json-endpoints/class.wpcom-json-api-post-v1-1-endpoint.php(130): WPCOM_JSON_API_Post_v1_1_Endpoint->render_response_keys(Object(WPCOM_Post), 'display', Array) #2 /home/wpcom/public_html/public.api/rest/json-endpoints/class.wpcom-json-api-get-post-v1-1-endpoint.php(70): WPCOM_JSON_API_Post_v1_1_Endpoint->get_post_by('ID', 7265, 'display') #3 /home/wpcom/public_html/public.api/rest/wpcom-json-endpoints/class.wpcom-json-api-read-site-post-endpoint.php(35): WPCOM_JSON_API_Get_Post_v1_1_Endpoint->callback('/read/sites/%s/...', 131300129, 7265) #4 /home/wpcom/public_html/wp-content/lib/reader-site-post/class.wpcom-reader-site-post.php(23): WPCOM_JSON_API_Read_Site_Post_Endpoint->callback('/read/sites/%s/...', 131300129, 7265) #5 /home/wpcom/public_html/wp-content/rest-api-plugins/endpoints/read-tags-cards.php(214): WPCOM_Reader_Site_Post::get_site_post(131300129, 7265) #6 /home/wpcom/public_html/wp-content/rest-api-plugins/endpoints/read-tags-cards.php(180): WPCOM_REST_API_V2_Endpoint_Read_Tags_Cards->process_es_results(Array) #7 /home/missioncontrol/public_html/reader/mobile-endpoints/cards/index.php(95): WPCOM_REST_API_V2_Endpoint_Read_Tags_Cards->get_cards(Array) #8 {main} thrown in /home/wpcom/public_html/public.api/rest/sal/class.json-api-post-base.php on line 123
```

Searching around, it seems that the `has_meta` function is defined not in `wp-includes/post.php` but rather in `wp-admin/includes/post.php`

I am a bit skeptical of this change though, because it seems like it could be potentially breaking many things.

Test Plan:
Apply patch on sandbox and see that cards are properly working for:
https://[private link]?tags=hello&sort=popularity&_locale=en&refresh=0

I feel like it needs a bunch more testing, but not sure exactly what. Will definitely need to make sure that it doesn't break other things.

Reviewers: bluefuton, gibrown

Reviewed By: gibrown

Subscribers: vickikb, sodrowski, jsnmoon, gibrown

Tags: #touches_jetpack_files

Differential Revision: D53904-code

This commit syncs r218377-wpcom.
kraftbj pushed a commit that referenced this pull request Jan 12, 2021
Beta Testing List: allow more formatting with Markdown
jeherve pushed a commit that referenced this pull request Jun 18, 2021
* Dashboard restyling to align it with the Jetpack branding

* Refactor a bunch of things to use and reuse the same wrappers for all views. Add notices. Add footer. Put fatal error into a warning notice.

* Stylize all UI messages consistently

* Refactor to render the main content first without outputting it, and save whether the link to the VaultPress online dashboard must be shown or not

This data is luego used in the caller function that handles the general rendering

* Introduce the Jetpack logo package and place it under the footer

* Use the gray version of the Jetpack logo

* Move notice styles to a new stylesheet so they have a consistent look throughout the wp admin. Add classes so the notices are moved by WP core below the heading

* Add a prompt so user has to confirm that they want to reset VP options in database

* Set correct alert level for notices

* Fix issue where I reverted a condition to test and didn't put it back as it was.

* Fix wrapper width on large screens. Make cards stack on small screens.

* Link the Powered by Jetpack to the Jetpack dashboard if it exists or jetpack.com otherwise

* Hide heading served remotely in certain UI messages

* Fix offset layout when Jetpack is deactivated. This is because when JP is active there's a different class in the body than when it's inactive and VP stands on its own admin screen

* Fix layout of top notice on mobile

* Hide notices that are shown above the dashboard wrapper just like we do in Jetpack
jeherve added a commit that referenced this pull request Jun 18, 2021
* Readme: add PHP version requirement.

* Standardize structure & move old changelogs to separate file

* It makes things easier for translators, they don't need to focus on translating old strings.
* It makes the current changelog stand out a bit more.

* Update plugin version to Beta

* Changelog: add #6

* Remove bug fix section

We may not need it in this release

* Add testing file
leogermani pushed a commit that referenced this pull request Aug 12, 2022
When using WP-Cli to run the event "wp_cache_full_preload_hook" causes the follow error

> /webdir/bin/wp cron event run --due-now

```
PHP Fatal error:  Uncaught Error: Call to undefined function wp_cache_debug() in /webdir/web/app/plugins/wp-super-cache/wp-cache.php:3163
Stack trace:
#0 /webdir/web/wp/wp-includes/class-wp-hook.php(298): wp_cron_preload_cache()
#1 /webdir/web/wp/wp-includes/class-wp-hook.php(323): WP_Hook->apply_filters('', Array)
#2 /webdir/web/wp/wp-includes/plugin.php(515): WP_Hook->do_action(Array)
#3 phar:///webdir/bin/wp/php/commands/cron-event.php(284): do_action_ref_array('wp_cache_full_p...', Array)
#4 phar:///webdir/bin/wp/php/commands/cron-event.php(255): Cron_Event_Command::run_event(Object(stdClass))
#5 [internal function]: Cron_Event_Command->run(Array, Array)
#6 phar:///webdir/bin/wp/php/WP_CLI/Dispatcher/CommandFactory.php(67): call_user_func(Array, Array, Array)
#7 [internal function]: WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}(Array, Array)
#8 phar:///webdir/bin/wp/php/WP_CLI/Dispatcher/Subcommand.php(372): call_user_func(Objec in /webdir/web/app/plugins/wp-super-cache/wp-cache.php on line 3163
Fatal error: Uncaught Error: Call to undefined function wp_cache_debug() in /webdir/web/app/plugins/wp-super-cache/wp-cache.php:3163
Stack trace:
#0 /webdir/web/wp/wp-includes/class-wp-hook.php(298): wp_cron_preload_cache()
#1 /webdir/web/wp/wp-includes/class-wp-hook.php(323): WP_Hook->apply_filters('', Array)
#2 /webdir/web/wp/wp-includes/plugin.php(515): WP_Hook->do_action(Array)
#3 phar:///webdir/bin/wp/php/commands/cron-event.php(284): do_action_ref_array('wp_cache_full_p...', Array)
#4 phar:///webdir/bin/wp/php/commands/cron-event.php(255): Cron_Event_Command::run_event(Object(stdClass))
#5 [internal function]: Cron_Event_Command->run(Array, Array)
#6 phar:///webdir/bin/wp/php/WP_CLI/Dispatcher/CommandFactory.php(67): call_user_func(Array, Array, Array)
#7 [internal function]: WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}(Array, Array)
#8 phar:///webdir/bin/wp/php/WP_CLI/Dispatcher/Subcommand.php(372): call_user_func(Objec in /webdir/web/app/plugins/wp-super-cache/wp-cache.php on line 3163
```

This patch correct this based on deactivate/uninstall hooks which works on WP-Cli.
tbradsha pushed a commit that referenced this pull request Apr 17, 2024
Remove PHP function that displays the icons in the svg format
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Extra Sidebar Widgets [Type] Bug When a feature is broken and / or not performing as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants