Answer the question
In order to leave comments, you need to log in
Menu item not added to Bitrix24 user profile?
Good afternoon!
Some time ago, we managed to add a menu item in the Bitrix group for this material.
Now we need to add a similar item to the user card menu.
I do the same thing - it doesn't work. Moreover, if I go to the address, the link to which should be in the menu, the page opens, there are no errors.
Added an entry to the log - the logs are being written.
I can't figure out what's wrong.
event log file:
defined('B_PROLOG_INCLUDED') || die;
use Bitrix\Main\EventManager;
use Bitrix\Main\Loader;
use Ramapriya\Test;
Loader::registerAutoloadClasses(null, ['Ramapriya\\Test\\TestItem' => '/local/php_interface/test_item/testitem.php']);
$eventHandler = EventManager::getInstance();
$eventHandler->addEventHandler('socialnetwork', 'OnFillSocNetFeaturesList', ['Ramapriya\\Test\\TestItem','addFeature']);
$eventHandler->addEventHandlerCompatible('socialnetwork', 'OnFillSocNetMenu', ['Ramapriya\\Test\\TestItem','addSocNetMenu']);
$eventHandler->addEventHandlerCompatible('socialnetwork', 'OnParseSocNetComponentPath', ['Ramapriya\\Test\\TestItem','parseSocNetComponentPath']);
namespace Ramapriya\Test;
class TestItem {
public static function addFeature(&$arSocNetFeaturesSettings) {
$arSocNetFeaturesSettings['test_item'] = [
'allowed' => [SONET_ENTITY_USER, SONET_ENTITY_GROUP],
'operations' => [
'write' => [
SONET_ENTITY_USER => SONET_RELATIONS_TYPE_NONE,
SONET_ENTITY_GROUP => SONET_ROLES_MODERATOR
],
'view' => [
SONET_ENTITY_USER => SONET_RELATIONS_TYPE_ALL,
SONET_ENTITY_GROUP => SONET_ROLES_USER
]
],
'minoperation' => 'view'
];
writeToLog(LOG_DIRECTORY . 'addFeature_' . date('d.m.Y_H.i.s.') . 'txt', $arSocNetFeaturesSettings, 'add new feature');
}
public static function addSocNetMenu(&$arResult) {
$arResult['CanView']['test_item'] = true;
$arResult['Urls']['test_item'] = \CComponentEngine::MakePathFromTemplate('/company/personal/user/#user_id#/test_item/', ['user_id' => $arResult['User']['ID']]);
$arResult['Title']['test_item'] = 'Test Item';
writeToLog(LOG_DIRECTORY . 'addSocNetMenu_' . date('d.m.Y_H.i.s.') . 'txt', $arResult, 'add socnet menu');
}
public static function parseSocNetComponentPath(&$arUrlTemplates, &$arCustomPagesPath) {
$arUrlTemplates['test_item'] = 'user/#user_id#/test_item/';
$arCustomPagesPath['test_item'] = '/local/php_interface/test_item/';
writeToLog(LOG_DIRECTORY . 'parseSocNetComponentPath_' . date('d.m.Y_H.i.s.') . 'txt', [
'url_templates' => $arUrlTemplates,
'custom_pages_path' => $arCustomPagesPath
]);
}
}
Answer the question
In order to leave comments, you need to log in
When a new user card (sidebar) was being prepared, the mechanism that directly displays links to the top menu was changed, and therefore this mechanic stopped working.
You can join the collective ticket (2623832) and write that you also need this mechanic.
To do this, write your message to technical support and indicate that a similar problem has already been raised (ticket number in Bitrix helpdesk).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question