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

  • webmstr replied on the discussion topic Help with adding a link
    Just exploring based on the url, I see that the page I'm looking at is not part of /discussions, but rather part of /groups, and the reason that I didn't find "add:object:discussion" here is because it's generated dynamically... view reply
  • webmstr replied on the discussion topic Help with adding a link
    Thank you for the screen shot - it shows that you were working on a different page than I was expecting.  Your plugin worked perfectly; it was my request that was flawed. I had hoped to change... view reply
  • webmstr replied on the discussion topic Help with adding a link
    Yeah, the other instructions just said to install the view file, so I appreciate the extra details. I tired using your sample plugin as a guide, but I never got the results that I was expecting.  I deleted that work and installed your sample... view reply
  • webmstr replied on the discussion topic Help with adding a link
    Thanks for the quick reply.  Based on those specifics and the links you provided, I tried to create my own plugin to extend 'discussions' with the new link: made the mods/discussions_local directory added a manifest.xml in this... view reply
  • webmstr added a new discussion topic Help with adding a link in the group Beginning Developers
    I looked around for a detailed introduction to working in the framework, but only found the tutorial which pretty much assumes that you know how to work in the framework or that you've already written a plugin.  I try to trace through the...
    • Thank you for the screen shot - it shows that you were working on a different page than I was expecting.  Your plugin worked perfectly; it was my request that was flawed.

      I had hoped to change the example.com/groups/profile/100/test-group page, which currently displays the following:

       

      I don't like that the "Add discussion topic" moves down with every new topic, thus making it harder for people to start new topics.  So, I'd like to either move that link above the topic shown (between the grey bar and the "test topic title"), or maybe add it where "View All" is, or add it as an option on the "Joined" pulldown in the top-right.

      Can you point me to those locations?

       

    • Just exploring based on the url, I see that the page I'm looking at is not part of /discussions, but rather part of /groups, and the reason that I didn't find "add:object:discussion" here is because it's generated dynamically for different content types (e.g. discussions, pages).

      It looks like a lot of the magic comes from groups/views/default/groups/profile/module.php, where the current "Add discussion topic" is part of $footer, the "View All" is part of $menu, and I could add it (not as attractively) to the beginning of $content generated for the section.

      Since the pattern seems to be to have my own plugin override the existing behavior, it looks like I should copy module.php into my own plugin and it will override the default one.  Since it needs to be loaded later than the original, I assume it's overwriting some registration before the page is rendered.  Can you point out where in your plugin code that it identifies itself as replacing a 'discussion' element?

    •  it was my request that was flawed

      Of course, this is a groups/module view not discussion.

      Copy

      mod\groups\views\default\groups\profile\module.php

      To same directory of your custom plugin and change this code on this:

      if($entity_subtype == 'discussion') {
          $add_topic = elgg_view('output/url', [
                'text' => elgg_echo('add:object:discussion'),
                'href' => elgg_generate_url('add:object:discussion', [
                      'guid' => $group->guid,
                ]),
                'class' => 'mrm',
           ]);
      }
      
      if (!empty($all_link)) {
          $menu = elgg_format_element('span', [
                 'class' => 'groups-widget-viewall',
         ], $add_topic . $all_link);
      }

      This adds your desired link on the module at the top before 'View all'.

      Keep in your minds, it was actually for Discussions only not other subtypes.

      If you want to use it globally then change my code on:

      $add_entity = elgg_view('output/url', [
                'text' => elgg_echo("add:{$entity_type}:{$entity_subtype}"),
                'href' => elgg_generate_url("add:{$entity_type}:{$entity_subtype}", [
                      'guid' => $group->guid,
                ]),
                'class' => 'mrm',
      ]);
      
      if (!empty($all_link)) {
          $menu = elgg_format_element('span', [
                 'class' => 'groups-widget-viewall',
         ], $add_entity . $all_link);
      }

      Don't forget: Clean the caches after the changes

  • webmstr joined the group Beginning Developers