sobrenome
Clients-
Posts
2,525 -
Joined
-
Last visited
Content Type
Downloads
Release Notes
IPS4 Guides
IPS4 Developer Documentation
Invision Community Blog
Development Blog
Deprecation Tracker
Providers Directory
Forums
Events
Store
Gallery
Everything posted by sobrenome
-
Get YouTube json API data on Pages template
sobrenome replied to sobrenome's topic in Technical Problems
What would be the preferred method to protect the key? -
Get YouTube json API data on Pages template
sobrenome replied to sobrenome's topic in Technical Problems
I have tried to use raw php block and checked that the issue is related to permission to access YouTube api: array(1) { ["error"]=> array(4) { ["code"]=> int(403) ["message"]=> string(42) "Requests from referer are blocked." ["errors"]=> array(1) { [0]=> array(3) { ["message"]=> string(42) "Requests from referer are blocked." ["domain"]=> string(6) "global" ["reason"]=> string(9) "forbidden" } } ["status"]=> string(17) "PERMISSION_DENIED" } } I have used HTTP restriction to accept only mydomain.com/* What is the HTTP referer used by IPS? -
Get YouTube json API data on Pages template
sobrenome replied to sobrenome's topic in Technical Problems
Without restrictions: { "kind": "youtube#searchListResponse", "etag": "e7yynn8uB_ol2402PjXEO7wAOi4", "nextPageToken": "CAUQAA", "regionCode": "BR", "pageInfo": { "totalResults": 11, "resultsPerPage": 5 }, "items": [ { "kind": "youtube#searchResult", "etag": "jznUn23q7z5iMHGhgDHVzStPO7k", "id": { "kind": "youtube#video", "videoId": "60B-cMqugOI" }, "snippet": { "publishedAt": "2019-11-07T20:59:54Z", "channelId": "UCdOrJP8qk2A2cL9aM2VybOw", "title": "Probiogurt Puravida", "description": "Pronto em 1 minuto! O PROBIOGURT da Puravida é um alimento fermentado em pó feito a partir de leite de coco puro, elementos prebióticos e 11 diferentes ...", "thumbnails": { "default": { "url": "https://i.ytimg.com/vi/60B-cMqugOI/default.jpg", "width": 120, "height": 90 }, "medium": { "url": "https://i.ytimg.com/vi/60B-cMqugOI/mqdefault.jpg", "width": 320, "height": 180 }, "high": { "url": "https://i.ytimg.com/vi/60B-cMqugOI/hqdefault.jpg", "width": 480, "height": 360 } }, "channelTitle": "Puravida Superfoods", "liveBroadcastContent": "none", "publishTime": "2019-11-07T20:59:54Z" } }, { "kind": "youtube#searchResult", "etag": "09HwUSDUdatDykcQylssLB-eAbY", "id": { "kind": "youtube#video", "videoId": "Rp6xWL6AiwI" }, "snippet": { "publishedAt": "2019-11-07T20:49:45Z", "channelId": "UCdOrJP8qk2A2cL9aM2VybOw", "title": "One Nutrition Puravida", "description": "Um alimento, múltiplos benefícios. Elaborado com proteínas vegetais de alto desempenho (92% de biodisponibilidade), o ONE é um complexo nutritivo de ...", "thumbnails": { "default": { "url": "https://i.ytimg.com/vi/Rp6xWL6AiwI/default.jpg", "width": 120, "height": 90 }, "medium": { "url": "https://i.ytimg.com/vi/Rp6xWL6AiwI/mqdefault.jpg", "width": 320, "height": 180 }, "high": { "url": "https://i.ytimg.com/vi/Rp6xWL6AiwI/hqdefault.jpg", "width": 480, "height": 360 } }, "channelTitle": "Puravida Superfoods", "liveBroadcastContent": "none", "publishTime": "2019-11-07T20:49:45Z" } }, { "kind": "youtube#searchResult", "etag": "TDjy3XttLGMCwZQK_CP1bgpNBpg", "id": { "kind": "youtube#video", "videoId": "kwuNS0ko38Y" }, "snippet": { "publishedAt": "2018-10-19T16:43:53Z", "channelId": "UCdOrJP8qk2A2cL9aM2VybOw", "title": "Coconut Granola Puravida", "description": "O segredo de qualquer receita é a qualidade dos ingredientes. E a Coconut Granola Low Carb da Puravida é feita com os mais nobres alimentos!", "thumbnails": { "default": { "url": "https://i.ytimg.com/vi/kwuNS0ko38Y/default.jpg", "width": 120, "height": 90 }, "medium": { "url": "https://i.ytimg.com/vi/kwuNS0ko38Y/mqdefault.jpg", "width": 320, "height": 180 }, "high": { "url": "https://i.ytimg.com/vi/kwuNS0ko38Y/hqdefault.jpg", "width": 480, "height": 360 } }, "channelTitle": "Puravida Superfoods", "liveBroadcastContent": "none", "publishTime": "2018-10-19T16:43:53Z" } }, { "kind": "youtube#searchResult", "etag": "mtpTXL4UgYKBtX2sLnlcxogn_mc", "id": { "kind": "youtube#video", "videoId": "H2739WTmO8o" }, "snippet": { "publishedAt": "2018-10-19T16:45:09Z", "channelId": "UCdOrJP8qk2A2cL9aM2VybOw", "title": "Spirulina Premium Puravida", "description": "Estas microalgas são possivelmente os alimentos naturais com maior densidade nutritiva. A Spirulina e a Clorella oferecem uma altíssima riqueza e ...", "thumbnails": { "default": { "url": "https://i.ytimg.com/vi/H2739WTmO8o/default.jpg", "width": 120, "height": 90 }, "medium": { "url": "https://i.ytimg.com/vi/H2739WTmO8o/mqdefault.jpg", "width": 320, "height": 180 }, "high": { "url": "https://i.ytimg.com/vi/H2739WTmO8o/hqdefault.jpg", "width": 480, "height": 360 } }, "channelTitle": "Puravida Superfoods", "liveBroadcastContent": "none", "publishTime": "2018-10-19T16:45:09Z" } }, { "kind": "youtube#searchResult", "etag": "SkmlPdjeSNdwoOHZj7RbgaWmz4Y", "id": { "kind": "youtube#video", "videoId": "zMdz1pLA1eE" }, "snippet": { "publishedAt": "2018-10-19T16:42:34Z", "channelId": "UCdOrJP8qk2A2cL9aM2VybOw", "title": "Coco Cream Puravida", "description": "O Coco Cream é o puro leite de coco em pó instantâneo mais cremoso e delicioso do mercado! Basta adicionar uma colher na água morna e pronto!", "thumbnails": { "default": { "url": "https://i.ytimg.com/vi/zMdz1pLA1eE/default.jpg", "width": 120, "height": 90 }, "medium": { "url": "https://i.ytimg.com/vi/zMdz1pLA1eE/mqdefault.jpg", "width": 320, "height": 180 }, "high": { "url": "https://i.ytimg.com/vi/zMdz1pLA1eE/hqdefault.jpg", "width": 480, "height": 360 } }, "channelTitle": "Puravida Superfoods", "liveBroadcastContent": "none", "publishTime": "2018-10-19T16:42:34Z" } } ] } -
I am trying to retrieve json API data from YouTube using this code: {{$key = 'xxxxxxxxxxxxx';}} {{$base_url = 'https://www.googleapis.com/youtube/v3/search';}} {{$channel_id = $record->customFieldDisplayByKey('youtube_channel_id');}} {{$max_results = 3;}} {{$api_url = \IPS\Http\Url::external( $base_url )->setQueryString( array( 'order' => 'date', 'part' => 'snippet', 'channelId' => $channel_id, 'maxResult' => $max_results, 'key' => $key ) );}} {{$videos = $api_url->request()->get()->decodeJson();}} But the string $videos is empty. Could not use this code: // Create a URL object $url = \IPS\Http\Url::external( "http://someurl.com" )->setQueryString( 'key', 'value' ); // Now fetch it and decode the JSON try { $response = $url->request()->get()->decodeJson(); } catch( \IPS\Http\Request\Exception $e ) { die( "There was a problem fetching the request" ); } catch( \RuntimeException $e ) { die( "The response was not valid JSON" ); } var_dump( $response ); exit; Because I am on a Page template that does not accept raw php. The URL from YouTube seems to be ok (it only allows GET from my domain) : { "error": { "code": 403, "message": "Requests from referer \u003cempty\u003e are blocked.", "errors": [ { "message": "Requests from referer \u003cempty\u003e are blocked.", "domain": "global", "reason": "forbidden" } ], "status": "PERMISSION_DENIED" } }
-
-
Video is now a must for many communities. We really need better video features. There is also this Amazon service to process video files: https://aws.amazon.com/elastictranscoder/ So it is now possible to have better video on the communities with low cost.
-
Post Attachments to Gallery - Is It Possible?
sobrenome replied to Joy Rex's topic in Technical Problems
I think that I would be a nice option to auto populate a member album called "Member Name Attachments" and make easier for the community to see every image or video posted by the member along the community, as long as there is no attachment display on member profile. -
Are attachments available on member's profile?
-
flag \IPS\Db::SELECT_SQL_CALC_FOUND_ROWS not working
sobrenome replied to sobrenome's topic in Technical Problems
-
Adding Pagination to Custom Record Feed Block
sobrenome replied to Revast's topic in Technical Problems
I also would like to know. -
flag \IPS\Db::SELECT_SQL_CALC_FOUND_ROWS not working
sobrenome replied to sobrenome's topic in Technical Problems
It is updated now! Thanks @bfarber! -
I have changed the $baseUrl to: {{$baseUrl = \IPS\Http\Url::internal( 'app=cms&module=pages&controller=page', 'front', 'content_page_path');}} But now there is no pagination number attached to the pages URL. I see that on record view there is pagination for comments (?tab=comments) and reviews (?tab=reviews). Can I add my own custom tab to paginate the records from another database?
-
flag \IPS\Db::SELECT_SQL_CALC_FOUND_ROWS not working
sobrenome replied to sobrenome's topic in Technical Problems
Perfect! Thanks! Please update the developer docs: https://invisioncommunity.com/developers/docs/fundamentals/accessing-the-database-r166/ -
On a record view template of a database (brand database), I want to show records from another database that are related (products from the brand). The custom code: {{$baseUrl = $record->url( "getPrefComment" );}} {{$limit=20;}} {{$page = (isset( \IPS\Request::i()->page ) and (intval( \IPS\Request::i()->page ) > 0)) ? \IPS\Request::i()->page : 1;}} {{$start = ( $limit * ( $page - 1 ) );}} {{$total = \IPS\Db::i()->select( 'COUNT(*)', 'cms_custom_database_8', array( 'field_140=?', $record->primary_id_field ) )->first();}} {{$select = \IPS\Db::i()->select( 'cms_custom_database_8.field_68 as nome_do_suplemento, cms_custom_database_8.record_image_thumb as imagem, cms_custom_database_8.primary_id_field as id_do_suplementos, cms_custom_database_8.member_id as autor, cms_custom_database_8.record_updated as data_de_atualizacao, cms_custom_database_8.record_comments as numero_de_comentarios', 'cms_custom_database_8', array( 'field_140=?', $record->primary_id_field ), 'cms_custom_database_8.field_68 ASC', array( $start, $limit ) );}} {{$pages = ceil($total / $limit);}} <div> {template="pagination" group="global" app="core" location="global" params="$baseUrl, $pages, $page, $limit, TRUE, 'page'"} </div> The problem is that when page 2 and so on are requested, IPS automatically redirects the URL to original record url (no pagination at all). Is there a way to add pagination on record view template (avoid auto redirect)?
-
This is my select: {{$limit = 20;}} {{$page = (isset( \IPS\Request::i()->page ) and (intval( \IPS\Request::i()->page ) > 0)) ? \IPS\Request::i()->page : 1;}} {{$start = ( $limit * ( $page - 1 ) );}} {{$select = \IPS\Db::i()->select( 'cms_custom_database_8.field_68 as nome_do_suplemento, cms_custom_database_8.record_image_thumb as imagem, cms_custom_database_8.primary_id_field as id_do_suplementos, cms_custom_database_8.member_id as autor, cms_custom_database_8.record_updated as data_de_atualizacao, cms_custom_database_8.record_comments as numero_de_comentarios', 'cms_custom_database_8', array( 'field_140=?', $record->primary_id_field ), 'cms_custom_database_8.field_68 ASC', array( $start, $limit ), NULL, NULL, \IPS\Db::SELECT_SQL_CALC_FOUND_ROWS );}} {{$total = count( $select );}} Total should be 64, but it gives me 20, the number of rows used as query LIMIT.
-
Is there a guide for this? I have a database for medical drugs and Pages uses article type schema. I would like to use the specific drug schema: https://schema.org/Drug I have tried: {{\IPS\Output::i()->jsonLd['Drug']['activeIngredient'] = $record->_title;}} But the result is incorrect: <script type='application/ld+json'> { "activeIngredient": "Fenilpropionato de nandrolona" } </script>
-
Suggestions for improvement on Schema.org tags for Pages
sobrenome replied to Gabriel Torres's topic in Feedback
-
Maybe you can use it like this:
-
Where can I see all the record images uploaded using Pages? And when a record from the Pages database is deleted is the record image also deleted?
-
Recommend Usage of Amazon S3?
sobrenome replied to AlexWright's topic in Classic self-hosted technical help
How do you backup s3 files? -
Recommend Usage of Amazon S3?
sobrenome replied to AlexWright's topic in Classic self-hosted technical help
And the replication bucket has a copy only rule or a sync rule? If it is sync, if a file is deleted from the main bucket it will also be deleted from the replica. I was searching for the s3 versioning behavior and I have seen that when a file is deleted with versioning turned on, the file is not actually deleted from s3, there is a "version delete note" that can be deleted to restore the file. I still have to check, in real life, what happens when an admin or member IPS account deletes a file. If it will be retain as described above or if it will be actually deleted. If the file is not actually deleted, there is already a security layer against abusive deletion by adminCP account on IPS, and the files can be restored. No need for replication, as long as S3 has multiple files along AZs. Am I right? -
Recommend Usage of Amazon S3?
sobrenome replied to AlexWright's topic in Classic self-hosted technical help
Cloudflare does the https certificate validation in the case described, right? The user’s browser will get the file from http://cdn.YOURDOMAIN.com and the ssl translation will be made by Cloudflare right? The files are pushed from s3 to cloudflare’s pops and the user will get the file from cloudflare, not from s3, right? -
Recommend Usage of Amazon S3?
sobrenome replied to AlexWright's topic in Classic self-hosted technical help
So far o good. If I do not use dots in bucket name, how could I use Cloudflare and S3? -
Recommend Usage of Amazon S3?
sobrenome replied to AlexWright's topic in Classic self-hosted technical help
Just the same permissions: I am using Cloudflare, so I set a subdomain for the bucket on Cloudflare: CNAME record name: cdn destination: cdn.YOURDOMAIN.COM.s3.sa-east-1.amazonaws.com On AWS: bucket name: cdn.YOURDOMAIN.COM On IPS: bucket: cdn.YOURDOMAIN.COM endpoint: s3.sa-east-1.amazonaws.com custom URL: //cdn.YOURDOMAIN.COM Remember to use the proper region of your bucket. I would like to know how are you dealing with data security. S3 is very reliable and do not need a backup as long there is an auto AWS replication of the data. But what if someone hacks the community AdminCP account and delete all files? Everything will be delete on S3. Anyone is using S3 replication to another AWS account to secure the data? Is there any better solution?