• Resolved Bucky

    (@rmaler1)


    I am currently running BadgeOS 1.4.4 and BadgeOS Community addon 1.2.0.

    I would like to change the submenu text “Achievements” in the BP profile area to “Challenge Coins”. I have a feeling it involves a relatively short and simple function in the functions.php, but I am not quite experienced enough to determine what that function would be. Also how can I change where that submenu is located in the list? It is currently last, right after settings and I would like it right in front of setting.

    Also, when a BadgeOS achievement is listed within a users profile it is linked (clickable) to that specific badgeos achievement post. How could I disable that link?

    Lastly, also in the achievement list in a users profile a point amount is listed with the information and a Show Details with arrows for drop down info. How can I remove both of those items? Basically I’d like to display strictly the badge and short description.

    A bundle of small questions here. Any help appreciated.

    https://www.ads-software.com/plugins/badgeos/

Viewing 12 replies - 1 through 12 (of 12 total)
  • Michael Beckwith

    (@tw2113)

    The BenchPresser

    Good early morning ??

    I am actually not sure how easy these requests are going to be, to be honest.

    The sub-menu text, for example is part of our extending of the BP_Component class, and the setup_nav method that’s related to that. At best I can think of at the moment, you’d have to get to it via the “gettext” WordPress filter, and try to conditionally alter that. Not going to be the best route though, as that’s a filter that’s run on EVERY single translatable string in a website.

    The position is also going to be related to the BP_Component bit.

    Regarding the content in the actual display, we essentially collect enough data to pass into badgeos_achievements_list_shortcode() which is the shortcode handler used in [badgeos_achievements_list] and displays the same way. Sadly no filters on that output.

    I do encourage having a look at the plugin file that handles this part. You can see it in BadgeOS-Community-Add-on/includes/bp-members.php. BuddyPress general know-how helps, but I don’t believe it’s so difficult to read that you wouldn’t be able to get a good idea. Best idea is to use your text editor to match up function names and callback fields for the various hooks, so you can see where what is used.

    Bit of a bummer overall. Wish I had better news. We need to work on making things more 3rd party customizable.

    Thread Starter Bucky

    (@rmaler1)

    Okay. I’ll check out that bp-component bit and badgeos file. Thanks.

    Thread Starter Bucky

    (@rmaler1)

    function bp_profile_menu_tabs_change(){
    global $bp;
    
    $bp->bp_nav['achievements']['position'] = 100; /move achievements infront of settings*/
    
    $bp->bp_nav['settings']['position'] = 101; /*move setting after achievements*/
    
    $bp->bp_nav['achievements']['name'] = 'challenge coins'; /*change "achievement to "challenge coins"*/
    
    $bp->bp_options_nav['achievements']['community']['name'] = ''; /*clear submenu of achievement name types in achievement list area of profile*/
    
    }
    
    add_action('bp_setup_nav', 'bp_profile_menu_tabs_change', 201);

    Clearing the submenu of achievement types only makes sense if you wish to display only a single type of achievement of course so this may not be desired by many people, but it is what I need.

    Could you tell me if this code appears loop-whole-less (haha) for my intenions?

    Next I am going to look into removing the points amount and show details drop down from achievement list items. I’ll probably end up doing this with css.

    Michael Beckwith

    (@tw2113)

    The BenchPresser

    I don’t see what you have being a huge issue, with regards to the nav items. Just as long as it’s being set late enough to not get overwritten again.

    Do what ya must, in this case.

    Thread Starter Bucky

    (@rmaler1)

    It’s not getting overwritten. I forgot to put up there that it actually works, haha. That may have been useful info. I was just looking for a check from someone more experienced. I’ve pretty much ironed everything out I was looing for. I’m using this css to remove the points and show details for now:

    /*removes points from badgeos list items*/
    .badgeos-item-points {
    	display: none
    }
    
    /*removes show details from badgeos list items*/
    .badgeos-item-attached {
    	display: none;
    }

    One last thing. How can I remove the dotted line dividers that badgeos puts in?

    Michael Beckwith

    (@tw2113)

    The BenchPresser

    I believe those are just borders on .achievement-wrap

    Thread Starter Bucky

    (@rmaler1)

    Thanks Michael. Found and it and took care of it. Unfortunately, the edit was getting overwritten in the custom.css so I had to edit the plugin badges-front.css file. I just have to keep a note of that for when I update.

    Michael Beckwith

    (@tw2113)

    The BenchPresser

    While we don’t have constant releases, it would still be better in your own location instead of editing our CSS file. Just a matter of getting a stronger CSS selector or having your edit load after ours.

    Thread Starter Bucky

    (@rmaler1)

    Michael,

    I’m not sure how to identify or locate a stronger selector, or edit load order.

    Here is what I did:

    #badgeos-achievements-container {
    	border-top: 1px dotted #aaa;
    	border-style: none; /*added css*/
    }
    /*added css for last child*/
    .badgeos-achievements-list-item:last-child {
    	border-style: none;

    I decided to only remove the very top border and the bottom border from the last list item. This is in the badgeos-front.css file.

    Michael Beckwith

    (@tw2113)

    The BenchPresser

    For the stronger selector stuff, it takes a knowledge of how CSS works. A good tutorial about it would be here https://css-tricks.com/specifics-on-css-specificity/ ID selectors are more specific than class selectors, as an example. #foo .bar {} will win over .bar {}, regardless of the order used in the stylesheet.

    Regarding going at it via load order, I’ll outline as simple of an example as I can.

    If you have the following in the same stylesheet file, the one declared last would be what’s used:

    .badgeos-achievements-list-item {
    color: red;
    }
    
    .badgeos-achievements-list-item {
    color: blue;
    }

    Now, say the blue color version is the one that you’re trying to override and it’s loaded in badgeos.css. If you put the red version in your own style.css, and style.css is loaded first during the pageload, before badgeos.css, then the blue color is still going to show once the page is loaded. This is because it was loaded last, and thus “won”. If you were to make badgeos.css load first, perhaps by changing the order that the stylesheets are loaded in your header.php, or however which way they may be added, then the red color would show through, because that was now last. You could also add it via a <style></style> block in between the <head> tags and have it output right before the closing </head> and that would have it load last and the red color showing.

    If I recall right, our CSS files are enqueued on the wp_enqueue_scripts hook with the default 10 priority. If you were to add a custom CSS file or your theme’s style.css on the same hook at a priority of 11, that should make it load last, achieving the effect you want.

    To summarize, I still highly encourage putting your modifications in a safe spot and not via editing our core plugins. I guarantee it’s possible to do safely, just needs a little bit of understanding and work.

    Thread Starter Bucky

    (@rmaler1)

    I managed to get it via css. However, I looked into the load ordering concept and that was interesting. I now know the load order for my theme. Thanks for the help.

    Michael Beckwith

    (@tw2113)

    The BenchPresser

    You’re welcome. Thanks for sticking with me through my hopefully clear explanation of things ??

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Achievements Section in BP Profile’ is closed to new replies.