Jump to content

MemberExportPersonalInformation extension hitch


Go to solution Solved by bfarber,

Recommended Posts

tldr; You can create and name the extension anything you like, just like any other extension. But if you want the extension to actually work, that name can only, exclusively, be "Main". If you name your file anything else for this extension, the extensions.json file will not have the entry added, and even if you add the entry manually to the json file, this will kick out Whoops class not found error as it is apparently not correctly set in the Application object or wherever. If you DO set your class name to Main when creating this extension, everything works as intended.

- Add extension for 3rd party app via dev center
- Give it a class name of Whatever (so Whatever.php in my app's extension dir)
- Edit file
- Class name in the auto-gen extension file is _Main, not _Whatever - doesn't matter what you enter, this will always auto-gen to _Main
- If you run the extension via the ACP - Members - Member View - download personal data button, nothing occurs, even when you correctly name the function to what you set it as in the dev center
- That's because the extensions.json data file entry for this extension is never added when you add this extension via the dev center when you name the class something other than Main
- If you manually enter your extension into the json file, clear caches to be safe, and then try again to use the extension via the ACP - Members - Member View - download personal data button...

Class 'IPS\core\extensions\core\MemberExportPersonalInformation\Whatever' not found

So the json file is correctly being read to engage the extension but elsewhere it does not exist - perhaps/probably in the application obj itself.

If I DELETE the extension in the dev center, that DOES remove my-manually-added entry in the json file AND the extension PHP file itself - these would be my not-named Main entry and file.

I'd also note you have zero documentation on this extension in the Developers Documentation.

Solution: perk up this method so it correctly takes in the set-by-the-developer class name, or, if you are locking this down to just Main, note in dev documentation (once you create some...), though that would mean only a single one of these extensions per-application and I'm not sure if that's the best thing (just my two cents)

Edited by All Astronauts
Link to comment
Share on other sites

I can make a vid if you like, but this is as straight-forward as it seems.

Create new extension, name it something, nothing appears in json, doesn't work (obvs)

Deleted. 

Tried again, this time with Main, worked.

Did I try again a third time with a non-Main name or an entire new app after I deleted the original and tried again with Main? No.

My luck this was a one-off Dev mode hitch... I'll poke it some more

EDIT: No need for vid, you can replicate this yourself - this is still broken. I used an app that just had some widgets in it (testing app), and added a new memberExportwhatever extension not named Main ("Workdamnyou"). 

Added fine, json did NOT build out, the PHP file class is as stated before, _Main and not _Workdamnyou

Ok, that's expected, so I added another one.

It wanted nothing to do with it at all. In fact, it seemed to think the name I provided ("Jake") was actually Main, and since the previous created extension here got the name _Main, naturally that's a crash:

 nope.thumb.JPG.2f18438e87fe5b38dcf75a96400f4cbc.JPG

Tis' bugged

Edited by All Astronauts
Link to comment
Share on other sites

applications/core/data/defaults/extension/MemberExportPersonalInformation.txt

<?php
/**
 * @brief		ACP Export Personal Information
 * @author		<a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
 * @copyright	(c) Invision Power Services, Inc.
 * @license		https://www.invisioncommunity.com/legal/standards/
 * @package		Invision Community
{subpackage}
 * @since		{date}
 */

namespace IPS\{app}\extensions\core\MemberExportPersonalInformation;

/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
	header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
	exit;
}

/**
 * @brief	ACP Export Personal Information
 */
class _Main

It should be:

class _{class}

 

Link to comment
Share on other sites

  • 1 year later...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...