Add new menu item and right side view on user profile page

plugins

#1

Hey everyone, I’m having issues extending the user profile view how I’d like.

Currently I have two buttons that are being shown on the users profile page, when these buttons are clicked I simply need to show my new view on the right side just like if you’re viewing private messages etc. The problem I’m having is that I’m mimicking the route from private messages like so…

import createPMRoute from "discourse/routes/build-user-topic-list-route";

export default createPMRoute('myview', 'private-messages');

but when attempting to load the profile page these routes don’t appear to ever be registered in my plugin causing ember to throw an exception that the route can’t be found. Do I have to explicitly set these routes in my plugin.rb file? This seems like it shouldn’t be this complicated but I’m missing something.


(Sam Saffron) #2

Hold off on this, I am changing this page around and you are likely to need to redo a lot of your work.


#3

Unfortunately im stuck developing against version 1.4 beta 9 and do not
have the option to wait due to a client expecting this functionality soon,
they have a budget for changes needed to support future discourse versions
so its fine if i have to redo the work :no_mouth:


#4

So I’m able to do this granted I extend an existing controller like activity or something while making use of the topic list template, the problem I’m having is that I need to have my own template for this data and I have my route file and controller file named appropriately but the error I get is the following.

Could not find module discourse/routes/user-list imported from discourse/plugins/my_plugin/discourse/routes/user-activity-custom

import ViewingActionType from "discourse/mixins/viewing-action-type";

export default Discourse.Route.extend(ViewingActionType, {
  renderTemplate() {
    this.render('user-list');
  },

  setupController(controller, model) {
    this.controllerFor('user-list').setProperties({
      model,
      hideCategory: false,
      showParticipants: false
    });
  }
});

It’s as though creating the module in my plugin directory does not get processed and initiated. Any guidance would be very much appreciated, I don’t mind redoing work later as I only need to support an old version at the moment. I also registered the files in my plugin.rb to no benefit.


#5

Looks like you have to use an absolute path because the custom routes don’t get registered so instead of doing something like…

import UserListRoute from "discourse/routes/user--list"

You have to do this with the correct casing on your plugin name or it won’t know what to do.

import UserListRoute from "discourse/plugins/MyPluginName/discourse/routes/user-list";


#6

I’m also looking at adding a new page next to the Activity page for a music forum. Is this something that could be done with a plugin or would I have to change the base code?


(Steven Slade) #7

I am currently trying to alter user.hbs under templates/user by following the same path in plugin. However, for some reason, I try alter the layout and Discourse does not use my plugin template, but sticks with the default profile template in the source code. Any idea why doing the regular plugin would not take effect on profiles?