Hello! I intend to use my Discourse instance for an RPG. The user portfolio theme component would be perfect for showing things that users have submitted. Specifically, I want to be able to see a list of a user’s characters, lore submissions, and RPG scenes in the profile.
The only problem is that this theme component only supports having 1 category at a time. I tried setting category to 0 for all categories and then adding multiple tags, but this made the portfolio page appear blank. So, I would like to edit and install multiple instances of this theme component in order to have multiple portfolio pages for these separate items.
I tried downloading the theme component and editing the files (ie changing instances of portfolio to portfolio_2) and then installed the new copy in addition to the original, but neither of them is working.
When both are enabled…
Only one instance of the portfolio button is shown on user card (portfolio_2)
Only one instance of the portfolio button is shown in the user’s profile (portfolio_2)
The portfolio_2 page is blank on the user’s profile
Is it possible to make this work, or should I give up?
Thanks, this is a great place to look. I think I prefer the portfolio button to be in the horizontal menu of the profile (next to summary, activity, etc.) but the bigger problem I have is that if there are multiple tags I want to be able to filter by tag, i.e. users would click buttons to view only “characters” or “scenes” in the portfolio at one time.
I may end up trying to frankenstein something for this purpose from both of these theme components, but I’m going to poke around some more first. If anyone has additional ideas, please share!
I 100% agree about this being a good place for a general use case. My particular use case is for a community centered on role playing where users would be looking for this information on a regular basis, so I want the character and scene tracking buttons to be accessible with as few clicks as possible and highly visible. I don’t mean to knock your solution at all!
Okay, so, I went in different direction from trying to use the portfolio plugins. Not sure whether I should post this here or in a new thread - if so please let me know!
Is someone able take a look at this and tell me what I am doing wrong (and hopefully why / how to fix it)? I’ve spent hours upon hours reading tutorials, writing and making edits to this, but I am very much a beginner and I have come to a point where I’m not sure about what to try next.
The goal: display a list of topics from a specific category on a user’s summary page.
In this use case, it is for an RPG forum where users will create characters to post stories with. I want this plugin to show what characters a user has created so nobody has to dig too far for them. All of the character sheets will be stored in the same forum. So, I figure I just have to create a topic list that gets topics from the correct user and the correct forum.
I have been using the following as reference:
Here is my attempt. So far, the topic list header (topic/replies/activity) is showing up in the correct place, but it’s not populating with topics.
<script type="text/discourse-plugin" version="0.8">
const ajax = require('discourse/lib/ajax').ajax;
const Topic = require('discourse/models/topic').default;
const User = require('discourse/models/user').default;
// Need ajax, Topic, and User
api.registerConnectorClass('above-user-summary-stats', 'character-list', {
// above-user-summary-stats is the plugin outlet, character-list is custom component name
setupComponents(args, component) {
const store = getOwner(this).lookup("service:store");
return ajax(userPath(`/topics/created-by/${this.username_lower}.json`)).then(function (result) {
// lines taken from summary() in user.js model; trying to find the username of the user profile we are viewing so we can access the json of the topics they have created
let characterList = [];
// empty array to push topics into
result.topic_list.topics.forEach.category_id(4)(function(topic){
// topics only from the specific category we want
// around here kris's tutorial had some lines to associate users with the topic. I ignored it because I don't need users aside from the original poster to be displayed with the topic. Is this important?
//topic.posters.forEach(function(poster){
//poster.user = $.grep(featuredUsers, function(e){ return e.id == poster.user_id; })[0];
//});
characterList.push(Topic.create(topic));
// add topics to the topic list
});
component.set('characterList', characterList);
// Set up our component with the topics from the array
}); // end ajax
} // end setupComponents
});
</script>
<script type="text/x-handlebars" data-template-name="/connectors/above-user-summary-stats/character-list">
<div class="custom-character-list-wrapper">
{{topic-list topics=characterList showPosters=false}}
</div>
</script>