Recent Topics

Plugin Hook Requests

Started by on Oct 08, 2016 – Contents updated: Oct 19, 2016

Oct 08, 2016 15:30    

Could you please also considering adding hooks for downloads. This will be for when ever a front end user clicks to download a file. Such as:

	/* 
	*	Used by plugin that can request user to be logged in to download file
	*	Or check if user is human
	*	Or request password
	*	Get requested file ID and perhaps the plugin will only allow a specific user to download
	*	Or allow downloads for specified blog, user level ect
	*	if $canceldownload = true it will stop the download process
	*	if $canceldownload = true user can be redirected to custom url
	*/
	function BeforeDownloadAction( $canceldownload = false, $redirect_url = 'none' )
	{
	
	return true;
	}

	/* 
	*	Used by plugin that can redirect user after file download
	* 	Or display a custom message that can be targeted by user level ect
	*	User can be redirected to custom url
	*/
	function AfterDownloadAction( $redirect_url = 'none' )
	{
	
	return true;
	}

Oct 08, 2016 15:45

@fplanque wrote earlier:

Would that work as new events:

Thanks, WidgetsBeginSettingsForm() and WidgetsEndSettingsForm() will be perfect. Thanks!

Oct 08, 2016 15:47

@fplanque wrote earlier:

Regarding a previous request. b2evo 6.7.8 will include these new hooks:

  • SkinEndHtmlHead
  • SkinBeginHtmlBody

Updated doc page: http://b2evolution.net/man/list-of-plugin-hooks

Regarding class questions: I'm really not a big fan of the plugins messing with the backoffice layout. So yes please make your point with a screenshot showing the problem. Thanks.

Oct 19, 2016 08:24

Is the dev team considering adding the download hooks?

Oct 19, 2016 15:39

Yes, they should already be in 6.7.8 on GitHub.

Oct 19, 2016 16:43

WidgetBegin and WidgetEndSettingsForm are on GitHub, but BeforeDownloadAction and AfterDownloadAction are not?

Oct 19, 2016 22:24

Ah see, that's what happens when you mix different requests in a single forum topic! :p


I don't understand how these hooks are supposed to work.

Can you please post a screenshot with arrows showing exactly when and where you expect those events to fire? (ideally in a similar way to the screenshot above) And give one (just one) example of what a plugin might do when the event fires?

Thanks.


Form is loading...

powered by b2evolution free blog software – This forum is powered by b2evolution CMS, a complete engine for your website.