# Other

Events that does not have a specific context.

### onOpenGraphPrepare

```php
/**
 * Triggered on Open Graph data preparation for contest, entry or category (view).
 *
 * @param   string  $context   Event context.
 * @param   object  $item      Item: contest, entry or category.
 * @param   object  $ogObject  Object with Open Graph data.
 * @param   array   $options   Array of additional options like Twitter card types.
 */
public function onOpenGraphPrepare($context, $item, $ogObject, &$options)
{
	if ($context != 'com_competition.competition'
		&& $context != 'com_competition.participant'
		&& $context != 'com_competition.category'
		|| !\Joomla\CMS\Factory::getApplication()->app->isClient('site'))
	{
		return;
	}

	$ogObject->title = empty($item->title) ? $context : $item->title . ' - ' . $context;
	$ogObject->description   = 'onOpenGraphPrepare is working fine';
	$options['twitter_card'] = 'summary_large_image';
}
```

### onSaveRedirect

```php
/**
 * Triggered on entry or contest form save (controller).
 * com_competition.appform - entry form context.
 * com_competition.cform - contest form context.
 *
 * @param   string  $context    Event context.
 * @param   string  $url        URL to redirect.
 * @param   string  $msg        System message to display.
 * @param   array   $validData  Validated form data.
 */
public function onSaveRedirect($context, &$url, &$msg, $validData)
{
	if ($context != 'com_competition.appform'
		&& $context != 'com_competition.cform'
		|| !\Joomla\CMS\Factory::getApplication()->app->isClient('site'))
	{
		return;
	}

	$url = \Joomla\CMS\Uri\Uri::root();
	$msg = 'onSaveRedirect is working fine for ' . $context;
}
```

### onUserAuthorise

The event can be triggered anywhere in the component and allows the plugins to override `JUser::authorise` result in case it is not `true`. If the plugin returns `true` then action is allowed. Currently plugins can override only `core.vote` and `core.unvote` actions.

```php
/**
 * Event can be triggered anywhere in the component.
 *
 * @param   object  $user       Reference to JUser object.
 * @param   string  $action     Name of the action to check for permission, like 'core.vote'.
 * @param   object  $assetname  Name of the asset on which to perform the action, like 'com_competition.competition.1'.
 */
public function onUserAuthorise($user, $action, $assetname)
{
	// Allow action
	return;
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.norrnext.com/norrcompetition/customisation/events/other.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
