Jump to content

Sly_Ripper

Clients
  • Posts

    177
  • 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

Posts posted by Sly_Ripper

  1. 1 hour ago, Marc Stridgen said:

    You mention "Upon logging in". Are you referring to log in to an external source, or logging in directly on the community. If on the external source, you would need to actually set up the redirect URL on your external source correctly.

    Using OAuth while you’re already authenticated with the forum.

    If 2FA is enabled, after inputting user/pass you’re just redirected to the forum index instead of triggering 2FA/redirecting to the redirect URL set in the oauth app.

    Disabling 2FA or logging out of the forum first both work fine.

     

  2. Steps to reproduce

    • Enable/set up 2FA
    • Log into forum
    • Attempt to log into external app with the forum's OAuth (/oauth/authorize/?client_id=client_id_here&response_type=code&scope=scopes&prompt=login)
    • Upon logging in you will be redirected to the forum homepage, not the correct redirect url
    • Disabling 2FA fixes this, as does logging out of the forum first
  3. image.png

    When "show on member's profile" is set to "Do not show", it will also not show on content submissions when that's set to show. The content submission setting should either apply or be disabled

    Edit: actually, when content submissions was set to "show to all" it was being treated as "show to staff and profile owner"

  4. [2023-07-04T16:42:25,544][INFO ][o.o.c.m.MetadataDeleteIndexService] [e14911be311d] [content/YyPDIyO8TqCQgJPetdn7UA] deleting index
    [2023-07-04T16:42:25,582][INFO ][o.o.a.u.d.DestinationMigrationCoordinator] [e14911be311d] Detected cluster change event for destination migration
    [2023-07-04T16:42:25,583][ERROR][o.o.i.i.ManagedIndexCoordinator] [e14911be311d] get managed-index failed: [.opendistro-ism-config] IndexNotFoundException[no such index [.opendistro-ism-config]]

    Definitely broken, tried opensearch 2.0.1 and 2.1.0. When rebuilding, the index is deleted and not re-created.
    Tried elasticsearch 7.17.10 and it works fine.

  5. I considered attaching the sub-forums to clubs but forums that are part of a club are still loaded on index/forum views.

    An Invision install with clubs enabled are possibly prone to this slowdown, I don't know if the club rows are evaluated or not.

  6. Continuing from this topic:

    The board index (and I assume any forum listing) grabs every row from forums_forums, this could be 20k sub-forums. The board index should only grab nodes/categories with a parent ID of -1 and then any forums with those results as a parent, and sub-forums of that parent. The only reason I can think of that it's not done this way is to provide the correct "last post" info for the user's permissions. It would be nice to have an option to just limit the "last post" depth to 1 sub-forum deep and have a more performant forum.

  7. 19 hours ago, Stuart Silvester said:

    Thanks for the follow up.

    That helps explain the issue you're having. When you're updated the allowed IDs in the __construct() method, the \IPS\Member object has to be instantiated in order for that code to run. This happens automatically when using this code has a front/admin session available in normal use on the front end (which is why we're all expecting it to be working).

    Solving this (although not pretty) would be as simple as putting this in your code before you load the member.

    new \IPS\Member;

     

    Solved, thanks

  8. 10 minutes ago, Stuart Silvester said:

    We've used this approach in a lot of plugins, so I know it's working properly. Make sure that you actually have a `remote_id` column created in the `core_members` table.

    It may also be worthwhile to show the log from the system log page in the support section. The JSON is not a real error.

    Although, these days we would recommend keeping track of SSO data in your own table so that you're not modifying core tables.

    I mentioned the line that throws the error in the first post, using the doc's code, '$databaseIdFields' is not being overwritten by the hook correctly.

    #0 /app/system/Member/Member.php(240): IPS\Patterns\_ActiveRecord::load()
    #1 /app/applications/appname/api/members.php(28): IPS\_Member::load()
    #2 /app/system/Api/Controller.php(180): IPS\appname\api\_members->GETitem()
    #3 /app/system/Dispatcher/Api.php(343): IPS\Api\_Controller->execute()
    #4 /app/api/index.php(11): IPS\Dispatcher\_Api->run()
    #5 {main}

     

    Doing it this way works, probably not the best idea though:

    class appname_hook_CustomMemberColumns extends _HOOK_CLASS_
    {
        protected static $databaseIdFields = array('name', 'email', 'remote_id');

     

  9. On 6/19/2023 at 5:30 PM, teraßyte said:

    I think we need to take a step back and start from scratch here.

     

    What are you trying to do exactly?

    1. If you just need to load a member by using their ID, you don't need the hook or the remote_id value.
    2. Or are you trying to load a member based on some kind of external ID after adding a remote_id column to the core_members table in the database?

     

    Knowing your goal would help guide you in the correct direction.

    2

     

    @Matt this is either a bug or bad docs

  10. 55 minutes ago, teraßyte said:

    Yes, that seems indeed correct. Try adding this code right before the parent call:

    var_dump( static::$databaseIdFields );exit;

    If the hook is being loaded properly, you should get an output of 3 values: name, email, remote_id.

     

    If you don't get anything, maybe there's a typo in the class you're trying to extend. Something like \IPS\Members instead of \IPS\Member. I had it happen a few times. 😅

     

     

    array(3) { [0]=> string(4) "name" [1]=> string(5) "email" [2]=> string(9) "remote_id" }

    Still throws an error when trying to load a member with 'remote_id'. Being in an API route shouldn't make a difference?

  11. 12 hours ago, teraßyte said:

    As long as you fixed the parent call being outside the function in the example, it should work.

    I you post here the hook's code I can take a quick look maybe.

    It's literally just a fresh hook and the example code

    //<?php
    
    /* To prevent PHP errors (extending class does not exist) revealing path */
    if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
    {
    	exit;
    }
    
    class appname_hook_CustomMemberColumns extends _HOOK_CLASS_
    {
        /**
         * Add our own column to default fields
         */
        public function __construct()
        {      
            static::$databaseIdFields = array_merge( static::$databaseIdFields, array( 'remote_id' ) );
            
            parent::__construct();
        }
    
    }

     

  12. 47 minutes ago, teraßyte said:

    You can only use the allowed values in the \IPS\Member class for the second parameter:

    	/**
    	 * @brief	[ActiveRecord] Database ID Fields
    	 */
    	protected static $databaseIdFields = array( 'name', 'email' );

     

    If you want to load based on the member_id column, simply skip the second parameter. You need to provide it only if you're loading a member based on their name or email address.

     

    Ah you're right. What about with custom columns? My hook is valid since inputting a column that doesn't exist here throws an error, with a valid column it throws the same error as before:

    static::$databaseIdFields = array_merge( static::$databaseIdFields, array( 'remote_id' ) );

     

  13. Fresh install, trying to add an API route but Member::load breaks any time I pass $idField, even default fields.

    works:

    $member = \IPS\Member::load(1);

     

    $member = \IPS\Member::load(1, 'member_id');

    Returns

    {
    	"errorCode": "EX0",
    	"errorMessage": ""
    }

    System log says "InvalidArgumentException (0)", viewing the log shows OutOfRangeException from line 115 /app/system/Patterns/ActiveRecord.php

     

    Also, the docs need fixing: 

     

        /**
         * Add our own column to default fields
         */
        public function __construct()
        {
            static::$databaseIdFields = array_merge( static::$databaseIdFields, array( 'remote_id' ) );
    
        }
            parent::__construct();

     

  14. On this page: https://invisioncommunity.com/developers/rest-api?endpoint=forums/forums/POSTindex (and any others regarding permissions)

    Quote

    An object with the keys as permission options (view, read, add, reply, attachments) and values as permissions to use (which may be * to grant access to all groups, or an array of group IDs to permit access to)

    I kept getting the following error when sending an object

    {
    	"errorCode": "EX1364",
    	"errorMessage": "UNKNOWN_ERROR"
    }

    It needs to be sent as an array:

    image.png.27cb6743acd3e35df905a4c496b6851f.png

     

    Also, "an array of group IDs", if you send an array "[3]" it will literally insert that into the DB, it still seems to function but is probably wrong:

    image.png.3f2977925a35d95f726ed9780614d2f3.png

  15. 4 hours ago, Ahmad E. said:

    Are you using nginx only or are you using nginx as a proxy for apache? Never used plesk myself so not sure.

    Nginx and php-fpm, tested it in Apache and it worked.

    Edit:
    I created an API key while using Apache, switched over to Nginx and using that key gives a valid result, but still using "test" as the key fails (and so the AdminCP shows no options to add/edit keys yet).

    >curl http://localhost/forums/api/core/hello --user a33cb937a4953c72bc4da6e89da39e51:
    {                                                                                                                                                
        "communityName": "IPS Community Suite",                                                                                                      
        "communityUrl": "http:\/\/localhost\/forums\/",                                                                                             
        "ipsVersion": "4.1.6"                                                                                                                        
    }                                                                                                                                                
    >curl http://localhost/forums/api/core/hello --user test:                            
    {                                                                                                                                                
        "errorCode": "3S290\/7",                                                                                                                     
        "errorMessage": "INVALID_API_KEY"                                                                                                            
    }                                                                                                                                                

    @bfarber Should I submit a bug report?

×
×
  • Create New...