We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3493
    • 66 Posts

    I’m currently using IPBWI to integrate Invision Power Board functions like user information and group information to my MODx web project. Unfortunatly, every single function I try to use with IPBWI through MODx returns this:
    « MODx Parse Error »
    MODx encountered the following error while attempting to parse the requested resource:
    « PHP Parse Error »

    PHP error debug
      Error: usort() [function.usort]: Invalid comparison function.
      Error type/ Nr.: Warning - 2
      File: /home/norcan2/public_html/forum/sources/handlers/han_parse_bbcode.php
      Line: 442
      Line 442 source: @usort( $this->ipsclass->cache[’emoticons’] , array( &$this->bbclass, ’smilie_length_sort’ ) );

    Parser timing
      MySQL: 0.0083 s (5 Requests)
      PHP: 0.4770 s
      Total: 0.4853 s
    Error while inserting event log into database.

    Is the MODx parser having a conflict with the IPB code? I’m sorry I’m not able to post the IPB code here due to copyright stuff, but I’ll try to supply more information about how I’m doing this.

    On a webpage, I’m using a snippet call to read if the currently logged on member is a part of a certain group. If not, then return some text saying he’s not an admin.

    Snippet code:
    	$SDK =& new IPBSDK();
    if($SDK->is_ingroup(4)) echo '<p>Congratulations! You are an admin :)</p>';
    			else echo '<p>Uh, you are not an admin - too bad!</p>';
    			$group = $SDK->get_groupinfo();

    The error seems to occour even if I just call the IPBSDK class:
    	$SDK =& new IPBSDK();

    Uhm... Help sad
    • I think this is simply a case of error suppression using @ not working within MODx. This was a bug in and previous releases, but is fixed in the current release candidate (as well as the current SVN trunk). That’s still a bad coding practice, to use error suppression to ignore poorly written logic, but since you didn’t write it. smiley

      I would suggest trying this on the latest or the RC2 and see if that solves the problem.
        • 3749
        • 24,544 Posts
        If OpenGeek’s suggestion doesn’t work, you could try messing with the code.

        The most likely cause of the error is that the smilie_length_sort() function is not available in the file /home/norcan2/public_html/forum/sources/handlers/han_parse_bbcode.php

        Maybe it’s in an include file that’s not being found. If nothing obvious pops up, you could try rewriting the usort call in han_parse_bbcode.php without the callback:

        usort( $this->ipsclass->cache['emoticons'] ,'smilie_length_sort');

        Then find the smilie_length_sort function and paste it into the han_parse_bbcode.php file.

        Or, just comment that usort line out and see if there’s any danger in having your smilies unsorted. wink
          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting