Developer Connection
Use this forum to interact with our development team on technical issues, suggestions and official best practices advice.
1,734 topics in this forum
-
- 1 follower
- 3 replies
- 330 views
Is there a way to toggle on a $form->addHtml(' '); in the settings, for example $form->add( new \IPS\Helpers\Form\YesNo( 'ShowHTMLForm', \IPS\Settings::i()->ShowHTMLForm, FALSE, array('togglesOn' => array( 'The_setting_below' ) ) ) ); $form->addHtml('I want this to display if ShowHTMLForm = 1 ');
Last reply by TheJackal84, -
- 1 follower
- 4 replies
- 342 views
Let's say I have several PHP classes (each one in a separate file, located in the '/myPlugin/libs' directory) and I'm using those classes in the plugin hooks (after including them with require_once). However, the external .php files are not included in the plugin's .xml file. Since those external classes are used in several hooks, I would really like to avoid hardcoding them into each of the hooks. For now, I have to manually upload the 'libs' catalogue via FTP everytime I install the plugin... not very user-friendly, is it? What is the most elegant and convenient way to include a 3rd party library within a plugin?
Last reply by Chatwee, -
- 1 follower
- 6 replies
- 392 views
Hello, I've recently created a plugin and it works as expected - as long as I test it in my local enviroment (dev mode enabled). After installing it on the actual community site, it seems that I have to disable the plugin and then enable it again for any changes in the 'edit' section to take effect. Do you guys have any suggestions on what might be causing this issue and how I can fix it? Thanks
Last reply by Chatwee, -
- 1 follower
- 2 replies
- 350 views
Hey, it seems like \IPS\cms\modules\admin\databases::form() (the form creation) is not extendable atm. Could you guys please move the form creation to its own function so we can extend it? Thanks.
Last reply by Daniel F, -
- 5 replies
- 321 views
If I was to make a setting for width & height like below $ImageSize = ( isset( \IPS\Settings::i()->MyImageSize ) ) ? explode( 'x', \IPS\Settings::i()->MyImageSize ) : array( 75, 75 ); $form->add( new \IPS\Helpers\Form\WidthHeight( 'MyImageSize', $ImageSize, TRUE, array( 'resizableDiv' => TRUE ), NULL, NULL, NULL, 'MyImageSize' ) ); How would I implement that into a css file?
Last reply by bfarber, -
- 2 replies
- 317 views
Hello everybody, I am currently working on a plugin and having a hard time including my custom library in one of the hooks. Let's say I have a class defined in a class1.php file (location: \[IPS root path]\plugins\myExamplePlugin\lib\class1.php). Here's what the class1.php file looks like: <?php class Example_class { private static $_someValue = null; private static $_anotherValue = null; public static function setSomeValue($someValue) { self::$_someValue = $someValue; } public static function setAnotherValue($anotherValue) { self::$_anotherValue = $anotherValue; } public static function getSomeValue() { return self::$_someValue; } pu…
Last reply by Chatwee, -
- 1 follower
- 3 replies
- 273 views
Can anybody tell me the {{ if }} statement for if a certain app is installed
Last reply by TheJackal84, -
- 6 replies
- 530 views
Im trying to upload files via the REST Api but the file gets corrupt. Code: $handle = fopen("/home/test/test.pdf", "r"); $contents = fread($handle, filesize("/home/test/test.pdf")); fclose($handle); $post = array( 'category' => 4, 'author' => 2, 'title' => 'Test', 'description' => 'Test', 'files' => array('test.pdf' => $contents), ); $target_url = 'https://example.com/api/downloads/files'; $ch = curl_init(); curl_setopt($ch, CURLOPT_TIMEOUT, 86400); curl_setopt($ch, CURLOPT_URL,$target_url); curl_setopt($ch, CURLOPT_POST,1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post)); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_seto…
Last reply by felix21, -
- 1 follower
- 7 replies
- 391 views
The title sounds hysterical, actually. It's screaming for snarky responses. Please don't give me snarky responses. I have a button that opens a dialog with a small form for the users to fill out. <a href="{$project->url()->setQueryString( array( 'do' => 'export', 'export' => 'fasta' ) )}" data-ipsDialog data-ipsDialog-title="{lang="project_export_fasta"}" data-ipsDialog-size="medium">{lang="project_export_fasta"}</a> When the user fills out the form and presses Save, the application generates a text file and downloads it. Now... how do I get the dialog to close after that file is downloaded? It just sits there and keeps spinning. …
Last reply by BomAle, -
- 1 follower
- 6 replies
- 415 views
Hi, I have a database "ingredients" which is linked to a number of times from my other databases. For some strange reason, I am absolutely not able to list reciprocalitems on the display page. I have tried multiple times to changes templates to see if that had any effect but nothing is happening. The code in my template is: <div class='ipsPageHeader ipsClearfix ipsPad'> <div class='ipsPos_right ipsResponsive_noFloat ipsResponsive_hidePhone'> {template="follow" app="core" group="global" params="'cms', 'records'.$record::$customDatabaseId, $record->primary_id_field, $record->followers()->count( TRUE )"} </div> <h1 c…
Last reply by Jacques Corby-Tuech, -
- 1 follower
- 2 replies
- 345 views
Hey, I am running a mobile game forums and some popular streamers offered to do advertisements during their streams. Hence we expect very large peaks where a lot users will register and/or authenticate. I know that the password hashing procedure (login or register) takes a lot CPU and we've measured that our dedicated server (4c / 8t) can perform 10 hashes per second which is not enough for our case. However the server is able to handle ~2k concurrent users. Because of this scenario I wonder if it's possible to add an external server which is primarily busy with creating the hashs to compare/insert them against the Database. Maybe you've got better suggestions t…
Last reply by bfarber, -
- 1 follower
- 3 replies
- 425 views
I am seeing: Sorry, there is a problem The page you requested does not exist Error code: 1S160/2 when my script (essentially copy/pasted from the LinkedIn auth.php) does: if (isset(\IPS\Request::i()->error) and \IPS\Request::i()->error) { \IPS\Dispatcher\Front::i(); if (\IPS\Request::i()->error == 'access_denied') { \IPS\Output::i()->error(htmlentities(\IPS\Request::i()->error_description, ENT_QUOTES | \IPS\HTMLENTITIES, 'UTF-8', false), 'E400', 403); } else { \IPS\Output::i()->error(htmlentities(\IPS\Request::i()->error_description, ENT_QUOTES | \IPS\HTMLENT…
Last reply by HeadStand, -
- 2 followers
- 5 replies
- 371 views
I'm not quite sure where to post this, so I'm dumping it here. Is it possible to please pay closer attention to the PHPDoc on methods? Particularly the return type. If the return type is not correct, it makes it really confusing in an IDE. Example: From \IPS\Content\Search\Query /** * Create new query * * @param \IPS\Member $member The member performing the search (NULL for currently logged in member) * @return \IPS\Content\Search */ public static function init( \IPS\Member $member = NULL ) { return new \IPS\Content\Search\Mysql\Query( $member ?: \IPS\Member::loggedIn() ); } Return type there should be \IPS\Content\Search\Query, not \IPS\Content\Sea…
Last reply by HeadStand, -
- 1 reply
- 342 views
In the Downloads application, is it possible to hook to provide screenshots automatically, based on the uploaded file? The files I am receiving are in a format that a screenshot could potentially be generated from. Thanks!
Last reply by bfarber, -
- 1 follower
- 8 replies
- 361 views
Last reply by newbie LAC, -
- 1 follower
- 6 replies
- 525 views
So I have noticed on my test site when I hook into \IPS\nexus\Package , using $purchase->id returns the wrong number. From what I understand its supposed to be t_id from nexus_transactions but isn't. 1274 is the actual number, but returns 964 when called. I have tried to bring this up in a ticket but was shrugged off by support. Edit: when targeting invoice->id that returns the correct invoice number.
Last reply by HeadStand, -
- 1 follower
- 1 reply
- 352 views
I am loading a created form with multiple tabs (each tab contain some form inputs) via Ajax. Unfortunately all the content is visible (instead of being inside in each tab). I assume this is happening because the Javascript for the tabmenu is not loaded on the page from where I am doing this Ajax request. How can I make sure all required Javascript files for the generated form elements will be loaded as well? I tried to figure out what JavaScript files are missing for my tabmenu but I failed. There are so many javascript controllers/files loaded it's hard to find the missing ones. Maybe anyone can provide a proper solution for my problem?
Last reply by BomAle, -
- 6 replies
- 811 views
I am afraid this is a very specific question, but I am stuck with this problem. I am building a tab based page, which is very similiar to the userpanel: I am also a function for each area (sessions, statistics, ...) and I return a template each function which will be inserted into the content area (if it's an ajax request). As you can see in this screenshot I am building a "\IPS\Helpers\Table\Custom". The problem is: Every time I click the sessions tab a second time it will trigger a full page reload. I don't experience this behaviour with other tabs, I expected that it doesn't reload/request anything at all after the tab content has been initially loaded. …
Last reply by bfarber, -
- 3 replies
- 331 views
Ok so I am creating a plugin for the user info panel on the topics and its basically a social info block, I have gone for adding the custom fields via the database on installing the plugin as it is the only way I have figured out how to add custom fields without having the user have to go into admin settings and manually add the custom fields to the members profile. Here's part of the install code public function step1() { \IPS\Db::i()->insert( 'core_pfields_groups', array( 'pf_group_id' => 998, 'pf_group_order' => 998, ) ); \IPS\Db::i()->insert( 'core_pfields_data', array( 'pf_id' => 9995, 'pf_content' => '[]', …
Last reply by bfarber, -
- 1 follower
- 3 replies
- 302 views
When try to add new version if the last version is not that format n.n.n like 1.0.2 Beta 1 the code throw a expection. to fix I have edited: $defaults['human'] = "{$exploded[0]}.{$exploded[1]}." . ( $exploded[2] + 1 ); into $defaults['human'] = "{$exploded[0]}.{$exploded[1]}." . ( intval( $exploded[2] ) + 1 );
Last reply by bfarber, -
- 1 follower
- 4 replies
- 351 views
How do I remove calendar events from the feed "all activities"?
Last reply by bfarber, -
- 1 reply
- 260 views
So if I were to sync username from a service for a login handler (like a xbox live gamertag ; which is changeable) what would I be looking for and is it possible to save the name change?
Last reply by newbie LAC, -
- 3 replies
- 556 views
So, it appears I am missing a template when trying to view a container node: BadMethodCallException: NO_TEMPLATE_FILE - /Users/ryan/Code/Sites/thegaminglist/applications/core/dev/html/front/trees/row.phtml (0) This file does not exist in the developer sdk for 4.1.19.1 (latest). Am I missing something?
Last reply by Adriano Faria, -
- 1 reply
- 335 views
Hello, Widget settings validation doesn't work. Code public function configuration( &$form=null ) { if ($form === null) { $form = new \IPS\Helpers\Form; } $form->add( new \IPS\Helpers\Form\Text( 'custom_validate', isset($this->configuration['custom_validate']) ? $this->configuration['custom_validate'] : null, false, array(), function($val) { if ($val == 'bad') { throw new \InvalidArgumentException('form_bad_value'); } } ) ); $form->add( new \IPS\Helpers\Form\Text( 'required_field', isset($this->configuration['required_field']) ? $this->configuration['required_field'] : nu…
Last reply by bfarber, -
- 1 follower
- 3 replies
- 324 views
Hello. Hiding in data-ipsTruncate widget is not working with ipsContained class. For example: <div class="ipsType_medium ipsType_textBlock ipsType_richText ipsContained" data-ipstruncate="" data-ipstruncate-type="hide" data-ipstruncate-size="6 lines"> <p>Some VERY long text...</p> </div> And as a result I got this: So, I have selected 'truncate up to 6 lines', but the result is different. When I click 'Read more' the button just disappear. @Rikki is it a bug? If not, then how to get around this problem?
Last reply by Kirill Gromov,