Developer Connection
Use this forum to interact with our development team on technical issues, suggestions and official best practices advice.
1,668 topics in this forum
-
- 1 follower
- 2 replies
- 204 views
Simple suggestion to make third-party stuff a bit more neat. I may want to add a header to separate my content when inserting form elements like so, /** * Add Input * * @param \IPS\Helpers\Form\FormAbstract $input Form element to add * @param string|NULL $after The key of element to insert after * @param string|NULL $tab The tab to insert onto * @return void */ public function add( $input, $after=NULL, $tab=NULL ) But addHeader does not support $after and $tab as arguments at the moment, /** * Add Header * * @param string $lang Language key * @return void */ public function addHeader( $lang ) Very minor, but would…
Last reply by Makoto, -
- 2 followers
- 2 replies
- 224 views
Whoops\Exception\ErrorException thrown with message "Unparenthesized `a ? b : c ? d : e` is deprecated. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)`" Stacktrace: #10 Whoops\Exception\ErrorException in /home/michael/public_html/dev/system/Node/Controller.php:969 #9 Whoops\Run:handleError in /home/michael/public_html/dev/init.php:653 #8 require_once in /home/michael/public_html/dev/init.php:653 #7 IPS\IPS:autoloader in [internal]:0 #6 spl_autoload_call in /home/michael/public_html/dev/applications/core/modules/admin/applications/applications.php:23 #5 require_once in /home/michael/public_html/dev/init.php:653 #4 IPS\IPS:autoloader in [internal]:0 #3 spl_autolo…
Last reply by CodingJungle, -
- 1 follower
- 3 replies
- 247 views
Hi, applications/forums/Application.php, method convertLegacyParameters. 1) Page-parameter is not converted properly, incorrect function-call. 2) This is a bit more involved. Before the upgrade, a link to a specific post could look like this: https://example.com/index.php?showtopic=1706933&page=607#entry25148242 However, after it's been through the post conversion (3.4 -> 4.4), the link in the post looks like this instead: https://example.com/index.php?showtopic=1706933&page=607&do=findComment&comment=25148242 And that link only takes you to the topic (and the page given, if the first bug is fixed). So my suggested…
Last reply by Daniel F, -
- 1 follower
- 2 replies
- 233 views
Hi, In applications/core/modules/admin/languages/languages.php you have two calls like this (line 305) foreach ( array( 'vle_editor', 'vle_keys' ) as $k ) { if ( $values[ 'lang_' . $k ] ) { \IPS\Request::i()->setcookie( $k, 1 ); } elseif ( isset( \IPS\Request::i()->cookie[ $k ] ) ) { \IPS\Request::i()->setcookie( $k, 0 ); } } Unless I'm missing something, it should be \IPS\Request::i()->setCookie with a big C instead of a small one.
Last reply by TSP, -
- 8 replies
- 312 views
I want to display a custom message based on a database condition after success of registration, Where I can do this? Requirements: If user coming from a specific url of website and complete the registration then user must have seen a custom message. Ex- You are now eligible for XXXXXXXX. Please help me
Last reply by bfarber, -
- 1 follower
- 1 reply
- 187 views
I stumbled upon this. In applications/forums/sources/Topic.php on line 1861: $comments[ $_hash ] = $this->_comments( $class, $limit ?: static::getCommentsPerPage(), $offset, ( isset( $class::$databaseColumnMap[ $order ] ) ? ( $class::$databasePrefix . $class::$databaseColumnMap[ $order ] ) : $order ) . ' ' . $orderDirection, $member, $includeHiddenComments, $cutoff, $includeWarnings, $extraWhereClause, $includeDeleted, $includeWarnings ); You pass on $includeWarnings twice. You send 11 parameters, but the function _comments in system/Content/Item.php "only" takes 10. (As a sidenote: I spent far too much time debugging an issue I had, which ended up …
Last reply by bfarber, -
- 2 followers
- 3 replies
- 273 views
Probably an issue with other comment classes, but I've only tested with \IPS\forums\Topic\Post. The behaviour on loadFromUrl doesn't produce an expected result. Let's say you installed the following code in the root folder of this community: <?php require_once( __DIR__ . '/init.php' ); $url = \IPS\Http\Url::createFromString( 'https://invisioncommunity.com/forums/topic/444948-cache-page-output-for-guests/?do=findComment&comment=2809267' ); $post = \IPS\forums\Topic\Post::loadFromUrl($url); echo "Loaded postId {$post->pid}: {$post->url()}"; What I would expect: It should load the post with postId 2809267. Alternatively fail if it's unable to …
Last reply by TSP, -
- 1 follower
- 1 reply
- 219 views
Hello, $form = new \IPS\Helpers\Form(); $elements = array(); $options = array(); $toggles = array(); $unlimitedToggles = array(); $selected = -1; foreach (array('foo', 'bar', 'baz') as $v) { $options[$v] = $v; $k = 'test_select_toggles_' . $v; $toggles[$v] = array($k); $unlimitedToggles[] = $k; $elements[] = new \IPS\Helpers\Form\Text( $k, '', false, array(), null, null, null, $k ); } $form->add(new \IPS\Helpers\Form\Select( 'test_select_toggles_select', $selected, false, array( 'options' => $options, 'toggles' => $toggles, 'multiple' => true, 'unlimited' => -1, 'unlimitedToggles' => $unlimitedTo…
Last reply by bfarber, -
- 1 reply
- 220 views
Somewhere in my code I use the PHP function `exec()`. When I put the software in dev mode it gives me this error: How can I disabled this error/warning for this specific function? Or disable this check altogether?
Last reply by Fosters, -
- 2 followers
- 11 replies
- 500 views
Is there a tutorial anywhere that goes through the entire process of creating an app from start to finish? I'm finding the documentation to be very poor.
Last reply by bfarber, -
- 1 follower
- 3 replies
- 189 views
I have created a custom field in database of type Upload (Allow multiple). I would like to display uploaded images in the Lightbox widget. In the description of Display custom field is stated: If using mulitple uploads, $value is an array of File Objects. However it seems to be an array of strings and not File Objects, as this code fails: Error: Call to a member function thumbnail() on string (0)
Last reply by Daniel F, -
- 1 follower
- 1 reply
- 253 views
I reviewed some changes between 4.4.7 and 4.4.9.2 and found the following change for Output.php, line 658 --- a/public/system/Output/Output.php +++ b/public/system/Output/Output.php @@ -658,9 +658,19 @@ class _Output } } + /* Allow this page to be cached by guests? */ + $allowGuestCache = FALSE; + if ( $httpStatusCode == 404 or $httpStatusCode == 403 and ! \IPS\Member::loggedIn()->isBanned() and ! \IPS\Request::i()->ipAddressIsBanned() ) + { + $allowGuestCache = TRUE; + } + + // Do not cache error page…
Last reply by bfarber, -
- 4 replies
- 275 views
Hello, I'm working on plugin and use \IPS\Helpers\Form\Node 'toggleIds' => array(), // Element IDs to toggle on when a node with 'togglePerm' permission IS selected - or, if togglePerm is NULL, an associtive array of elements to toggle when particular node IDs are selected if togglePerm is NULL, an associtive array of elements to toggle when particular node IDs are selected But this doesn't work \applications\core\dev\html\global\forms\nodeCascade.phtml {{if $togglePerm}}data-control="toggle" {{if $node->can( $togglePerm, NULL, $togglePermPBR )}}data-toggles="{expression="implode( ',', $toggleIds )"}"{{elseif !$togglePerm and iss…
Last reply by bfarber, -
- 1 follower
- 5 replies
- 221 views
I need to know how I can use a API or anything by which I can subscribe or unsubscribe for reply/comment of a topic. Also tell me if a user comment under a topic then will that user automatically will be subscribe for email notification for that topic for further comments? If anyone can tell me how it is stored on database that will be very helpful as i need use database table for custom code. Thanks
Last reply by RRK, -
- 1 follower
- 3 replies
- 285 views
I created a new type of profile field but I can't seem to find how to use my own template as it doesn't has a class on form helper due to that in CustomField model: /** * Build Form Helper * * @param mixed $value The value * @param callback $customValidationCode Custom validation code * @return \IPS\Helpers\Form\FormAbstract */ public function buildHelper( $value=NULL, $customValidationCode=NULL ) { $class = '\IPS\Helpers\Form\\' . $this->type; /* Hooks can add custom field types which are stored in the database. Toggling the hook can then stop the hook from loading the field class giving a class not found error */ if ( ! class_exists( …
Last reply by bfarber, -
- 1 follower
- 1 reply
- 291 views
I have a \IPS\Content\Item class that implements \IPS\Content\Searchable. I've successfully gotten it to display arbitrary content in the search snippet in expanded view: I have not, however, succeeded in getting anything in condensed view. Other content items have a "user posted a ___ in ___", but mine shows nothing: When I look at the other applications shown in this picture, this isn't stored in the snippet template. As far as I can tell, something's displaying the language item "x_created_(class)" or "x_created_(class)_in" here, but I don't know how to tell the system to do so for my content item. Simply making sure those language items exist isn…
Last reply by evandixon, -
- 1 follower
- 13 replies
- 366 views
I shall win the "weirdest bug found" award this year for this one! just watch the video, i am not going to be able to explain this one, you just gotta see it to believe it 🙂
Last reply by bfarber, -
- 2 followers
- 4 replies
- 301 views
I need to have a background task to replace some content in some posts. Example post: <blockquote class="ipsQuote" data-gramm="false" data-ipsquote="" data-ipsquote-contentapp="forums" data-ipsquote-contentclass="forums_Topic" data-ipsquote-contentcommentid="24552935" data-ipsquote-contentid="1819682" data-ipsquote-contenttype="forums" data-ipsquote-timestamp="1534422313" data-ipsquote-userid="278655" data-ipsquote-username="Slettet-lYlo5C"> <div class="ipsQuote_citation"> TSPbot2 skrev (På 16.8.2018 den 14.25): </div> <div class="ipsQuote_contents ipsClearfix" data-gramm="false"> <p> This is my post <a href="https://w…
Last reply by bfarber, -
- 2 replies
- 193 views
Hello, system/Task/Task.php if ( method_exists( $extensions[ $key ], 'preQueueData' ) ) { $class = new $extensions[ $key ]; $data = $class->preQueueData( $data ); if ( $data === NULL ) { return; } } Based on DocBlock the method preQueueData() should return an array /** * Parse data before queuing * * @param array $data * @return array */ public function preQueueData( $data ) Ok. You allow to return NULL as you do in some background tasks. But a queue will not be run (added into core_queue table) and the method postComplete() will not be executed. Examples - applications/core/extensions/core/Queue/Re…
Last reply by Daniel F, -
- 1 reply
- 195 views
I'm having a really frustrating experience with this "CSS selector" feature. I'm simply trying to disable the "Show results" button in polls. I can successfully control other elements of the poll's rendering, but anything "deep" doesn't seem to be targetable. I've tried the built in picker. I've tried manual selectors. I've verified in a browser that they select one and only one correct element. It simply doesn't do anything. What am I not understanding? Example #1: Replacing the entire pollcontents works div.ipsPad.ipsClearfix[data-role='pollContents'] Correct: Example #2: div.ipsPad.ipsClearfix[data-role='pollContents'] ol.ipsList…
Last reply by Matt Summers, -
- 5 replies
- 274 views
Hello, $form->add( new \IPS\Helpers\Form\Upload( 'video_test', null, false, array( 'allowedFileTypes' => array( 'mp4' ), 'storageExtension' => 'app_Extension' ) ) ); Uploaded video
Last reply by bfarber, -
- 1 reply
- 201 views
Hello, Simple abstract code $table = new \IPS\Helpers\Table\Db('app_records', \IPS\Http\Url::internal('app=app&module=module&controller=controller')); $table->exclude = array('record_id'); $table->advancedSearch = array( 'record_member_id' => \IPS\Helpers\Table\SEARCH_MEMBER, ); \IPS\Output::i()->output = $table; generates an error array_key_exists() expects parameter 2 to be array, null given File: \system\Helpers\Table\Db.php Line: if( ( ( $this->include !== NULL and !\in_array( $k, $this->include ) ) or ( $this->exclude !== NULL and \in_array( $k, $this->exclude ) ) ) and !array_key_exists( $k, $advan…
Last reply by bfarber, -
- 1 follower
- 2 replies
- 241 views
I discovered something while investigating an issue. When a post with a quote is submitted to the database it stores it like this: <blockquote class="ipsQuote" data-gramm="false" data-ipsquote="" data-ipsquote-contentapp="forums" data-ipsquote-contentclass="forums_Topic" data-ipsquote-contentcommentid="25160025" data-ipsquote-contentid="1840499" data-ipsquote-contenttype="forums" data-ipsquote-timestamp="1573983633" data-ipsquote-userid="58981" data-ipsquote-username="TSP"> <div class="ipsQuote_citation"> TSP skrev (Akkurat nå): </div> <div class="ipsQuote_contents ipsClearfix" data-gramm="false"…
Last reply by CoffeeCake, -
- 6 replies
- 271 views
Hello, I'm adding a send message button in the stock records display template in pages. I can't seem to get the message to display the article posters name when the message pop up comes up. I'm using this code here <a href='{url="app=core&module=messaging&controller=messenger&do=compose&to={$member->member_id}" seoTemplate="messenger_compose"}' data-ipsDialog data-ipsDialog-title='{lang="compose_new"}' data-ipsDialog-remoteSubmit data-ipsDialog-flashMessage="{lang="message_sent"}" class='ipsButton ipsButton_primary ipsButton_small'><i class='fa fa-envelope'></i> <span> {lang="message_send"}</span></a> …
Last reply by DesignzShop, -
- 1 reply
- 216 views
Everytime I update (since 4.4.6) it resets the default_theme on init.php: // Default theme ID // It isn't really possible to change this but we have it defined as a constant rather // than putting "1" everywhere in the code just in case. If you deleted theme ID 1 and attempt to // build a custom application as a developer, you may need to override this value to specify a new // default/unmodified theme. 'DEFAULT_THEME_ID' => 1, I'm already on theme ID 44 due to that and I have to edit it everytime I update the board.
Last reply by Ryan Ashbrook,