Jump to content

IPCommerceFan

Clients
  • Posts

    493
  • Joined

  • Last visited

Community Answers

  1. IPCommerceFan's post in Regular Expression was marked as the answer   
    Ah yes, try this:
    ^(([1-9]\.([4-9]{1}|[4-9]{1}[0-9]))|[2-9]{0,9}\.[0-9]{1,2}|[0-9]{2,9}\.[0-9]{1,2}|[2-9]{0,9})$  
  2. IPCommerceFan's post in Extract Customer Address was marked as the answer   
    Assuming you are accessing the database directly via MySQL, you could use the JSON_EXTRACT function (MySQL 5.7 and above).
    SELECT address->>'$."addressLines"[0]' AS 'addressLine1', address->>'$."addressLines"[1]' AS 'addressLine2', address->>'$."city"' AS 'City', address->>'$."region"' AS 'Region', address->>'$."country"' AS 'Country', address->>'$."postalCode"' AS 'postalCode' FROM nexus_customer_addresses The above example utilizes the shorthand for JSON_UNQUOTE(JSON_EXTRACT()):
    https://dev.mysql.com/doc/refman/8.0/en/json-search-functions.html#operator_json-inline-path
  3. IPCommerceFan's post in REST API - In what format are 'Date periods' passed? was marked as the answer   
    Try using a unix timestamp, like so (this one is for Oct 1st 2021):
    /api/core/search?sortby=newest&key=################################&type=forums_topic&start_after=1633064400 The results that are returned are given in DateTime:
    { "page": 1, "perPage": 25, "totalResults": 1, "totalPages": 1, "results": [ { "title": "Widget", "content": "", "class": "IPS\\nexus\\Package\\Item", "objectId": 9999, "itemClass": "IPS\\nexus\\Package\\Item", "itemId": 9999, "started": "2021-11-02T08:35:52Z", "updated": "2021-11-02T08:38:33Z", "itemUrl": "https:\/\/www.yourdomain.com\/store\/product\/9999-widget\/", "objectUrl": "https:\/\/www.yourdomain.com\/store\/product\/9999-widget\/?do=findComment&comment=1358", "reputation": 0, "comments": null, "reviews": 0, "container": "Widgets", "containerUrl": "https:\/\/www.yourdomain.com\/store\/category\/1-widgets\/", "author": "Guest", "authorUrl": null, "authorPhoto": "https:\/\/www.yourdomain.com\/applications\/core\/dev\/resources\/global\/default_photo.png", "authorPhotoThumbnail": "https:\/\/www.yourdomain.com\/applications\/core\/dev\/resources\/global\/default_photo.png", "tags": [] } ] } But as far as the GET request goes, its in unixtime.
  4. IPCommerceFan's post in \IPS\Member::loggedIn() object question - isAdmin... isMod? was marked as the answer   
    @Liloz01, I'd say the comments in the source files are a pretty good form of documentation.  I use a 3rd party app called FileLocator aka Agent Ransack to search the source files for these sorts of things:

    We knew exactly what to search for in this case, but a search for just "moderator" would have ultimately led to the same result since the comment includes the word in line 72.
    I'm no programmer, but this tool along with a good IDE like PhpStorm have made all the difference in developing my own plugins as the need arises!
    As for how to know what you can do with \IPS\Member::loggedIn, I'd search for "\IPS\Member" and browse around to see how it is used, especially as it pertains to functions which accept a Member object.  (To find it used strictly in functions I'd search for "@param    \IPS\Member")
    e.g.:   \IPS\Member::loggedIn()->memberPostCount() 
    /** * Post count for member * * @param \IPS\Member $member The member * @param bool $includeNonPostCountIncreasing If FALSE, will skip any posts which would not cause the user's post count to increase * @param bool $includeHiddenAndPendingApproval If FALSE, will skip any hidden posts, or posts pending approval * @return int */ public static function memberPostCount( \IPS\Member $member, bool $includeNonPostCountIncreasing = FALSE, bool $includeHiddenAndPendingApproval = TRUE ) Hope that helps!
×
×
  • Create New...