ZdejPoham

Send private message

You must be logged in to send a private message.

Friends

No friends yet.

Group membership

  • Beginning Developers

    Beginning Developers

    This space is for newcomers, who wish to build a new plugin or to customize an existing one to their liking

Activity

  • ZdejPoham replied on the discussion topic pagesetup, system (deprecated in 2.3)
    So, according to Tools/Inspect/menu I have event_calendar, file, poll, groups:member and groups-add in owner_block. Setting elgg_register_plugin_hook_handler( 'prepare', 'menu:owner_block', 'mysite_pagesetup', 9999... view reply
  • ZdejPoham added a new discussion topic pagesetup, system (deprecated in 2.3) in the group Beginning Developers
    pagesetup, system (deprecated in 2.3) Called just before the first content is produced. Is triggered by elgg_view(). Use the menu or page shell hooks instead.  Greetings. Can anyone please explain this more in-depth? Before 2.3 I used...
    • So, according to Tools/Inspect/menu I have event_calendar, file, poll, groups:member and groups-add in owner_block. Setting

      elgg_register_plugin_hook_handler( 'prepare', 'menu:owner_block', 'mysite_pagesetup', 9999 );

      where

      function mysite_pagesetup () {
          elgg_unregister_menu_item( 'owner_block', 'event_calendar' );
          elgg_unregister_menu_item( 'owner_block', 'poll' );
          elgg_unregister_menu_item( 'owner_block', 'file' );
          elgg_unregister_menu_item( 'owner_block', 'groups:member' );
          elgg_unregister_menu_item( 'owner_block', 'groups-add' );
          echo "<h1>This should work?</h1>";
      }

      only works to the extent, that the function get called, as the heading "This should work?" is displayed just above the menu items, which don't get removed.

      BR,
      ZP

      Edit: same goes also for register, menu:owner_block.

    • I've a new version of the Event Calendar plugin in the works that will no longer use the deprecated 'pagesetup', 'system' hook. Unfortunately, I have no idea when I will be able to finish the work on this new version (as I just have no time for months already to do any work on it).

      The changes necessary for the menu issue in Event Calendar should be changing

      if (elgg_get_plugin_setting('ical_import_export', 'event_calendar') == "yes") {
          elgg_register_event_handler('pagesetup', 'system', 'ec_ical_pagesetup');
      }

      in the init function to

      if (elgg_get_plugin_setting('ical_import_export', 'event_calendar') == "yes") {
          elgg_register_plugin_hook_handler('register', 'menu:title', 'ec_ical_titlemenu');
      }

      and replacing the ec_ical_pagesetup function in start.php with

      // If iCal import/export is enabled add corresponding action buttons in title area
      function ec_ical_titlemenu($hook, $type, $return, $params) {
          if(!elgg_in_context("event_calendar")) {
              return $return;
          }
      
          $use_titlemenu = get_input('ical_calendar_title_menu', false);
          if ($use_titlemenu && elgg_is_logged_in()) {
              $filter = get_input('ical_calendar_filter', false);
              $date = get_input('ical_date', false);
              $interval = get_input('ical_interval', false);
              $group_guid = get_input('ical_group_guid', false);
      
              $export_url = elgg_get_site_url() . 'event_calendar/ical/export?method=ical';
              $import_url = elgg_get_site_url() . 'event_calendar/ical/import?method=ical';
              $urlsuffix = '';
      
              if ($filter) {
                  $urlsuffix .= "&filter={$filter}";
              }
      
              if ($date) {
                  $urlsuffix .= "&date={$date}";
              }
      
              if ($interval) {
                  $urlsuffix .= "&interval={$interval}";
              }
      
              if ($group_guid !== false) {
                  $urlsuffix .= "&group_guid={$group_guid}";
              }
      
              $export = new ElggMenuItem('ical_export', elgg_echo('event_calendar:export'), $export_url . $urlsuffix);
              $export->setLinkClass('elgg-button elgg-button-action');
              $return[] = $export;
      
              $import = new ElggMenuItem('ical_import', elgg_echo('event_calendar:import'), $import_url . $urlsuffix);
              $import->setLinkClass('elgg-button elgg-button-action');
              $return[] = $import;
      
              return $return;
          }
      }

      For other plugins similar changes should work.

      Are you sure that it's the Poll plugin listed or is it the Event Poll plugin? I also have a new version of the Event Poll plugin waiting to be released (want to release it together with Event Calendar though). In Event Poll the line

      elgg_register_event_handler('pagesetup', 'system', 'event_poll_pagesetup');

      before the init functions needs to be dropped and the line

      // page menu
      elgg_register_plugin_hook_handler('register', 'menu:page', 'event_poll_pagemenu');

      added inside the init function. And the funtion event_poll_pagesetup() gets replaced by

      function event_poll_pagemenu($hook, $type, $return, $params) {
          $context = elgg_get_context();
          if (!in_array($context, array('event_calendar', 'event_calendar:view', 'event_poll'))) {
              return $return;
          }
      
          elgg_load_library('elgg:event_calendar');
          elgg_load_library('elgg:event_poll');
      
          $poe = elgg_get_page_owner_entity();
          if (elgg_instanceof($poe, 'group')) {
              $group_guid = $poe->guid;
          } else {
              $group_guid = 0;
          }
      
          if (event_calendar_can_add($group_guid)) {
              if ($group_guid) {
                  $url_schedule_event =  "event_calendar/schedule/$group_guid";
              } else {
                  $url_schedule_event =  "event_calendar/schedule";
              }
      
              $schedule_event = new ElggMenuItem('event-calendar-1schedule', elgg_echo('event_calendar:schedule_event'), $url_schedule_event);
              $schedule_event->setSection('event_poll');
              $return[] = $schedule_event;
          }
      
          $url_list_polls =  "event_poll/list/all";
          $list_polls = new ElggMenuItem('event-calendar-2list-polls', elgg_echo('event_calendar:list_polls'), $url_list_polls);
          $list_polls->setSection('event_poll');
          $return[] = $list_polls;
      
          return $return;
      }

      The function event_poll_handle_event_poll_add_items() in model.php of Event Poll is no longer used either.

  • ZdejPoham replied on the discussion topic Auto-creating groups broke with Elgg 2.3
    Oh snap! Thanks iionly! That was sufficiently long ago for me to forget about it. I'll have it fixed in no time thanks to you for pointing me in the right direction. BR, ZP view reply
  • ZdejPoham replied on the discussion topic Auto-creating groups broke with Elgg 2.3
    The validation by email plugin is turned on. I don't know if the function gets called, could be the validate:after event was changed in 2.3. Whatever. Downgrading back to 2.2. BR ZP view reply
  • ZdejPoham added a new discussion topic Auto-creating groups broke with Elgg 2.3 in the group Beginning Developers
    Hi all. In Elgg 2.2 I had the following hook to auto-create group(s) after user validated by e-mail: elgg_register_event_handler( 'validate:after', 'user', 'validate_event_handler', 9999 ); function...
  • ZdejPoham replied on the discussion topic How to get rid of groups/add menu item?
    Thanks. view reply
  • ZdejPoham added a new discussion topic How to get rid of groups/add menu item? in the group Beginning Developers
    Hi. I'd like to get rid of all instances of the groups/add menu item (HTML class elgg-menu-item-groups-add). I tried elgg_unregister_menu_item( 'owner_block', 'groups:add' ) and elgg_unregister_menu_item( 'page',...
  • ZdejPoham replied on the discussion topic Group roles
    Thank you all for answers. RvR, I took a look at Roles plugin before posting here, but it does not meet my needs, as it sets "global" roles, while I need group specific roles. It appears I'll have to code it myself, so a few... view reply